From eb38a8eb1194c4977def428962457b940df5aa81 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Fri, 15 Feb 2019 13:31:57 +0800 Subject: [PATCH 001/796] 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 b8c5596bdeed5537376f746040999f35c9669648 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Mon, 18 Feb 2019 13:34:59 +0800 Subject: [PATCH 002/796] 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 d78eb42a616629ac4bf7ff9991e3f7cefbafabd6 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Wed, 20 Feb 2019 13:30:59 +0800 Subject: [PATCH 003/796] 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 4ca61bf760d6b7fe3a89bdf4c0f2451fc1b5f5dd Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Thu, 21 Feb 2019 13:31:19 +0800 Subject: [PATCH 004/796] 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 0c5b88454df00ca55cb40f645c31fef8aa168744 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Fri, 22 Feb 2019 13:32:14 +0800 Subject: [PATCH 005/796] 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 d898eadcff49e308d29ef440ce1b66482a7bc335 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Sun, 24 Feb 2019 14:02:00 +0800 Subject: [PATCH 006/796] 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 5a97c521691d3de0ae00a7260c2d77bce0007039 Mon Sep 17 00:00:00 2001 From: oska874 Date: Sun, 24 Feb 2019 21:32:45 +0800 Subject: [PATCH 007/796] =?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 6d4d9177ad1cc595b47e7d4949f9fcd4c4b55bc1 Mon Sep 17 00:00:00 2001 From: AnDJ <363787371@qq.com> Date: Sun, 24 Feb 2019 23:04:54 +0800 Subject: [PATCH 008/796] 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 ec8fb1fc90effa57732a630b826dfde1797e2e59 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Wed, 27 Feb 2019 13:31:01 +0800 Subject: [PATCH 009/796] 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 9e07df4c063d4d5e667428c29df89ac97967c317 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 27 Feb 2019 15:37:11 +0800 Subject: [PATCH 010/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190221=20Bash-I?= =?UTF-8?q?nsulter=20:=20A=20Script=20That=20Insults=20An=20User=20When=20?= =?UTF-8?q?Typing=20A=20Wrong=20Command=20sources/tech/20190221=20Bash-Ins?= =?UTF-8?q?ulter=20-=20A=20Script=20That=20Insults=20An=20User=20When=20Ty?= =?UTF-8?q?ping=20A=20Wrong=20Command.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...lts An User When Typing A Wrong Command.md | 194 ++++++++++++++++++ 1 file changed, 194 insertions(+) create mode 100644 sources/tech/20190221 Bash-Insulter - A Script That Insults An User When Typing A Wrong Command.md diff --git a/sources/tech/20190221 Bash-Insulter - A Script That Insults An User When Typing A Wrong Command.md b/sources/tech/20190221 Bash-Insulter - A Script That Insults An User When Typing A Wrong Command.md new file mode 100644 index 0000000000..bd81a843ac --- /dev/null +++ b/sources/tech/20190221 Bash-Insulter - A Script That Insults An User When Typing A Wrong Command.md @@ -0,0 +1,194 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Bash-Insulter : A Script That Insults An User When Typing A Wrong Command) +[#]: via: (https://www.2daygeek.com/bash-insulter-insults-the-user-when-typing-wrong-command/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +Bash-Insulter : A Script That Insults An User When Typing A Wrong Command +====== + +This is such a nice and funny script that insult an user whenever they are typing a wrong command in terminal. + +It’s make you to feel happy when you are working on some issues. + +But somebody feel bad when the get an insult. However, i really feel happy when i get an insulted on terminal. + +It’s a funny CLI tool that insults you with random phrases if you do mistake. + +Also, it allows you to update your own phrases. + +### How To Install Bash-Insulter In Linux? + +Make sure, git package were installed on your system before performing Bash-Insulter installation. If no, use the following command to install it. + +For **`Fedora`** system, use **[DNF Command][1]** to install git. + +``` +$ sudo dnf install git +``` + +For **`Debian/Ubuntu`** systems, use **[APT-GET Command][2]** or **[APT Command][3]** to install git. + +``` +$ sudo apt install git +``` + +For **`Arch Linux`** based systems, use **[Pacman Command][4]** to install git. + +``` +$ sudo pacman -S git +``` + +For **`RHEL/CentOS`** systems, use **[YUM Command][5]** to install git. + +``` +$ sudo yum install git +``` + +For **`openSUSE Leap`** system, use **[Zypper Command][6]** to install git. + +``` +$ sudo zypper install git +``` + +We can easily install it by cloning the developer github repository. + +First clone the Bash-insulter repository. + +``` +$ git clone https://github.com/hkbakke/bash-insulter.git bash-insulter +``` + +Move the downloaded file under `/etc` folder. + +``` +$ sudo cp bash-insulter/src/bash.command-not-found /etc/ +``` + +Append the following lines into `/etc/bash.bashrc` file. + +``` +$ vi /etc/bash.bashrc + +#Bash Insulter +if [ -f /etc/bash.command-not-found ]; then + . /etc/bash.command-not-found +fi +``` + +Run the following command to take the changes to effect. + +``` +$ sudo source /etc/bash.bashrc +``` + +Do you want to test this? if so, type some wrong command in terminal and see how it insult you. + +``` +$ unam -a + +$ pin 2daygeek.com +``` + +![][8] + +If you would like to append your own phrases then navigate to the following file and update it. + +You can add your phrases within `messages` section. + +``` +# vi /etc/bash.command-not-found + +print_message () { + + local messages + local message + + messages=( + "Boooo!" + "Don't you know anything?" + "RTFM!" + "Haha, n00b!" + "Wow! That was impressively wrong!" + "Pathetic" + "The worst one today!" + "n00b alert!" + "Your application for reduced salary has been sent!" + "lol" + "u suk" + "lol... plz" + "plz uninstall" + "And the Darwin Award goes to.... ${USER}!" + "ERROR_INCOMPETENT_USER" + "Incompetence is also a form of competence" + "Bad." + "Fake it till you make it!" + "What is this...? Amateur hour!?" + "Come on! You can do it!" + "Nice try." + "What if... you type an actual command the next time!" + "What if I told you... it is possible to type valid commands." + "Y u no speak computer???" + "This is not Windows" + "Perhaps you should leave the command line alone..." + "Please step away from the keyboard!" + "error code: 1D10T" + "ACHTUNG! ALLES TURISTEN UND NONTEKNISCHEN LOOKENPEEPERS! DAS KOMPUTERMASCHINE IST NICHT FÜR DER GEFINGERPOKEN UND MITTENGRABEN! ODERWISE IST EASY TO SCHNAPPEN DER SPRINGENWERK, BLOWENFUSEN UND POPPENCORKEN MIT SPITZENSPARKEN. IST NICHT FÜR GEWERKEN BEI DUMMKOPFEN. DER RUBBERNECKEN SIGHTSEEREN KEEPEN DAS COTTONPICKEN HÄNDER IN DAS POCKETS MUSS. ZO RELAXEN UND WATSCHEN DER BLINKENLICHTEN." + "Pro tip: type a valid command!" + "Go outside." + "This is not a search engine." + "(╯°□°)╯︵ ┻━┻" + "¯\_(ツ)_/¯" + "So, I'm just going to go ahead and run rm -rf / for you." + "Why are you so stupid?!" + "Perhaps computers is not for you..." + "Why are you doing this to me?!" + "Don't you have anything better to do?!" + "I am _seriously_ considering 'rm -rf /'-ing myself..." + "This is why you get to see your children only once a month." + "This is why nobody likes you." + "Are you even trying?!" + "Try using your brain the next time!" + "My keyboard is not a touch screen!" + "Commands, random gibberish, who cares!" + "Typing incorrect commands, eh?" + "Are you always this stupid or are you making a special effort today?!" + "Dropped on your head as a baby, eh?" + "Brains aren't everything. In your case they're nothing." + "I don't know what makes you so stupid, but it really works." + "You are not as bad as people say, you are much, much worse." + "Two wrongs don't make a right, take your parents as an example." + "You must have been born on a highway because that's where most accidents happen." + "If what you don't know can't hurt you, you're invulnerable." + "If ignorance is bliss, you must be the happiest person on earth." + "You're proof that god has a sense of humor." + "Keep trying, someday you'll do something intelligent!" + "If shit was music, you'd be an orchestra." + "How many times do I have to flush before you go away?" + ) +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/bash-insulter-insults-the-user-when-typing-wrong-command/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/ +[2]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[3]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[4]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ +[5]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ +[6]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ +[7]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[8]: https://www.2daygeek.com/wp-content/uploads/2019/02/bash-insulter-insults-the-user-when-typing-wrong-command-1.png From ef44c05d1d4310c3e9817c22bcb613375d80738d Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 27 Feb 2019 15:40:15 +0800 Subject: [PATCH 011/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190221=20Testin?= =?UTF-8?q?g=20Bash=20with=20BATS=20sources/tech/20190221=20Testing=20Bash?= =?UTF-8?q?=20with=20BATS.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20190221 Testing Bash with BATS.md | 265 ++++++++++++++++++ 1 file changed, 265 insertions(+) create mode 100644 sources/tech/20190221 Testing Bash with BATS.md diff --git a/sources/tech/20190221 Testing Bash with BATS.md b/sources/tech/20190221 Testing Bash with BATS.md new file mode 100644 index 0000000000..16c65b2670 --- /dev/null +++ b/sources/tech/20190221 Testing Bash with BATS.md @@ -0,0 +1,265 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Testing Bash with BATS) +[#]: via: (https://opensource.com/article/19/2/testing-bash-bats) +[#]: author: (Darin London https://opensource.com/users/dmlond) + +Testing Bash with BATS +====== +The Bash Automated Testing System puts Bash code through the same types of testing processes used by Java, Ruby, and Python developers. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/todo_checklist_team_metrics_report.png?itok=oB5uQbzf) + +Software developers writing applications in languages such as Java, Ruby, and Python have sophisticated libraries to help them maintain their software's integrity over time. They create tests that run applications through a series of executions in structured environments to ensure all of their software's aspects work as expected. + +These tests are even more powerful when they're automated in a continuous integration (CI) system, where every push to the source repository causes the tests to run, and developers are immediately notified when tests fail. This fast feedback increases developers' confidence in the functional integrity of their applications. + +The Bash Automated Testing System ([BATS][1]) enables developers writing Bash scripts and libraries to apply the same practices used by Java, Ruby, Python, and other developers to their Bash code. + +### Installing BATS + +The BATS GitHub page includes installation instructions. There are two BATS helper libraries that provide more powerful assertions or allow overrides to the Test Anything Protocol ([TAP][2]) output format used by BATS. These can be installed in a standard location and sourced by all scripts. It may be more convenient to include a complete version of BATS and its helper libraries in the Git repository for each set of scripts or libraries being tested. This can be accomplished using the **[git submodule][3]** system. + +The following commands will install BATS and its helper libraries into the **test** directory in a Git repository. + +``` +git submodule init +git submodule add https://github.com/sstephenson/bats test/libs/bats +git submodule add https://github.com/ztombol/bats-assert test/libs/bats-assert +git submodule add https://github.com/ztombol/bats-support test/libs/bats-support +git add . +git commit -m 'installed bats' +``` + +To clone a Git repository and install its submodules at the same time, use the +**\--recurse-submodules** flag to **git clone**. + +Each BATS test script must be executed by the **bats** executable. If you installed BATS into your source code repo's **test/libs** directory, you can invoke the test with: + +``` +./test/libs/bats/bin/bats +``` + +Alternatively, add the following to the beginning of each of your BATS test scripts: + +``` +#!/usr/bin/env ./test/libs/bats/bin/bats +load 'libs/bats-support/load' +load 'libs/bats-assert/load' +``` + +and **chmod +x **. This will a) make them executable with the BATS installed in **./test/libs/bats** and b) include these helper libraries. BATS test scripts are typically stored in the **test** directory and named for the script being tested, but with the **.bats** extension. For example, a BATS script that tests **bin/build** should be called **test/build.bats**. + +You can also run an entire set of BATS test files by passing a regular expression to BATS, e.g., **./test/lib/bats/bin/bats test/*.bats**. + +### Organizing libraries and scripts for BATS coverage + +Bash scripts and libraries must be organized in a way that efficiently exposes their inner workings to BATS. In general, library functions and shell scripts that run many commands when they are called or executed are not amenable to efficient BATS testing. + +For example, [build.sh][4] is a typical script that many people write. It is essentially a big pile of code. Some might even put this pile of code in a function in a library. But it's impossible to run a big pile of code in a BATS test and cover all possible types of failures it can encounter in separate test cases. The only way to test this pile of code with sufficient coverage is to break it into many small, reusable, and, most importantly, independently testable functions. + +It's straightforward to add more functions to a library. An added benefit is that some of these functions can become surprisingly useful in their own right. Once you have broken your library function into lots of smaller functions, you can **source** the library in your BATS test and run the functions as you would any other command to test them. + +Bash scripts must also be broken down into multiple functions, which the main part of the script should call when the script is executed. In addition, there is a very useful trick to make it much easier to test Bash scripts with BATS: Take all the code that is executed in the main part of the script and move it into a function, called something like **run_main**. Then, add the following to the end of the script: + +``` +if [[ "${BASH_SOURCE[0]}" == "${0}" ]] +then +  run_main +fi +``` + +This bit of extra code does something special. It makes the script behave differently when it is executed as a script than when it is brought into the environment with **source**. This trick enables the script to be tested the same way a library is tested, by sourcing it and testing the individual functions. For example, here is [build.sh refactored for better BATS testability][5]. + +### Writing and running tests + +As mentioned above, BATS is a TAP-compliant testing framework with a syntax and output that will be familiar to those who have used other TAP-compliant testing suites, such as JUnit, RSpec, or Jest. Its tests are organized into individual test scripts. Test scripts are organized into one or more descriptive **@test** blocks that describe the unit of the application being tested. Each **@test** block will run a series of commands that prepares the test environment, runs the command to be tested, and makes assertions about the exit and output of the tested command. Many assertion functions are imported with the **bats** , **bats-assert** , and **bats-support** libraries, which are loaded into the environment at the beginning of the BATS test script. Here is a typical BATS test block: + +``` +@test "requires CI_COMMIT_REF_SLUG environment variable" { +  unset CI_COMMIT_REF_SLUG +  assert_empty "${CI_COMMIT_REF_SLUG}" +  run some_command +  assert_failure +  assert_output --partial "CI_COMMIT_REF_SLUG" +} +``` + +If a BATS script includes **setup** and/or **teardown** functions, they are automatically executed by BATS before and after each test block runs. This makes it possible to create environment variables, test files, and do other things needed by one or all tests, then tear them down after each test runs. [**Build.bats**][6] is a full BATS test of our newly formatted **build.sh** script. (The **mock_docker** command in this test will be explained below, in the section on mocking/stubbing.) + +When the test script runs, BATS uses **exec** to run each **@test** block as a separate subprocess. This makes it possible to export environment variables and even functions in one **@test** without affecting other **@test** s or polluting your current shell session. The output of a test run is a standard format that can be understood by humans and parsed or manipulated programmatically by TAP consumers. Here is an example of the output for the **CI_COMMIT_REF_SLUG** test block when it fails: + +``` + ✗ requires CI_COMMIT_REF_SLUG environment variable +   (from function `assert_output' in file test/libs/bats-assert/src/assert.bash, line 231, +    in test file test/ci_deploy.bats, line 26) +     `assert_output --partial "CI_COMMIT_REF_SLUG"' failed + +   -- output does not contain substring -- +   substring (1 lines): +     CI_COMMIT_REF_SLUG +   output (3 lines): +     ./bin/deploy.sh: join_string_by: command not found +     oc error +     Could not login +   -- + +   ** Did not delete , as test failed ** + +1 test, 1 failure +``` + +Here is the output of a successful test: + +``` +✓ requires CI_COMMIT_REF_SLUG environment variable +``` + +### Helpers + +Like any shell script or library, BATS test scripts can include helper libraries to share common code across tests or enhance their capabilities. These helper libraries, such as **bats-assert** and **bats-support** , can even be tested with BATS. + +Libraries can be placed in the same test directory as the BATS scripts or in the **test/libs** directory if the number of files in the test directory gets unwieldy. BATS provides the **load** function that takes a path to a Bash file relative to the script being tested (e.g., **test** , in our case) and sources that file. Files must end with the prefix **.bash** , but the path to the file passed to the **load** function can't include the prefix. **build.bats** loads the **bats-assert** and **bats-support** libraries, a small **[helpers.bash][7]** library, and a **docker_mock.bash** library (described below) with the following code placed at the beginning of the test script below the interpreter magic line: + +``` +load 'libs/bats-support/load' +load 'libs/bats-assert/load' +load 'helpers' +load 'docker_mock' +``` + +### Stubbing test input and mocking external calls + +The majority of Bash scripts and libraries execute functions and/or executables when they run. Often they are programmed to behave in specific ways based on the exit status or output ( **stdout** , **stderr** ) of these functions or executables. To properly test these scripts, it is often necessary to make fake versions of these commands that are designed to behave in a specific way during a specific test, a process called "stubbing." It may also be necessary to spy on the program being tested to ensure it calls a specific command, or it calls a specific command with specific arguments, a process called "mocking." For more on this, check out this great [discussion of mocking and stubbing][8] in Ruby RSpec, which applies to any testing system. + +The Bash shell provides tricks that can be used in your BATS test scripts to do mocking and stubbing. All require the use of the Bash **export** command with the **-f** flag to export a function that overrides the original function or executable. This must be done before the tested program is executed. Here is a simple example that overrides the **cat** executable: + +``` +function cat() { echo "THIS WOULD CAT ${*}" } +export -f cat +``` + +This method overrides a function in the same manner. If a test needs to override a function within the script or library being tested, it is important to source the tested script or library before the function is stubbed or mocked. Otherwise, the stub/mock will be replaced with the actual function when the script is sourced. Also, make sure to stub/mock before you run the command you're testing. Here is an example from **build.bats** that mocks the **raise** function described in **build.sh** to ensure a specific error message is raised by the login fuction: + +``` +@test ".login raises on oc error" { +  source ${profile_script} +  function raise() { echo "${1} raised"; } +  export -f raise +  run login +  assert_failure +  assert_output -p "Could not login raised" +} +``` + +Normally, it is not necessary to unset a stub/mock function after the test, since **export** only affects the current subprocess during the **exec** of the current **@test** block. However, it is possible to mock/stub commands (e.g. **cat** , **sed** , etc.) that the BATS **assert** * functions use internally. These mock/stub functions must be **unset** before these assert commands are run, or they will not work properly. Here is an example from **build.bats** that mocks **sed** , runs the **build_deployable** function, and unsets **sed** before running any assertions: + +``` +@test ".build_deployable prints information, runs docker build on a modified Dockerfile.production and publish_image when its not a dry_run" { +  local expected_dockerfile='Dockerfile.production' +  local application='application' +  local environment='environment' +  local expected_original_base_image="${application}" +  local expected_candidate_image="${application}-candidate:${environment}" +  local expected_deployable_image="${application}:${environment}" +  source ${profile_script} +  mock_docker build --build-arg OAUTH_CLIENT_ID --build-arg OAUTH_REDIRECT --build-arg DDS_API_BASE_URL -t "${expected_deployable_image}" - +  function publish_image() { echo "publish_image ${*}"; } +  export -f publish_image +  function sed() { +    echo "sed ${*}" >&2; +    echo "FROM application-candidate:environment"; +  } +  export -f sed +  run build_deployable "${application}" "${environment}" +  assert_success +  unset sed +  assert_output --regexp "sed.*${expected_dockerfile}" +  assert_output -p "Building ${expected_original_base_image} deployable ${expected_deployable_image} FROM ${expected_candidate_image}" +  assert_output -p "FROM ${expected_candidate_image} piped" +  assert_output -p "build --build-arg OAUTH_CLIENT_ID --build-arg OAUTH_REDIRECT --build-arg DDS_API_BASE_URL -t ${expected_deployable_image} -" +  assert_output -p "publish_image ${expected_deployable_image}" +} +``` + +Sometimes the same command, e.g. foo, will be invoked multiple times, with different arguments, in the same function being tested. These situations require the creation of a set of functions: + + * mock_foo: takes expected arguments as input, and persists these to a TMP file + * foo: the mocked version of the command, which processes each call with the persisted list of expected arguments. This must be exported with export -f. + * cleanup_foo: removes the TMP file, for use in teardown functions. This can test to ensure that a @test block was successful before removing. + + + +Since this functionality is often reused in different tests, it makes sense to create a helper library that can be loaded like other libraries. + +A good example is **[docker_mock.bash][9]**. It is loaded into **build.bats** and used in any test block that tests a function that calls the Docker executable. A typical test block using **docker_mock** looks like: + +``` +@test ".publish_image fails if docker push fails" { +  setup_publish +  local expected_image="image" +  local expected_publishable_image="${CI_REGISTRY_IMAGE}/${expected_image}" +  source ${profile_script} +  mock_docker tag "${expected_image}" "${expected_publishable_image}" +  mock_docker push "${expected_publishable_image}" and_fail +  run publish_image "${expected_image}" +  assert_failure +  assert_output -p "tagging ${expected_image} as ${expected_publishable_image}" +  assert_output -p "tag ${expected_image} ${expected_publishable_image}" +  assert_output -p "pushing image to gitlab registry" +  assert_output -p "push ${expected_publishable_image}" +} +``` + +This test sets up an expectation that Docker will be called twice with different arguments. With the second call to Docker failing, it runs the tested command, then tests the exit status and expected calls to Docker. + +One aspect of BATS introduced by **mock_docker.bash** is the **${BATS_TMPDIR}** environment variable, which BATS sets at the beginning to allow tests and helpers to create and destroy TMP files in a standard location. The **mock_docker.bash** library will not delete its persisted mocks file if a test fails, but it will print where it is located so it can be viewed and deleted. You may need to periodically clean old mock files out of this directory. + +One note of caution regarding mocking/stubbing: The **build.bats** test consciously violates a dictum of testing that states: [Don't mock what you don't own!][10] This dictum demands that calls to commands that the test's developer didn't write, like **docker** , **cat** , **sed** , etc., should be wrapped in their own libraries, which should be mocked in tests of scripts that use them. The wrapper libraries should then be tested without mocking the external commands. + +This is good advice and ignoring it comes with a cost. If the Docker CLI API changes, the test scripts will not detect this change, resulting in a false positive that won't manifest until the tested **build.sh** script runs in a production setting with the new version of Docker. Test developers must decide how stringently they want to adhere to this standard, but they should understand the tradeoffs involved with their decision. + +### Conclusion + +Introducing a testing regime to any software development project creates a tradeoff between a) the increase in time and organization required to develop and maintain code and tests and b) the increased confidence developers have in the integrity of the application over its lifetime. Testing regimes may not be appropriate for all scripts and libraries. + +In general, scripts and libraries that meet one or more of the following should be tested with BATS: + + * They are worthy of being stored in source control + * They are used in critical processes and relied upon to run consistently for a long period of time + * They need to be modified periodically to add/remove/modify their function + * They are used by others + + + +Once the decision is made to apply a testing discipline to one or more Bash scripts or libraries, BATS provides the comprehensive testing features that are available in other software development environments. + +Acknowledgment: I am indebted to [Darrin Mann][11] for introducing me to BATS testing. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/testing-bash-bats + +作者:[Darin London][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dmlond +[b]: https://github.com/lujun9972 +[1]: https://github.com/sstephenson/bats +[2]: http://testanything.org/ +[3]: https://git-scm.com/book/en/v2/Git-Tools-Submodules +[4]: https://github.com/dmlond/how_to_bats/blob/preBats/build.sh +[5]: https://github.com/dmlond/how_to_bats/blob/master/bin/build.sh +[6]: https://github.com/dmlond/how_to_bats/blob/master/test/build.bats +[7]: https://github.com/dmlond/how_to_bats/blob/master/test/helpers.bash +[8]: https://www.codewithjason.com/rspec-mocks-stubs-plain-english/ +[9]: https://github.com/dmlond/how_to_bats/blob/master/test/docker_mock.bash +[10]: https://github.com/testdouble/contributing-tests/wiki/Don't-mock-what-you-don't-own +[11]: https://github.com/dmann From 23994a367392a64a00b257dcfd9eb3fc3bab761a Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 27 Feb 2019 15:45:16 +0800 Subject: [PATCH 012/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190219=204=20se?= =?UTF-8?q?crets=20management=20tools=20for=20Git=20encryption=20sources/t?= =?UTF-8?q?ech/20190219=204=20secrets=20management=20tools=20for=20Git=20e?= =?UTF-8?q?ncryption.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ets management tools for Git encryption.md | 161 ++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 sources/tech/20190219 4 secrets management tools for Git encryption.md diff --git a/sources/tech/20190219 4 secrets management tools for Git encryption.md b/sources/tech/20190219 4 secrets management tools for Git encryption.md new file mode 100644 index 0000000000..303bc0ef87 --- /dev/null +++ b/sources/tech/20190219 4 secrets management tools for Git encryption.md @@ -0,0 +1,161 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 secrets management tools for Git encryption) +[#]: via: (https://opensource.com/article/19/2/secrets-management-tools-git) +[#]: author: (Austin Dewey https://opensource.com/users/adewey) + +4 secrets management tools for Git encryption +====== +See how Git-crypt, BlackBox, SOPS, and Transcrypt stack up for storing secrets in Git. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003601_05_mech_osyearbook2016_security_cc.png?itok=3V07Lpko) + +There are a lot of great open source tools out there for storing secrets in Git. It can be hard to determine the right one for you and your organization—it depends on your use cases and requirements. To help you compare and choose, we'll look at four of the most popular open source tools for secrets management and see how they stack up against each other: + ++ [Git-crypt](https://github.com/AGWA/git-crypt) ++ [BlackBox](https://github.com/StackExchange/blackbox) ++ [SOPS](https://github.com/mozilla/sops) ++ [Transcrypt](https://github.com/elasticdog/transcrypt) + + +We won't review larger solutions like HashiCorp Vault. A production-ready Vault can be a rather large hurdle, especially if your organization is just getting started with secrets management. The tools above are easy to use and set up quickly. + +### Encryption types + +These secrets management tools use GNU Privacy Guard ([GPG][1]), symmetric key encryption, and/or cloud key services. + + * GPG-based tools require users to create a GPG keypair. The public key is used to encrypt and is shared with other users, while the private key is used to decrypt and is known by only one user. + * Symmetric key tools are password-based and work when given the correct password. + * Cloud key services—Amazon Key Management Service (KMS), Google Cloud KMS, and Azure Key Vault-based tools—allow integration with services from cloud providers. + + + +The encryption types these secrets management tools use are: +| | GPG | Symmetric key | Amazon KMS | Google KMS | Azure Key Vault | +| Git-crypt | X | X | | | | +| BlackBox | X | | | | | +| SOPS | X | | X | X | X | +| Transcrypt | | X | | | | + +As you can see, Git-crypt and SOPS use more than one encryption basis. This means Git-crypt can achieve encryption by using GPG OR a symmetric key, and SOPS can use GPG OR one of the cloud services. + +### Goals + +These tools have similar goals: + +| | Transparency with Git | Whole-file encryption | Partial-file encryption | +| Git-crypt | X | X | | +| BlackBox | X | X | | +| SOPS | | X | X | +| Transcrypt | X | X | | + +All but SOPS are transparent with Git, which means they have built-in mechanisms to ensure that files in source control are encrypted without much effort from users. They help prevent a **git push** from accidentally pushing plaintext secrets to Git. + +At this point, you might be wondering, "Why is SOPS here if it doesn't encrypt transparently with Git? Isn't this a post about Git encryption tools?" The reason is because of how it handles key-value-based files, such as YAML and JSON. When encrypting these types of files, SOPS will leave the keys unencrypted but will encrypt the values. There are often cases, especially in configuration management, where these types of files need to be encrypted in Git, but it would also be convenient to see what kind of information they contain. While SOPS does not provide native Git transparency, tools like [git-secrets][2] can be used alongside SOPS to help ensure plaintext secrets are not pushed to Git. + +Finally, all of these tools support whole-file encryption, in which secrets files are encrypted in their entirety. + +### Workflows and differences + +None of these tools are particularly difficult to use, but they all have quirks and operational challenges to consider. + +#### GPG + +The basic workflow for a GPG-based tool is: + + 1. Initialize the repository with the encryption tool + 2. Create GPG keys for users that are allowed to manage secret files + 3. Add the corresponding public keys to the tool + 4. Designate the files that should be treated as "secret" + 5. Encrypt the files using the tool + 6. Repeat steps 2, 3, and 5 for each new user that is granted permission + 7. To revoke a user, remove the user and repeat step 5 + + + +In theory, this workflow is simple. One operational issue is GPG key maintenance. Your team will need to back up its GPG keys to prevent a lock-out scenario if GPG keys are accidentally deleted. If you are using the tool for automation, you will also need to consider who will be responsible for creating and maintaining keys for that service. Additionally, if you need to add, remove, or rotate a key, you'll need to re-encrypt each file for the changes to take effect. + +Advantages and disadvantages of the GPG-based tools include: + + * Git-crypt cannot remove GPG users natively, which means step 7 above is not easy to do. There are workarounds available, but it's not a built-in feature. + * Git-crypt will transparently perform step 5 above on a **git push** —even when new users are added. + * BlackBox provides a **blackbox_update_all_files** command, which can perform step 5 by re-encrypting all secret files in one command. This comes in handy in key rotation and adding/removing GPG keys, where all files need to be re-encrypted. + * SOPS makes key rotation and adding/removing GPG keys the most difficult, as it requires each file to be manually re-encrypted. + * BlackBox has a **blackbox_list_admins** command that returns the email address that corresponds with registered users' GPG keys. This makes it easier to discern who has access to the secrets versus trying to map plain GPG fingerprints. + + + +#### Cloud key services + +Here is a sample workflow using SOPS with Amazon KMS: + + 1. Create identity and access management (IAM) entities + 2. Create KMS master key + 3. Grant IAM entities access to the master key + 4. Add the master key to each secret file with SOPS and encrypt the file (adding keys and encrypting is usually a one-step process with SOPS) + 5. Re-encrypt when adding or removing master keys + + + +Of these four tools, SOPS is the only one that allows users to configure encryption with a cloud-based key service. Cloud key services ease much of the operational burden that GPG-based solutions carry. Take Amazon KMS, for example: The master key is added to SOPS and access to secret files is controlled through IAM policies. Adding and removing users is as simple as granting or revoking permission with IAM, meaning secret files do not need to be re-encrypted when changing permissions, since nothing changed from SOPS's perspective. This solution does have its own set of operational challenges, however. Each member of the team must have an AWS account before they can access secret files. Also, admins must configure and maintain the IAM policies and KMS master key(s). + +#### Symmetric key encryption + +The workflow for symmetric key-based tools is probably the simplest: + + 1. Initialize the repository with the encryption tool + 2. Designate files that should be treated as "secret" + 3. **git push** to transparently encrypt the files + 4. Share the symmetric key with other users who need access + 5. Rotate the key each time a user is revoked access + + + +Git-crypt and Transcrypt both provide a complex password as the symmetric key. The operational challenges are to find a secure way to share the symmetric key and to be sure to rotate the key each time a user is removed. + +Here are a few differences between Git-crypt and Transcrypt, our symmetric key-compatible tools: + + * Git-crypt is compatible with both GPG and symmetric key encryption + * Git-crypt doesn't support symmetric key rotation, so you can't complete step 5 if you use it with a symmetric key + * Transcrypt provides a convenient **\--rekey** command for key rotation + + + +### Other features + +Other features and characteristics of the tools include: + +| | Editor-in-place | Auditing | Repo-level permission | File-level permission | +| Git-crypt | | | X | | +| BlackBox | X | | X | | +| SOPS | X | X | | X | +| Transcrypt | | | X | | + +Both BlackBox and SOPS feature an "editor-in-place" tool, which decrypts the file and opens a text editor specified by the **$EDITOR** environment variable. This enables the user to make in-place edits to the file before it is saved and re-encrypted, so users can modify secret files without requiring them to be "decrypted in place" first. + +SOPS is the only tool that provides an auditing feature. This feature tracks and monitors SOPS usage by forwarding events to a database. It requires a certain amount of setup, so check out SOPS's [README][3] for more information. + +Git-crypt, BlackBox, and Transcrypt handle access at the repo level, meaning that if you can view one decrypted file, you can view them all. Depending on your use case, this is either a feature or a misfeature. SOPS handles permissions at the file level, meaning just because users can view one file, they can't necessarily view other files in the repo. + +### For more information + +Hopefully, this high-level overview of four open source secrets management tools will help you make an educated decision about the right tool for you. For more information on the tools, please check out their GitHub pages (linked at the top of this article). + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/secrets-management-tools-git + +作者:[Austin Dewey][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/adewey +[b]: https://github.com/lujun9972 +[1]: https://www.gnupg.org/ +[2]: https://github.com/awslabs/git-secrets +[3]: https://github.com/mozilla/sops/blob/master/README.rst#auditing From f6d19bbff127bd1591ea3c47682b738fa8aa1f7a Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 27 Feb 2019 15:56:57 +0800 Subject: [PATCH 013/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190220=20Do=20L?= =?UTF-8?q?inux=20distributions=20still=20matter=20with=20containers=3F=20?= =?UTF-8?q?sources/talk/20190220=20Do=20Linux=20distributions=20still=20ma?= =?UTF-8?q?tter=20with=20containers.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...tributions still matter with containers.md | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 sources/talk/20190220 Do Linux distributions still matter with containers.md diff --git a/sources/talk/20190220 Do Linux distributions still matter with containers.md b/sources/talk/20190220 Do Linux distributions still matter with containers.md new file mode 100644 index 0000000000..c1c7886d0d --- /dev/null +++ b/sources/talk/20190220 Do Linux distributions still matter with containers.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Do Linux distributions still matter with containers?) +[#]: via: (https://opensource.com/article/19/2/linux-distributions-still-matter-containers) +[#]: author: (Scott McCarty https://opensource.com/users/fatherlinux) + +Do Linux distributions still matter with containers? +====== +There are two major trends in container builds: using a base image and building from scratch. Each has engineering tradeoffs. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cube_innovation_process_block_container.png?itok=vkPYmSRQ) + +Some people say Linux distributions no longer matter with containers. Alternative approaches, like distroless and scratch containers, seem to be all the rage. It appears we are considering and making technology decisions based more on fashion sense and immediate emotional gratification than thinking through the secondary effects of our choices. We should be asking questions like: How will these choices affect maintenance six months down the road? What are the engineering tradeoffs? How does this paradigm shift affect our build systems at scale? + +It's frustrating to watch. If we forget that engineering is a zero-sum game with measurable tradeoffs—advantages and disadvantages, with costs and benefits of different approaches— we do ourselves a disservice, we do our employers a disservice, and we do our colleagues who will eventually maintain our code a disservice. Finally, we do all of the maintainers ([hail the maintainers!][1]) a disservice by not appreciating the work they do. + +### Understanding the problem + +To understand the problem, we have to investigate why we started using Linux distributions in the first place. I would group the reasons into two major buckets: kernels and other packages. Compiling kernels is actually fairly easy. Slackware and Gentoo (I still have a soft spot in my heart) taught us that. + +On the other hand, the tremendous amount of development and runtime software that needs to be packaged for a usable Linux system can be daunting. Furthermore, the only way you can ensure that millions of permutations of packages can be installed and work together is by using the old paradigm: compile it and ship it together as a thing (i.e., a Linux distribution). So, why do Linux distributions compile kernels and all the packages together? Simple: to make sure things work together. + +First, let's talk about kernels. The kernel is special. Booting a Linux system without a compiled kernel is a bit of a challenge. It's the core of a Linux operating system, and it's the first thing we rely on when a system boots. Kernels have a lot of different configuration options when they're being compiled that can have a tremendous effect on how hardware and software run on one. A secondary problem in this bucket is that system software, like compilers, C libraries, and interpreters, must be tuned for the options you built into the kernel. Gentoo taught us this in a visceral way, which turned everyone into a miniature distribution maintainer. + +Embarrassingly (because I have worked with containers for the last five years), I must admit that I have compiled kernels quite recently. I had to get nested KVM working on RHEL 7 so that I could run [OpenShift on OpenStack][2] virtual machines, in a KVM virtual machine on my laptop, as well as [our Container Development Kit (CDK][3]). #justsayin Suffice to say, I fired RHEL7 up on a brand new 4.X kernel at the time. Like any good sysadmin, I was a little worried that I missed some important configuration options and patches. And, of course, I had missed some things. Sleep mode stopped working right, my docking station stopped working right, and there were numerous other small, random errors. But it did work well enough for a live demo of OpenShift on OpenStack, in a single KVM virtual machine on my laptop. Come on, that's kinda' fun, right? But I digress… + +Now, let's talk about all the other packages. While the kernel and associated system software can be tricky to compile, the much, much bigger problem from a workload perspective is compiling thousands and thousands of packages to give us a useable Linux system. Each package requires subject matter expertise. Some pieces of software require running only three commands: **./configure** , **make** , and **make install**. Others require a lot of subject matter expertise ranging from adding users and configuring specific defaults in **etc** to running post-install scripts and adding systemd unit files. The set of skills necessary for the thousands of different pieces of software you might use is daunting for any single person. But, if you want a usable system with the ability to try new software whenever you want, you have to learn how to compile and install the new software before you can even begin to learn to use it. That's Linux without a Linux distribution. That's the engineering problem you are agreeing to when you forgo a Linux distribution. + +The point is that you have to build everything together to ensure it works together with any sane level of reliability, and it takes a ton of knowledge to build a usable cohort of packages. This is more knowledge than any single developer or sysadmin is ever going to reasonably learn and retain. Every problem I described applies to your [container host][4] (kernel and system software) and [container image][5] (system software and all other packages)—notice the overlap; there are compilers, C libraries, interpreters, and JVMs in the container image, too. + +### The solution + +You already know this, but Linux distributions are the solution. Stop reading and send your nearest package maintainer (again, hail the maintainers!) an e-card (wait, did I just give my age away?). Seriously though, these people do a ton of work, and it's really underappreciated. Kubernetes, Istio, Prometheus, and Knative: I am looking at you. Your time is coming too, when you will be in maintenance mode, overused, and underappreciated. I will be writing this same article again, probably about Kubernetes, in about seven to 10 years. + +### First principles with container builds + +There are tradeoffs to building from scratch and building from base images. + +#### Building from base images + +Building from base images has the advantage that most build operations are nothing more than a package install or update. It relies on a ton of work done by package maintainers in a Linux distribution. It also has the advantage that a patching event six months—or even 10 years—from now (with RHEL) is an operations/systems administrator event (yum update), not a developer event (that requires picking through code to figure out why some function argument no longer works). + +Let's double-click on that a bit. Application code relies on a lot of libraries ranging from JSON munging libraries to object-relational mappers. Unlike the Linux kernel and Glibc, these types of libraries change with very little regard to breaking API compatibility. That means that three years from now your patching event likely becomes a code-changing event, not a yum update event. Got it, let that sink in. Developers, you are getting paged at 2 AM if the security team can't find a firewall hack to block the exploit. + +Building from a base image is not perfect; there are disadvantages, like the size of all the dependencies that get dragged in. This will almost always make your container images larger than building from scratch. Another disadvantage is you will not always have access to the latest upstream code. This can be frustrating for developers, especially when you just want to get something out the door, but not as frustrating as being paged to look at a library you haven't thought about in three years that the upstream maintainers have been changing the whole time. + +If you are a web developer and rolling your eyes at me, I have one word for you: DevOps. That means you are carrying a pager, my friend. + +#### Building from scratch + +Scratch builds have the advantage of being really small. When you don't rely on a Linux distribution in the container, you have a lot of control, which means you can customize everything for your needs. This is a best-of-breed model, and it's valid in certain use cases. Another advantage is you have access to the latest packages. You don't have to wait for a Linux distro to update anything. You are in control, so you choose when to spend the engineering work to incorporate new software. + +Remember, there is a cost to controlling everything. Often, updating to new libraries with new features drags in unwanted API changes, which means fixing incompatibilities in code (in other words, [shaving yaks][6]). Shaving yaks at 2 AM when the application doesn't work is not fun. Luckily, with containers, you can roll back and shave the yaks the next business day, but it will still eat into your time for delivering new value to the business, new features to your applications. Welcome to the life of a sysadmin. + +OK, that said, there are times that building from scratch makes sense. I will completely concede that statically compiled Golang programs and C programs are two decent candidates for scratch/distroless builds. With these types of programs, every container build is a compile event. You still have to worry about API breakage three years from now, but if you are a Golang shop, you should have the skillset to fix things over time. + +### Conclusion + +Basically, Linux distributions do a ton of work to save you time—on a regular Linux system or with containers. The knowledge that maintainers have is tremendous and leveraged so much without really being appreciated. The adoption of containers has made the problem even worse because it's even further abstracted. + +With container hosts, a Linux distribution offers you access to a wide hardware ecosystem, ranging from tiny ARM systems, to giant 128 CPU x86 boxes, to cloud-provider VMs. They offer working container engines and container runtimes out of the box, so you can just fire up your containers and let somebody else worry about making things work. + +For container images, Linux distributions offer you easy access to a ton of software for your projects. Even when you build from scratch, you will likely look at how a package maintainer built and shipped things—a good artist is a good thief—so, don't undervalue this work. + +So, thank you to all of the maintainers in Fedora, RHEL (Frantisek, you are my hero), Debian, Gentoo, and every other Linux distribution. I appreciate the work you do, even though I am a "container guy." + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/linux-distributions-still-matter-containers + +作者:[Scott McCarty][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/fatherlinux +[b]: https://github.com/lujun9972 +[1]: https://aeon.co/essays/innovation-is-overvalued-maintenance-often-matters-more +[2]: https://blog.openshift.com/openshift-on-openstack-delivering-applications-better-together/ +[3]: https://developers.redhat.com/blog/2018/02/13/red-hat-cdk-nested-kvm/ +[4]: https://developers.redhat.com/blog/2018/02/22/container-terminology-practical-introduction/#h.8tyd9p17othl +[5]: https://developers.redhat.com/blog/2018/02/22/container-terminology-practical-introduction/#h.dqlu6589ootw +[6]: https://en.wiktionary.org/wiki/yak_shaving From 4a02c9679f17b4af807dffe54b31c201f3be16f6 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 27 Feb 2019 15:59:33 +0800 Subject: [PATCH 014/796] =?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 015/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190220=20Infras?= =?UTF-8?q?tructure=20monitoring:=20Defense=20against=20surprise=20downtim?= =?UTF-8?q?e=20sources/tech/20190220=20Infrastructure=20monitoring-=20Defe?= =?UTF-8?q?nse=20against=20surprise=20downtime.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ring- Defense against surprise downtime.md | 126 ++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 sources/tech/20190220 Infrastructure monitoring- Defense against surprise downtime.md diff --git a/sources/tech/20190220 Infrastructure monitoring- Defense against surprise downtime.md b/sources/tech/20190220 Infrastructure monitoring- Defense against surprise downtime.md new file mode 100644 index 0000000000..d71c3c521b --- /dev/null +++ b/sources/tech/20190220 Infrastructure monitoring- Defense against surprise downtime.md @@ -0,0 +1,126 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Infrastructure monitoring: Defense against surprise downtime) +[#]: via: (https://opensource.com/article/19/2/infrastructure-monitoring) +[#]: author: (Abhishek Tamrakar https://opensource.com/users/tamrakar) + +Infrastructure monitoring: Defense against surprise downtime +====== +A strong monitoring and alert system based on open source tools prevents problems before they affect your infrastructure. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/analytics-graphs-charts.png?itok=sersoqbV) + +Infrastructure monitoring is an integral part of infrastructure management. It is an IT manager's first line of defense against surprise downtime. Severe issues can inject considerable downtime to live infrastructure, sometimes causing heavy loss of money and material. + +Monitoring collects time-series data from your infrastructure so it can be analyzed to predict upcoming issues with the infrastructure and its underlying components. This gives the IT manager or support staff time to prepare and apply a resolution before a problem occurs. + +A good monitoring system provides: + + 1. Measurement of the infrastructure's performance over time + 2. Node-level analysis and alerts + 3. Network-level analysis and alerts + 4. Downtime analysis and alerts + 5. Answers to the 5 W's of incident management and root cause analysis (RCA): + * What was the actual issue? + * When did it happen? + * Why did it happen? + * What was the downtime? + * What needs to be done to avoid it in the future? + + + +### Building a strong monitoring system + +There are a number of tools available that can build a viable and strong monitoring system. The only decision to make is which to use; your answer lies in what you want to achieve with monitoring as well as various financial and business factors you must consider. + +While some monitoring tools are proprietary, many open source tools, either unmanaged or community-managed software, will do the job even better than the closed source options. + +In this article, I will focus on open source tools and how to use them to create a strong monitoring architecture. + +### Log collection and analysis + +To say "logs are helpful" would be an understatement. Logs not only help in debugging issues; they also provide a lot of information to help you predict an upcoming issue. Logs are the first door to open when you encounter issues with software components. + +Both [Fluentd][1] and [Logstash][2] can be used for log collection; the only reason I would choose Fluentd over Logstash is because of its independence from the Java process; it is written in C+ Ruby, which is widely supported by container runtimes like Docker and orchestration tools like Kubernetes. + +Log analytics is the process of analyzing the log data you collect over time and producing real-time logging metrics. [Elasticsearch][3] is a powerful tool that can do just that. + +Finally, you need a tool that can collect logging metrics and enable you to visualize the log trends using charts and graphs that are easy to understand. [Kibana][4] is my favorite option for that purpose. + +![Logging workflow][6] + +Logging workflow + +Because logs can hold sensitive information, here are a few security pointers to remember: + + * Always transport logs over a secure connection. + * The logging/monitoring infrastructure should be implemented inside the restricted subnet. + * Access to monitoring user interfaces (e.g., Kibana and [Grafana][7]) should be restricted or authenticated only to stakeholders. + + + +### Node-level metrics + +Not everything is logged! + +Yes, you heard that right: Logging monitors a software or a process, not every component in the infrastructure. + +Operating system disks, externally mounted data disks, Elastic Block Store, CPU, I/O, network packets, inbound and outbound connections, physical memory, virtual memory, buffer space, and queues are some of the major components that rarely appear in logs unless something fails for them. + +So, how could you collect this data? + +[Prometheus][8] is one answer. You just need to install software-specific exporters on the virtual machine nodes and configure Prometheus to collect time-based data from those unattended components. Grafana uses the data Prometheus collects to provide a live visual representation of your node's current status. + +If you are looking for a simpler solution to collect time-series metrics, consider [Metricbeat][9], [Elastic.io][10]'s in-house open source tool, which can be used with Kibana to replace Prometheus and Grafana. + +### Alerts and notifications + +You can't take advantage of monitoring without alerts and notifications. Unless stakeholders—no matter where they are in this big, big world—receive a notification about an issue, there's no way they can analyze and fix the issue, prevent the customer from being impacted, and avoid it in the future. + +Prometheus, with predefined alerting rules using its in-house [Alertmanager][11] and Grafana, can send alerts based on configured rules. [Sensu][12] and [Nagios][13] are other open source tools that offer alerting and monitoring services. + +The only problem people have with open source alerting tools is that the configuration time and the process sometimes seem hard, but once they are set up, these tools function better than proprietary alternatives. + +However, open source tools' biggest advantage is that we have control over their behavior. + +### Monitoring workflow and architecture + +A good monitoring architecture is the backbone of a strong and stable monitoring system. It might look something like this diagram. + +![](https://opensource.com/sites/default/files/uploads/image_2_architecture.png) + +In the end, you must choose a tool based on your needs and infrastructure. The open source tools discussed in this article are used by many organizations for monitoring their infrastructure and blessing it with high uptime. + +This article was adapted from a post on [Medium.com][14]'s [Hacker Noon][15] and is republished here with the author's permission. + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/infrastructure-monitoring + +作者:[Abhishek Tamrakar][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/tamrakar +[b]: https://github.com/lujun9972 +[1]: https://www.fluentd.org/ +[2]: https://www.elastic.co/products/logstash +[3]: https://www.elastic.co/products/elasticsearch +[4]: https://www.elastic.co/products/kibana +[5]: /file/420766 +[6]: https://opensource.com/sites/default/files/uploads/infrastructure-monitoring_logging.jpeg (Logging workflow) +[7]: https://grafana.com/ +[8]: https://prometheus.io/ +[9]: https://www.elastic.co/products/beats/metricbeat +[10]: http://Elastic.io +[11]: https://prometheus.io/docs/alerting/alertmanager/ +[12]: https://sensu.io/ +[13]: https://www.nagios.org/ +[14]: http://Medium.com +[15]: https://medium.com/@abhishek.tamrakar/infrastructure-monitoring-defense-against-surprise-downtime-ed32416df0c5 From faa08b7a7076f641ae7a7ed8b165e7a3819722af Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 27 Feb 2019 16:13:42 +0800 Subject: [PATCH 016/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190220=20Set=20?= =?UTF-8?q?up=20two-factor=20authentication=20for=20SSH=20on=20Fedora=20so?= =?UTF-8?q?urces/tech/20190220=20Set=20up=20two-factor=20authentication=20?= =?UTF-8?q?for=20SSH=20on=20Fedora.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...factor authentication for SSH on Fedora.md | 170 ++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 sources/tech/20190220 Set up two-factor authentication for SSH on Fedora.md diff --git a/sources/tech/20190220 Set up two-factor authentication for SSH on Fedora.md b/sources/tech/20190220 Set up two-factor authentication for SSH on Fedora.md new file mode 100644 index 0000000000..7410262f3f --- /dev/null +++ b/sources/tech/20190220 Set up two-factor authentication for SSH on Fedora.md @@ -0,0 +1,170 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Set up two-factor authentication for SSH on Fedora) +[#]: via: (https://fedoramagazine.org/two-factor-authentication-ssh-fedora/) +[#]: author: (Curt Warfield https://fedoramagazine.org/author/rcurtiswarfield/) + +Set up two-factor authentication for SSH on Fedora +====== + +![](https://fedoramagazine.org/wp-content/uploads/2019/02/twofactor-auth-ssh-816x345.png) + +Every day there seems to be a security breach reported in the news where our data is at risk. Despite the fact that SSH is a secure way to connect remotely to a system, you can still make it even more secure. This article will show you how. + +That’s where two-factor authentication (2FA) comes in. Even if you disable passwords and only allow SSH connections using public and private keys, an unauthorized user could still gain access to your system if they steal your keys. + +With two-factor authentication, you can’t connect to a server with just your SSH keys. You also need to provide the randomly generated number displayed by an authenticator application on a mobile phone. + +The Time-based One-time Password algorithm (TOTP) is the method shown in this article. [Google Authenticator][1] is used as the server application. Google Authenticator is available by default in Fedora. + +For your mobile phone, you can use any two-way authentication application that is compatible with TOTP. There are numerous free applications for Android or IOS that work with TOTP and Google Authenticator. This article uses [FreeOTP][2] as an example. + +### Install and set up Google Authenticator + +First, install the Google Authenticator package on your server. + +``` +$ sudo dnf install -y google-authenticator +``` + +Run the application. + +``` +$ google-authenticator +``` + +The application presents you with a series of questions. The snippets below show you how to answer for a reasonably secure setup. + +``` +Do you want authentication tokens to be time-based (y/n) y +Do you want me to update your "/home/user/.google_authenticator" file (y/n)? y +``` + +The app provides you with a secret key, verification code, and recovery codes. Keep these in a secure, safe location. The recovery codes are the **only** way to access your server if you lose your mobile phone. + +### Set up mobile phone authentication + +Install the authenticator application (FreeOTP) on your mobile phone. You can find it in Google Play if you have an Android phone, or in the iTunes store for an Apple iPhone. + +A QR code is displayed on the screen. Open up the FreeOTP app on your mobile phone. To add a new account, select the QR code shaped tool at the top on the app, and then scan the QR code. After the setup is complete, you’ll have to provide the random number generated by the authenticator application every time you connect to your server remotely. + +### Finish configuration + +The application asks further questions. The example below shows you how to answer to set up a reasonably secure configuration. + +``` +Do you want to disallow multiple uses of the same authentication token? This restricts you to one login about every 30s, but it increases your chances to notice or even prevent man-in-the-middle attacks (y/n) y +By default, tokens are good for 30 seconds. In order to compensate for possible time-skew between the client and the server, we allow an extra token before and after the current time. If you experience problems with poor time synchronization, you can increase the window from its default size of +-1min (window size of 3) to about +-4min (window size of 17 acceptable tokens). +Do you want to do so? (y/n) n +If the computer that you are logging into isn't hardened against brute-force login attempts, you can enable rate-limiting for the authentication module. By default, this limits attackers to no more than 3 login attempts every 30s. +Do you want to enable rate-limiting (y/n) y +``` + +Now you have to set up SSH to take advantage of the new two-way authentication. + +### Configure SSH + +Before completing this step, **make sure you’ve already established a working SSH connection** using public SSH keys, since we’ll be disabling password connections. If there is a problem or mistake, having a connection will allow you to fix the problem. + +On your server, use [sudo][3] to edit the /etc/pam.d/sshd file. + +``` +$ sudo vi /etc/pam.d/ssh +``` + +Comment out the auth substack password-auth line: + +``` +#auth       substack     password-auth +``` + +Add the following line to the bottom of the file. + +``` +auth sufficient pam_google_authenticator.so +``` + +Save and close the file. Next, edit the /etc/ssh/sshd_config file. + +``` +$ sudo vi /etc/ssh/sshd_config +``` + +Look for the ChallengeResponseAuthentication line and change it to yes. + +``` +ChallengeResponseAuthentication yes +``` + +Look for the PasswordAuthentication line and change it to no. + +``` +PasswordAuthentication no +``` + +Add the following line to the bottom of the file. + +``` +AuthenticationMethods publickey,password publickey,keyboard-interactive +``` + +Save and close the file, and then restart SSH. + +``` +$ sudo systemctl restart sshd +``` + +### Testing your two-factor authentication + +When you attempt to connect to your server you’re now prompted for a verification code. + +``` +[user@client ~]$ ssh user@example.com +Verification code: +``` + +The verification code is randomly generated by your authenticator application on your mobile phone. Since this number changes every few seconds, you need to enter it before it changes. + +![][4] + +If you do not enter the verification code, you won’t be able to access the system, and you’ll get a permission denied error: + +``` +[user@client ~]$ ssh user@example.com + +Verification code: + +Verification code: + +Verification code: + +Permission denied (keyboard-interactive). + +[user@client ~]$ +``` + +### Conclusion + +By adding this simple two-way authentication, you’ve now made it much more difficult for an unauthorized user to gain access to your server. + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/two-factor-authentication-ssh-fedora/ + +作者:[Curt Warfield][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/rcurtiswarfield/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Google_Authenticator +[2]: https://freeotp.github.io/ +[3]: https://fedoramagazine.org/howto-use-sudo/ +[4]: https://fedoramagazine.org/wp-content/uploads/2019/02/freeotp-1.png From 1838d01ad6e57a988d8cf6cbdd5433752df7a5de Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 27 Feb 2019 16:17:23 +0800 Subject: [PATCH 017/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190220=20An=20A?= =?UTF-8?q?utomated=20Way=20To=20Install=20Essential=20Applications=20On?= =?UTF-8?q?=20Ubuntu=20sources/tech/20190220=20An=20Automated=20Way=20To?= =?UTF-8?q?=20Install=20Essential=20Applications=20On=20Ubuntu.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nstall Essential Applications On Ubuntu.md | 135 ++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 sources/tech/20190220 An Automated Way To Install Essential Applications On Ubuntu.md diff --git a/sources/tech/20190220 An Automated Way To Install Essential Applications On Ubuntu.md b/sources/tech/20190220 An Automated Way To Install Essential Applications On Ubuntu.md new file mode 100644 index 0000000000..5dd7abbaa2 --- /dev/null +++ b/sources/tech/20190220 An Automated Way To Install Essential Applications On Ubuntu.md @@ -0,0 +1,135 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (An Automated Way To Install Essential Applications On Ubuntu) +[#]: via: (https://www.ostechnix.com/an-automated-way-to-install-essential-applications-on-ubuntu/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +An Automated Way To Install Essential Applications On Ubuntu +====== +![](https://www.ostechnix.com/wp-content/uploads/2019/02/alfred-720x340.png) + +The default Ubuntu installation doesn’t come with all essential applications pre-installed . You may need to spend few hours on Internet or ask any Linux user’s help to find and install the necessary applications for your Ubuntu box. If you’re newbie, then you certainly need to spend more time to learn how to search and install applications either from command line (using apt-get or dpkg) or from the Ubuntu software center. Some users, especially newbies, might want to easily and quickly install every applications they like. If you’re one of them, no worries. In this guide, we will see how to install essential applications on Ubuntu using a simple command line utility called **“Alfred”**. + +Alfred is a free, open source script written in **Python** programming language. It uses **Zenity** to create a simple graphical interface that allows the users to easily select and install the applications of their choice with a few mouse clicks. You need not to spend hours to search for all essential applications, PPAs, debs, AppImage, snaps or flatpaks. Alfred brings all common applications, tools and utilities under one-roof and automatically installs the selected applications. If you’re a newbie who is recently migrated from Windows to Ubuntu Linux, Alfred helps you to do an unattended software installation on a freshly installed Ubuntu system, without much user intervention. Please be mindful that there is also a Mac OS app with similar name, but both serves different purposes. + +### Installing Alfred On Ubuntu + +Alfred installation is easy! Just download the script and launch it. It is that simple. + +``` +$ wget https://raw.githubusercontent.com/derkomai/alfred/master/alfred.py + +$ python3 alfred.py +``` + +Alternatively, download the script using wget as shown above and just move the **alfred.py** file to your $PATH: + +``` +$ sudo cp alfred.py /usr/local/bin/alfred +``` + +Make it executable: + +``` +$ sudo chmod +x /usr/local/bin/alfred +``` + +And, launch it using command: + +``` +$ alfred +``` + +### Easily And Quickly Install Essential Applications On Ubuntu Using Alfred Script + +Launch Alfred script as described in the installation section above. This is how Alfred default interface looks like. + +![][2] + +As you can see, Alfred lists a lot of most commonly used application types such as, + + * Web browsers, + * Mail clients, + * Messengers, + * Cloud storage clients, + * Hardware drivers, + * Codecs, + * Developer tools, + * Android, + * Text editors, + * Git, + * Kernel update tool, + * Audio/video players, + * Screenshot tools, + * Screen recorders, + * Video encoders, + * Streaming apps, + * 3D modelling and animation tools, + * Image viewers and editors, + * CAD software, + * Pdf tools, + * Gaming emulators, + * Disk management tools, + * Encryption tools, + * Password managers, + * Archive tools, + * Ftp software, + * System resource monitors, + * Application launchers and many. + + + +You can pick any one or multiple applications of your choice and install them at once. Here, I am going to install the ‘Developer bundle’, hence I chose it and click OK button. + +![][3] + +Now, Alfred script will automatically add the necessary repositories, ppas on your Ubuntu system and start installing the selected applications. + +![][4] + +Once the installation is completed, you will see the following message. + +![][5] + +Congratulations! The selected packages have been installed. + +You can [**check recently installed applications**][6] on Ubuntu using the following command: + +``` +$ grep " install " /var/log/dpkg.log +``` + +You may need to reboot your system in-order to use some of the installed applications. Similarly, you can install any applications from the list without much hazzle. + +For your information, there is also a similar script named **post_install.sh** written by different developer. It is exactly same as Alfred, but provides a few different set of applications. Please check the following link for more details. + +These two scripts allows the lazy users, especially newbies, to be able to easily and fastly install most common apps, tools, updates, utilities they want to use in their Ubuntu Linux with few mouse clicks away, and stop depending on the help of official or non-official documentations. + +And, that’s all for now. Hope this was useful. More good stuffs to come. Stay tuned! + +Cheers! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/an-automated-way-to-install-essential-applications-on-ubuntu/ + +作者:[SK][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: http://www.ostechnix.com/wp-content/uploads/2019/02/alfred-1.png +[3]: http://www.ostechnix.com/wp-content/uploads/2019/02/alfred-2.png +[4]: http://www.ostechnix.com/wp-content/uploads/2019/02/alfred-4.png +[5]: http://www.ostechnix.com/wp-content/uploads/2019/02/alfred-5-1.png +[6]: https://www.ostechnix.com/list-installed-packages-sorted-installation-date-linux/ From 6f082b41ccc1ecea0f7f179bffc1a3d1363ee482 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 27 Feb 2019 16:20:24 +0800 Subject: [PATCH 018/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190218=20Get=20?= =?UTF-8?q?started=20and=20organized=20with=20TiddlyWiki=20sources/tech/20?= =?UTF-8?q?190218=20Get=20started=20and=20organized=20with=20TiddlyWiki.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...t started and organized with TiddlyWiki.md | 156 ++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 sources/tech/20190218 Get started and organized with TiddlyWiki.md diff --git a/sources/tech/20190218 Get started and organized with TiddlyWiki.md b/sources/tech/20190218 Get started and organized with TiddlyWiki.md new file mode 100644 index 0000000000..25d6883a3a --- /dev/null +++ b/sources/tech/20190218 Get started and organized with TiddlyWiki.md @@ -0,0 +1,156 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started and organized with TiddlyWiki) +[#]: via: (https://opensource.com/article/19/2/tiddlywiki) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) + +Get started and organized with TiddlyWiki +====== +Take notes, manage tasks, keep a journal, and otherwise stay organized with TiddlyWiki. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/life_paperclips.png?itok=j48op49T) + +When you think of the word wiki, chances are the first thing that comes to mind is Wikipedia. That's not a surprise, considering that Wikipedia did help put the concept of the wiki into the popular consciousness. Wikis, which are websites you can edit, are great tools for collaborating and organizing. But wikis usually require a lot of digital plumbing and a bit of care to use and maintain. All of that's overkill for personal use. + +While you can install [desktop wikis][1] on your computer, they're not as portable as some people want or need them to be. + +Enter [TiddlyWiki][2], the brainchild of British software developer [Jeremy Ruston][3]. Not only is it great for organizing yourself, but it's also easy to use and very portable. + +Let's take a quick look at the basics of using TiddlyWiki to get organized. + +### What's TiddlyWiki? + +TiddlyWiki isn't software quite as you know it. It's a large web page (consisting of HTML and a lot of JavaScript) that weighs in at around 2MB. You can edit and save the file in a web browser. + +It's very flexible. You can use TiddlyWiki to take notes, manage task lists, save bookmarks, publish a blog or website, create a presentation, and a lot more. And people have used it to do some [interesting things][4]. + +As I mentioned, TiddlyWiki is very portable. You can put it in a folder in, say, [Nextcloud][5] and share a TiddlyWiki between computers and mobile devices. Or, you can carry it around on a flash drive. + +### Getting started + +Head over to the [TiddlyWiki website][6] and download the file empty.html. Rename that file to something a bit more meaningful and descriptive. Then open it in a web browser. + +You'll see the Getting Started tiddler (more on tiddlers in a moment): + +![](https://opensource.com/sites/default/files/uploads/tiddlywiki-get-started.png) + +Click the pencil icon in the top-right corner and change the information. Then, click the checkmark icon to save the TiddlyWiki. + +#### A note about saving your TiddlyWiki + +Since your web browser thinks a TiddlyWiki is a file, it'll save your TiddlyWiki to the folder on your computer where downloads go. And when it does that, your browser will probably save it with a file name like tiddlywiki(1).html. You don't want that. + +If you're using Chrome or Chromium, set the browser to ask you where to save files by selecting **Settings** , then clicking **Show advanced settings** on the Settings page. Then click the **Ask where to save each file before downloading** option. + +If you're using Firefox, click on the stacker menu in the top-right corner and select **Options**. Find the **Downloads** option, and click **Always ask you where to save files**. + +### Working with TiddlyWiki + +You can use TiddlyWiki for just about anything. And people have done just that. But instead of jumping into the scary depths, let's look at the basics of using TiddlyWiki. + +Since I prefer to focus on specific tasks with my tools, I'm going to look at using TiddlyWiki for: + + * Taking notes + * Managing tasks + * Keeping a journal + + + +#### Taking notes + +To get going, create a new tiddler, which is an individual page within TiddlyWiki. To be honest, I don't know how many tiddlers a single TiddlyWiki can contain before it slows down, but I wouldn't be surprised if it's in the hundreds or thousands. + +Create a new tiddler by clicking the **+** icon. + +![](https://opensource.com/sites/default/files/uploads/tiddlywiki-new-tiddler.png) + +Give your tiddler a name, like Notes for netbooks essay. You can also type a tag in the **Tag name** field—doing that will let you filter your tiddlers so you can find them quickly when you have a lot of them. Then start typing. + +You can format your tiddler using TiddlyWiki's markup. You can also use the formatting toolbar to add character formatting, lists, quotes, headings, images, and links. + +When you're done, click the checkmark icon to save the tiddler. + +![](https://opensource.com/sites/default/files/uploads/tiddlywiki-example-tiddler.png) + +#### Creating a task list + +Again, create a new tiddler. Give it a name like Tasks - 4 May 2019 and type Tasks in the **Tag name** field. + +From there, type your tasks—one line for each. Put an asterisk (*) in front of each one to create a bullet list. Then save your list. + +![](https://opensource.com/sites/default/files/uploads/tiddlywiki-task-list.png) + +To mark off a completed task, edit the tiddler, highlight the task, and click the Strikethrough button on the toolbar. + +![](https://opensource.com/sites/default/files/uploads/tiddlywiki-complete-task.png) + +That's a pretty simple, and frankly lame, way to deal with tasks. If you're looking for something more visually appealing, [watch this video][7]. This method requires a bit more setup, but you also get nifty checkboxes that you can click when you finish a task. + +#### Keeping a journal + +If you want to keep a journal, first click the **Tools** tab and select the **New journal** option. That puts the **Create a new journal tiddler** button on the main TiddlyWiki toolbar. + +Click that button and you'll notice that the journal tiddler has today's date as its name and has been tagged **Journal**. + +As with any other tiddler, type your text and save the tiddler when you're done. + +### The power of plugins + +What if you want or need more from TiddlyWiki? You can use [plugins][8] to extend and customize TiddlyWiki's capabilities. You can change its appearance, add [editors][9] and [support for Markdown][10], turn TiddlyWiki into a personal [kanban board][11] (à la [WeKan][12]), add a more powerful search engine, and more. + +TiddlyWiki has a plugin library, which you can access from its control panel. There's a [list of plugins][13] created by users, and [this toolmap][14] lists over 600 plugins, tips, and tricks. + +### One TiddlyWiki or several? + +You can load up your TiddlyWiki with everything you need to do. Eventually, though, it could get so full of tiddlers that it's difficult to easily find what you need to find, even with good tagging. + +An alternative to that is to have several TiddlyWiki files—for example, one for notes, one for tasks, one for outlines, one for journaling. Keeping track of those files could become a chore. The [desktop version][15] can help you better organize two or more TiddlyWiki files. + +![](https://opensource.com/sites/default/files/uploads/tiddlywiki-desktop.png) + +### Learning more + +I've only covered the basics of using TiddlyWiki. There is a lot you can do with it, even if (like me) you're using it just for simple tasks. + +Here are some good resources that can help you learn more about using TiddlyWiki: + + * The [TiddlyWiki website][6] has a number of tutorials in the Learning section + * Francis Meetze has created [several videos][16] explaining how to do things with TiddlyWiki + * A [one-page][17] TiddlyWiki cheatsheet PDF + * [Five Steps to TiddlyWiki 5][18], which helps you get up and running with TiddlyWiki + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/tiddlywiki + +作者:[Scott Nesbitt][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/scottnesbitt +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/17/2/3-desktop-wikis +[2]: http://tiddlywiki.com/ +[3]: https://jermolene.com/ +[4]: https://tiddlywiki.com/static/Examples.html +[5]: https://nextcloud.com/ +[6]: http://www.tiddlywiki.com +[7]: https://www.youtube.com/watch?v=mzoMhKx0j8g +[8]: https://tiddlywiki.com/#Plugins +[9]: https://tiddlywiki.com/plugins/tiddlywiki/codemirror/ +[10]: https://tiddlywiki.com/plugins/tiddlywiki/markdown/ +[11]: https://ibnishak.github.io/Tesseract/projects/tekan/Tekan.html +[12]: https://opensource.com/article/17/12/wekan-manage-your-work +[13]: https://tiddlywiki.com/#OfficialPlugins +[14]: https://dynalist.io/d/zUP-nIWu2FFoXH-oM7L7d9DM +[15]: https://github.com/Jermolene/TiddlyDesktop +[16]: https://www.youtube.com/channel/UCCYN_nzlUKKMiTj5rerv2lQ/videos +[17]: http://www.tcm.phy.cam.ac.uk/~mdt26/PWT/hints.pdf +[18]: http://www.richshumaker.com/tw5/FiveStepsToTiddlyWiki5.htm From dc6a4b363571348cd1520318872b9901e582d3bb Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 27 Feb 2019 16:22:11 +0800 Subject: [PATCH 019/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190219=20How=20?= =?UTF-8?q?Linux=20testing=20has=20changed=20and=20what=20matters=20today?= =?UTF-8?q?=20sources/talk/20190219=20How=20Linux=20testing=20has=20change?= =?UTF-8?q?d=20and=20what=20matters=20today.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ting has changed and what matters today.md | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 sources/talk/20190219 How Linux testing has changed and what matters today.md diff --git a/sources/talk/20190219 How Linux testing has changed and what matters today.md b/sources/talk/20190219 How Linux testing has changed and what matters today.md new file mode 100644 index 0000000000..ad26d6dbec --- /dev/null +++ b/sources/talk/20190219 How Linux testing has changed and what matters today.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How Linux testing has changed and what matters today) +[#]: via: (https://opensource.com/article/19/2/phoronix-michael-larabel) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +How Linux testing has changed and what matters today +====== +Michael Larabel, the founder of Phoronix, shares his insights on the evolution of Linux and open hardware. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/mistake_bug_fix_find_error.png?itok=PZaz3dga) + +If you've ever wondered how your Linux computer stacks up against other Linux, Windows, and MacOS machines or searched for reviews of Linux-compatible hardware, you're probably familiar with [Phoronix][1]. Along with its website, which attracts more than 250 million visitors a year to its Linux reviews and news, the company also offers the [Phoronix Test Suite][2], an open source hardware benchmarking tool, and [OpenBenchmarking.org][3], where test result data is stored. + +According to [Michael Larabel][4], who started Phoronix in 2004, the site "is frequently cited as being the leading source for those interested in computer hardware and Linux. It offers insights regarding the development of the Linux kernel, product reviews, interviews, and news regarding free and open source software." + +I recently had the opportunity to interview Michael about Phoronix and his work. + +The questions and answers have been edited for length and clarity. + +**Don Watkins:** What inspired you to start Phoronix? + +**Michael Larabel:** When I started [Phoronix.com][5] in June 2004, it was still challenging to get a mouse or other USB peripherals working on the popular distributions of the time, like Mandrake, Yoper, MEPIS, and others. So, I set out to work on reviewing different hardware components and their compatibility with Linux. Over time, that shifted more from "does the basic device work?" to how well they perform and what features are supported or unsupported under Linux. + +It's been interesting to see the evolution and the importance of Linux on hardware rise. Linux was very common to LAMP/web servers, but Linux has also become synonymous with high-performance computing (HPC), Android smartphones, cloud software, autonomous vehicles, edge computing, digital signage, and related areas. While Linux hasn't quite dominated the desktop, it's doing great practically everywhere else. + +I also developed the Phoronix Test Suite, with its initial 1.0 public release in 2008, to increase the viability of testing on Linux, engage with more hardware and software vendors on best practices for testing, and just get more test cases running on Linux. At the time, there weren't any really shiny benchmarks on Linux like there were on Windows. + +**DW:** Who are your website's readers? + +**ML:** Phoronix's audience is as diverse as the content. Initially, it was quite desktop/gamer/enthusiast oriented, but as Linux's dominance has grown in HPC, cloud, embedded, etc., my testing has expanded in those areas and thus so has the readership. Readers tend to be interested in open source/Linux ecosystem advancements, performance, and a slight bent towards graphics processor and hardware driver interests. + +**DW:** How important is testing in the Linux world and how has it changed from when you started? + +**ML:** Testing has changed radically since 2004. Back then, many open source projects weren't carrying out any continuous integration (CI) or testing for regressions—both functional issues and performance problems. The hardware vendors supporting Linux were mostly trying to get things working and maintained while being less concerned about performance or scratching away at catching up to Mac, Solaris, and Windows. With time, we've seen the desktop reach close parity with (or exceed, depending upon your views) alternative operating systems. Most PC hardware now works out-of-the-box on Linux, most open source projects engage in some form of CI or testing, and more time and resources are afforded to advancing Linux performance. With high-frequency trading and cloud platforms relying on Linux, performance has become of utmost importance. + +Most of my testing at Phoronix.com is focused on benchmarking processors, graphics cards, storage devices, and other areas of interest to gamers and enthusiasts, but also interesting server platforms. Readers are also quite interested in testing of software components like the Linux kernel, code compilers, and filesystems. But in terms of the Phoronix Test Suite, its scope is rather limitless, with a framework in which new tests can be easily added and automated. There are currently more than 1,000 different profiles/suites, and new ones are routinely added—from machine learning tests to traditional benchmarks. + +**DW:** How important is open source hardware? Where do you see it going? + +**ML:** Open hardware is of increasing importance, especially in light of all the security vulnerabilities and disclosures in recent years. Facebook's work on the [Open Compute Project][6] can be commended, as can Google leveraging [Coreboot][7] in its Chromebook devices, and [Raptor Computing Systems][8]' successful, high-performance, open source POWER9 desktops/workstations/servers. [Intel][9] potentially open sourcing its firmware support package this year is also incredibly tantalizing and will hopefully spur more efforts in this space. + +Outside of that, open source hardware has had a really tough time cracking the consumer space due to the sheer amount of capital necessary and the complexities of designing a modern chip, etc., not to mention competing with the established hardware vendors' marketing budgets and other resources. So, while I would love for 100% open source hardware to dominate—or even compete in features and performance with proprietary hardware—in most segments, that is sadly unlikely to happen, especially with open hardware generally being much more expensive due to economies of scale. + +Software efforts like [OpenBMC][10], Coreboot/[Libreboot][11], and [LinuxBoot][12] are opening up hardware much more. Those efforts at liberating hardware have proven successful and will hopefully continue to be endorsed by more organizations. + +As for [OSHWA][13], I certainly applaud their efforts and the enthusiasm they bring to open source hardware. Certainly, for niche and smaller-scale devices, open source hardware can be a great fit. It will certainly be interesting to see what comes about with OSHWA and some of its partners like Lulzbot, Adafruit, and System76. + +**DW:** Can people install Phoronix Test Suite on their own computers? + +ML: The Phoronix Test Suite benchmarking software is open source under the GPL and can be downloaded from [Phoronix-Test-Suite.com][2] and [GitHub][14]. The benchmarking software works on not only Linux systems but also MacOS, Solaris, BSD, and Windows 10/Windows Server. The Phoronix Test Suite works on x86/x86_64, ARM/AArch64, POWER, RISC-V, and other architectures. + +**DW:** How does [OpenBenchmarking.org][15] work with the Phoronix Test Suite? + +**ML:** OpenBenchmarking.org is, in essence, the "cloud" component to the Phoronix Test Suite. It stores test profiles/test suites in a package manager-like fashion, allows users to upload their own benchmarking results, and offers related functionality around our benchmarking software. + +OpenBenchmarking.org is seamlessly integrated into the Phoronix Test Suite, but from the web interface, it is also where anyone can see the public benchmark results, inspect the open source test profiles to understand their methodology, research hardware and software data, and use similar functionality. + +Another component developed as part of the Phoronix Test Suite is [Phoromatic][16], which effectively allows anyone to deploy their own OpenBenchmarking-like environment within their own private intranet/LAN. This allows organizations to archive their benchmark results locally (and privately), orchestrate benchmarks automatically against groups of systems, manage the benchmark systems, and develop new test cases. + +**DW:** How can people stay up to date on Phoronix? + +**ML:** You can follow [me][17], [Phoronix][18], [Phoronix Test Suite][19], and [OpenBenchMarking.org][20] on Twitter. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/phoronix-michael-larabel + +作者:[Don Watkins][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/don-watkins +[b]: https://github.com/lujun9972 +[1]: https://www.phoronix.com/ +[2]: https://www.phoronix-test-suite.com/ +[3]: https://openbenchmarking.org/ +[4]: https://www.michaellarabel.com/ +[5]: http://Phoronix.com +[6]: https://www.opencompute.org/ +[7]: https://www.coreboot.org/ +[8]: https://www.raptorcs.com/ +[9]: https://www.phoronix.com/scan.php?page=news_item&px=Intel-Open-Source-FSP-Likely +[10]: https://en.wikipedia.org/wiki/OpenBMC +[11]: https://libreboot.org/ +[12]: https://linuxboot.org/ +[13]: https://www.oshwa.org/ +[14]: https://github.com/phoronix-test-suite/ +[15]: http://OpenBenchmarking.org +[16]: http://www.phoronix-test-suite.com/index.php?k=phoromatic +[17]: https://twitter.com/michaellarabel +[18]: https://twitter.com/phoronix +[19]: https://twitter.com/Phoromatic +[20]: https://twitter.com/OpenBenchmark From af11140d358c0b2998c2a92192f878fb5b6af89f Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 28 Feb 2019 12:56:53 +0800 Subject: [PATCH 020/796] 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 021/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020170519=20zsh=20?= =?UTF-8?q?shell=20inside=20Emacs=20on=20Windows=20sources/tech/20170519?= =?UTF-8?q?=20zsh=20shell=20inside=20Emacs=20on=20Windows.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...70519 zsh shell inside Emacs on Windows.md | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 sources/tech/20170519 zsh shell inside Emacs on Windows.md diff --git a/sources/tech/20170519 zsh shell inside Emacs on Windows.md b/sources/tech/20170519 zsh shell inside Emacs on Windows.md new file mode 100644 index 0000000000..3a93941d0b --- /dev/null +++ b/sources/tech/20170519 zsh shell inside Emacs on Windows.md @@ -0,0 +1,121 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (zsh shell inside Emacs on Windows) +[#]: via: (https://www.onwebsecurity.com/configuration/zsh-shell-inside-emacs-on-windows.html) +[#]: author: (Peter Mosmans https://www.onwebsecurity.com/) + +zsh shell inside Emacs on Windows +====== + +![zsh shell inside Emacs on Windows][5] + +The most obvious advantage of running a cross-platform shell (for example Bash or zsh) is that you can use the same syntax and scripts on multiple platforms. Setting up (alternative) shells on Windows can be pretty tricky, but the small investment is well worth the reward. + +The MSYS2 subsystem allows you to run shells like Bash or zsh on Windows. An important part of MSYS2 is making sure that the search paths are all pointing to the MSYS2 subsystem: There are a lot of dependencies. + +Bash is the default shell once MSYS2 is installed; zsh can be installed using the package manager: + +``` +pacman -Sy zsh +``` + +Setting zsh as default shell can be done by modifying the ` /etc/passwd` file, for instance: + +``` +mkpasswd -c | sed -e 's/bash/zsh/' | tee -a /etc/passwd +``` + +This will change the default shell from bash to zsh. + +Running zsh under Emacs on Windows can be done by modifying the ` shell-file-name` variable, and pointing it to the zsh binary from the MSYS2 subsystem. The shell binary has to be somewhere in the Emacs ` exec-path` variable. + +``` +(setq shell-file-name (executable-find "zsh.exe")) +``` + +Don't forget to modify the PATH environment variable for Emacs, as the MSYS2 paths should be resolved before Windows paths. Using the same example, where MSYS2 is installed under + +``` +c:\programs\msys2 +``` + +: + +``` +(setenv "PATH" "C:\\programs\\msys2\\mingw64\\bin;C:\\programs\\msys2\\usr\\local\\bin;C:\\programs\\msys2\\usr\\bin;C:\\Windows\\System32;C:\\Windows") +``` + +After setting these two variables in the Emacs configuration file, running + +``` +M-x shell +``` + +in Emacs should bring up the familiar zsh prompt. + +Emacs' terminal settings (eterm) are different than MSYS2' standard terminal settings (xterm-256color). This means that some plugins or themes (prompts) might not work - especially when using oh-my-zsh. + +Detecting whether zsh is started under Emacs is easy, using the variable + +``` +$INSIDE_EMACS +``` + +. This codesnippet in + +``` +.zshrc +``` + +(which will be sourced for interactive shells) only enables the git plugin when being run in Emacs, and changes the theme + +``` +# Disable some plugins while running in Emacs +if [[ -n "$INSIDE_EMACS" ]]; then + plugins=(git) + ZSH_THEME="simple" +else + ZSH_THEME="compact-grey" +fi +``` + +. This codesnippet in(which will be sourced for interactive shells) only enables the git plugin when being run in Emacs, and changes the theme + +By adding the ` INSIDE_EMACS` variable to the local ` ~/.ssh/config` as ` SendEnv` variable... + +``` +Host myhost +SendEnv INSIDE_EMACS +``` + +... and to a ssh server as ` AcceptEnv` variable in ` /etc/ssh/sshd_config` ... + +``` +AcceptEnv LANG LC_* INSIDE_EMACS +``` + +... this even works when ssh'ing inside an Emacs shell session to another ssh server, running zsh. When ssh'ing in the zsh shell inside Emacs on Windows, using the parameters ` -t -t` forces pseudo-tty allocation (which is necessary, as Emacs on Windows don't have a true tty). + +Cross-platform, open-source goodyness... + +-------------------------------------------------------------------------------- + +via: https://www.onwebsecurity.com/configuration/zsh-shell-inside-emacs-on-windows.html + +作者:[Peter Mosmans][a] +选题:[lujun9972][b] +译者:[lujun9972](https://github.com/lujun9972) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.onwebsecurity.com/ +[b]: https://github.com/lujun9972 +[1]: https://www.onwebsecurity.com/category/configuration.html +[2]: https://www.onwebsecurity.com/tag/emacs.html +[3]: https://www.onwebsecurity.com/tag/msys2.html +[4]: https://www.onwebsecurity.com/tag/zsh.html +[5]: https://www.onwebsecurity.com//images/zsh-shell-inside-emacs-on-windows.png From 7e4c9966d53ec34c35aa2dc9aa0b6b550a1000e1 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 28 Feb 2019 13:03:57 +0800 Subject: [PATCH 022/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020170223=20Use=20?= =?UTF-8?q?Emacs=20to=20create=20OAuth=202.0=20UML=20sequence=20diagrams?= =?UTF-8?q?=20sources/tech/20170223=20Use=20Emacs=20to=20create=20OAuth=20?= =?UTF-8?q?2.0=20UML=20sequence=20diagrams.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... create OAuth 2.0 UML sequence diagrams.md | 151 ++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 sources/tech/20170223 Use Emacs to create OAuth 2.0 UML sequence diagrams.md diff --git a/sources/tech/20170223 Use Emacs to create OAuth 2.0 UML sequence diagrams.md b/sources/tech/20170223 Use Emacs to create OAuth 2.0 UML sequence diagrams.md new file mode 100644 index 0000000000..361ca1d49b --- /dev/null +++ b/sources/tech/20170223 Use Emacs to create OAuth 2.0 UML sequence diagrams.md @@ -0,0 +1,151 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use Emacs to create OAuth 2.0 UML sequence diagrams) +[#]: via: (https://www.onwebsecurity.com/configuration/use-emacs-to-create-oauth-2-0-uml-sequence-diagrams.html) +[#]: author: (Peter Mosmans https://www.onwebsecurity.com) + +Use Emacs to create OAuth 2.0 UML sequence diagrams +====== + +![OAuth 2.0 abstract protocol flow][6] + +It seems that the [OAuth 2.0 framework][7] is more and more being used by web (and mobile) applications. Great ! + +Although the protocol itself is not that complex, there are a number of different use-cases, flows and implementations to choose from. As with most things in life, the devil is in the detail. + +When reviewing OAuth 2.0 implementations or writing penetration testing reports I like to draw UML diagrams. That makes it easier to understand what's going on, and to spot potential issues. After all, a picture is worth a thousand words. + +This can be done extremely easy using the GPL-licensed open source [Emacs][8] editor, in conjunction with the GPL-licensed open source tool [PlantUML][9] (and optionally using Eclipse Public Licensed [Graphviz][10]). + +Emacs is worlds' most versatile editor. In this case, it's being used to edit the text, and automatically convert the text to an image. PlantUML is a tool which allows you to write UML in human readable text and does the actual conversion. Graphviz is visualization software, and optionally - in this case, it's used to show certain images. + +Download the [compiled PlantUML jar file][11], [Emacs][12] and optionally download and install [Graphviz][13]. + +Once you have Emacs installed and running, the following Lisp code (actually configuration) in your startup file (` ~/.emacs.d/init.d` ) will + + * configure ` org-mode` (a mode to organize and edit text files) to use PlantUML + * add ` plantuml` to the recognized ` org-babel` languages (which allows you to execute source code from within text files) + * allow the execution of PlantUML code as "safe" + * automatically show you the resulting image + + + +``` + ;; tell org-mode where to find the plantuml JAR file (specify the JAR file) +(setq org-plantuml-jar-path (expand-file-name "~/plantuml.jar")) + +;; use plantuml as org-babel language +(org-babel-do-load-languages 'org-babel-load-languages '((plantuml . t))) + +;; helper function +(defun my-org-confirm-babel-evaluate (lang body) +"Do not ask for confirmation to evaluate code for specified languages." +(member lang '("plantuml"))) + +;; trust certain code as being safe +(setq org-confirm-babel-evaluate 'my-org-confirm-babel-evaluate) + +;; automatically show the resulting image +(add-hook 'org-babel-after-execute-hook 'org-display-inline-images) +``` + +If you don't have a startup file yet, add this code to the file ` ~/.emacs.d/init.el` and restart Emacs. + +Hint: Control-c Control-f allows you to create/open a (new) file. Control-x Control-s saves a file, and Control-x Control-c exits Emacs. + +That's it! + +To test the configuration, create/open a file ( Control-c Control-f ) with the extension ` .org` , e.g. ` test.org` . This makes sure that Emacs switches to "org-mode" and recognizes the "org-babel" syntax. + +Insert the following code, and press Control-c Control-c within the code to test the installation: + +``` +#+BEGIN_SRC plantuml :file test.png +@startuml +version +@enduml +#+END_SRC +``` + +If everything went well, you'll see an image appearing inside Emacs, below the text. + +Note + +To quickly insert code snippets like ` #+BEGIN_SRC` and ` #+END_SRC` , you can use the built-in Easy Templates system: Type user : request authorization +note left +**grant types**: +# authorization code +# implicit +# password +# client_credentials +end note +user --> client : authorization grant +end + +group token is generated +client -> authorization : request token\npresent authorization grant +authorization --> client :var: access token +note left +**response types**: +# code +# token +end note +end group + +group resource can be accessed +client -> resource : request resource\npresent token +resource --> client : resource +end group +@enduml +#+END_SRC +``` + +Don't you just love the versatility of Emacs, and open source tools ? + +-------------------------------------------------------------------------------- + +via: https://www.onwebsecurity.com/configuration/use-emacs-to-create-oauth-2-0-uml-sequence-diagrams.html + +作者:[Peter Mosmans][a] +选题:[lujun9972][b] +译者:[lujun9972](https://github.com/lujun9972) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.onwebsecurity.com +[b]: https://github.com/lujun9972 +[1]: https://www.onwebsecurity.com/category/configuration.html +[2]: https://www.onwebsecurity.com/tag/emacs.html +[3]: https://www.onwebsecurity.com/tag/oauth2.html +[4]: https://www.onwebsecurity.com/tag/pentesting.html +[5]: https://www.onwebsecurity.com/tag/security.html +[6]: https://www.onwebsecurity.com/images/oauth2-abstract-protocol-flow.png +[7]: https://tools.ietf.org/html/rfc6749 +[8]: https://www.gnu.org/software/emacs/ +[9]: https://plantuml.com +[10]: http://www.graphviz.org/ +[11]: http://plantuml.com/download +[12]: https://www.gnu.org/software/emacs/download.html +[13]: http://www.graphviz.org/Download.php From 339456790e4d427f3d04fac090a5c7fb10a50e7b Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Thu, 28 Feb 2019 13:31:22 +0800 Subject: [PATCH 023/796] 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 024/796] 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 025/796] 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 026/796] 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 027/796] 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 028/796] 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 029/796] 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 030/796] 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 031/796] 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 032/796] =?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 033/796] 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 034/796] 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 035/796] 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 036/796] 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 037/796] =?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 038/796] 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 039/796] 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 040/796] 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 041/796] 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 042/796] 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 043/796] 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 044/796] 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 045/796] 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 046/796] 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 047/796] 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 048/796] 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 049/796] 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 050/796] =?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 051/796] 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 052/796] 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 053/796] 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 054/796] 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 055/796] 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 056/796] =?UTF-8?q?20190206=20=E7=BF=BB=E8=AF=91=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...06 Getting started with Vim visual mode.md | 126 ------------------ ...06 Getting started with Vim visual mode.md | 117 ++++++++++++++++ 2 files changed, 117 insertions(+), 126 deletions(-) delete mode 100644 sources/tech/20190206 Getting started with Vim visual mode.md create mode 100644 translated/tech/20190206 Getting started with Vim visual mode.md diff --git a/sources/tech/20190206 Getting started with Vim visual mode.md b/sources/tech/20190206 Getting started with Vim visual mode.md deleted file mode 100644 index eadc031b88..0000000000 --- a/sources/tech/20190206 Getting started with Vim visual mode.md +++ /dev/null @@ -1,126 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MjSeven) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Getting started with Vim visual mode) -[#]: via: (https://opensource.com/article/19/2/getting-started-vim-visual-mode) -[#]: author: (Susan Lauber https://opensource.com/users/susanlauber) - -Getting started with Vim visual mode -====== -Visual mode makes it easier to highlight and manipulate text in Vim. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_code_keyboard_orange_hands.png?itok=G6tJ_64Y) - -Ansible playbook files are text files in a YAML format. People who work regularly with them have their favorite editors and plugin extensions to make the formatting easier. - -When I teach Ansible with the default editor available in most Linux distributions, I use Vim's visual mode a lot. It allows me to highlight my actions on the screen—what I am about to edit and the text manipulation task I'm doing—to make it easier for my students to learn. - -### Vim's visual mode - -When editing text with Vim, visual mode can be extremely useful for identifying chunks of text to be manipulated. - -Vim's visual mode has three versions: character, line, and block. The keystrokes to enter each mode are: - - * Character mode: **v** (lower-case) - * Line mode: **V** (upper-case) - * Block mode: **Ctrl+v** - - - -Here are some ways to use each mode to simplify your work. - -### Character mode - -Character mode can highlight a sentence in a paragraph or a phrase in a sentence. Then the visually identified text can be deleted, copied, changed, or modified with any other Vim editing command. - -#### Move a sentence - -To move a sentence from one place to another, start by opening the file and moving the cursor to the first character in the sentence you want to move. - -![](https://opensource.com/sites/default/files/uploads/vim-visual-char1.png) - - * Press the **v** key to enter visual character mode. The word **VISUAL** will appear at the bottom of the screen. - * Use the Arrow keys to highlight the desired text. You can use other navigation commands, such as **w** to highlight to the beginning of the next word or **$** to include the rest of the line. - * Once the text is highlighted, press the **d** key to delete the text. - * If you deleted too much or not enough, press **u** to undo and start again. - * Move your cursor to the new location and press **p** to paste the text. - - - -#### Change a phrase - -You can also highlight a chunk of text that you want to replace. - -![](https://opensource.com/sites/default/files/uploads/vim-visual-char2.png) - - * Place the cursor at the first character you want to change. - * Press **v** to enter visual character mode. - * Use navigation commands, such as the Arrow keys, to highlight the phrase. - * Press **c** to change the highlighted text. - * The highlighted text will disappear, and you will be in Insert mode where you can add new text. - * After you finish typing the new text, press **Esc** to return to command mode and save your work. - -![](https://opensource.com/sites/default/files/uploads/vim-visual-char3.png) - -### Line mode - -When working with Ansible playbooks, the order of tasks can matter. Use visual line mode to move a task to a different location in the playbook. - -#### Manipulate multiple lines of text - -![](https://opensource.com/sites/default/files/uploads/vim-visual-line1.png) - - * Place your cursor anywhere on the first or last line of the text you want to manipulate. - * Press **Shift+V** to enter line mode. The words **VISUAL LINE** will appear at the bottom of the screen. - * Use navigation commands, such as the Arrow keys, to highlight multiple lines of text. - * Once the desired text is highlighted, use commands to manipulate it. Press **d** to delete, then move the cursor to the new location, and press **p** to paste the text. - * **y** (yank) can be used instead of **d** (delete) if you want to copy the task. - - - -#### Indent a set of lines - -When working with Ansible playbooks or YAML files, indentation matters. A highlighted block can be shifted right or left with the **>** and **<** keys. - -![]9https://opensource.com/sites/default/files/uploads/vim-visual-line2.png - - * Press **>** to increase the indentation of all the lines. - * Press **<** to decrease the indentation of all the lines. - - - -Try other Vim commands to apply them to the highlighted text. - -### Block mode - -The visual block mode is useful for manipulation of specific tabular data files, but it can also be extremely helpful as a tool to verify indentation of an Ansible playbook. - -Tasks are a list of items and in YAML each list item starts with a dash followed by a space. The dashes must line up in the same column to be at the same indentation level. This can be difficult to see with just the human eye. Indentation of other lines within the task is also important. - -#### Verify tasks lists are indented the same - -![](https://opensource.com/sites/default/files/uploads/vim-visual-block1.png) - - * Place your cursor on the first character of the list item. - * Press **Ctrl+v** to enter visual block mode. The words **VISUAL BLOCK** will appear at the bottom of the screen. - * Use the Arrow keys to highlight the single character column. You can verify that each task is indented the same amount. - * Use the Arrow keys to expand the block right or left to check whether the other indentation is correct. - -![](https://opensource.com/sites/default/files/uploads/vim-visual-block2.png) - -Even though I am comfortable with other Vim editing shortcuts, I still like to use visual mode to sort out what text I want to manipulate. When I demo other concepts during a presentation, my students see a tool to highlight text and hit delete in this "new to them" text only editor. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/2/getting-started-vim-visual-mode - -作者:[Susan Lauber][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/susanlauber -[b]: https://github.com/lujun9972 diff --git a/translated/tech/20190206 Getting started with Vim visual mode.md b/translated/tech/20190206 Getting started with Vim visual mode.md new file mode 100644 index 0000000000..ea1dccaaf4 --- /dev/null +++ b/translated/tech/20190206 Getting started with Vim visual mode.md @@ -0,0 +1,117 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with Vim visual mode) +[#]: via: (https://opensource.com/article/19/2/getting-started-vim-visual-mode) +[#]: author: (Susan Lauber https://opensource.com/users/susanlauber) + +Vim 可视化模式入门 +====== +可视化模式使得在 Vim 中高亮显示和操作文本变得更加容易。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_code_keyboard_orange_hands.png?itok=G6tJ_64Y) + +Ansible playbook 文件是 YAML 格式的文本文件,经常与它们打交道的人有他们最喜欢的编辑器和扩展插件以使格式化更容易。 + +当我使用大多数 Linux 发行版中提供的默认编辑器来教 Ansible 时,我经常使用 Vim 的可视化模式。它允许我在屏幕上高亮显示我的操作 -- 我要编辑什么以及我正在做的文本处理任务,以便使我的学生更容易学习。 + +### Vim 的可视化模式 + +使用 Vim 编辑文本时,可视化模式对于识别要操作的文本块非常有用。 + +Vim 的可视模式有三个模式:字符,行和块。进入每种模式的按键是: + + * 字符模式: **v** (小写) + * 行模式: **V** (大写) + * 块模式: **Ctrl+v** + +下面是使用每种模式简化工作的一些方法。 + +### 字符模式 + +字符模式可以高亮显示段落中的一个句子或句子中的一个短语,然后,可以使用任何 Vim 编辑命令删除、复制、更改或修改可视化模式识别的文本。 + +#### 移动一个句子 + +要将句子从一个地方移动到另一个地方,首先打开文件并将光标移动到要移动的句子的第一个字符。 +![](https://opensource.com/sites/default/files/uploads/vim-visual-char1.png) + + * 按下 **v** 键进入可视化字符模式。单词 **VISUAL** 将出现在屏幕底部。 + * 使用箭头来高亮显示所需的文本。你可以使用其他导航命令,例如 **w** 高亮显示至下一个单词的开头,**$** 来包含其余行。 + * 在文本高亮显示后,按下 **d** 删除文本。 + * 如果你删除得太多或不够,按下 **u** 撤销并重新开始。 + * 将光标移动到新位置,然后按 **p** 粘贴文本。 + +#### 改变一个短语 + +你还可以高亮显示要替换的文本块。 + +![](https://opensource.com/sites/default/files/uploads/vim-visual-char2.png) + + * 将光标放在要更改的第一个字符处。 + * 按下 **v** 进入可视化字符模式。 + * 使用导航命令(如箭头键)高亮显示短语。 + * 按下 **c** 可更改高亮显示的文本。 + * 高亮显示的文本将消失,你将处于插入模式,你可以在其中添加新文本。 + * 输入新文本后,按下 **Esc** 返回命令模式并保存你的工作。 + +![](https://opensource.com/sites/default/files/uploads/vim-visual-char3.png) + +### 行模式 + +使用 Ansible playbooks 时,任务的顺序很重要。使用可视化行模式将任务移动到 playbooks 中的其他位置。 + +#### 操纵多行文本 + +![](https://opensource.com/sites/default/files/uploads/vim-visual-line1.png) + + * 将光标放在要操作的文本的第一行或最后一行的任何位置。 + * 按下 **Shift+V** 进入行模式。单词 **VISUAL LINE** 将出现在屏幕底部。 + * 使用导航命令(如箭头键)高亮显示多行文本。 + * 高亮显示所需文本后,使用命令来操作它。按下 **d** 删除,然后将光标移动到新位置,按下 **p** 粘贴文本。 + * 如果要复制任务,可以使用 **y**(yank) 来代替 **d**(delete)。 + +#### 缩进一组行 + +使用 Ansible playbooks 或 YAML 文件时,缩进很重要。高亮显示的块可以使用 **>** 和 **<** 键向右或向左移动。 + +![](https://opensource.com/sites/default/files/uploads/vim-visual-line2.png) + + * 按下 **>** 增加所有行的缩进。 + * 按下 **<** 减少所有行的缩进。 + +尝试其他 Vim 命令将它们应用于高亮显示的文本。 + +### 块模式 + +可视化块模式对于操作特定的表格数据文件非常有用,但它作为验证 Ansible playbook 缩进的工具也很有帮助。 + +任务是项目列表,在 YAML 中,每个列表项都以破折号和空格开头。破折号必须在同一列中对齐,以达到相同的缩进级别。仅凭肉眼很难看出这一点。缩进任务中的其他行也很重要。 + +#### 验证任务列表缩进相同 + +![](https://opensource.com/sites/default/files/uploads/vim-visual-block1.png) + + * 将光标放在列表项的第一个字符上。 + * 按下 **Ctrl+v** 进入可视化块模式。单词 **VISUAL BLOCK** 将出现在屏幕底部。 + * 使用箭头键高亮显示单个字符列。你可以验证每个任务的缩进量是否相同。 + * 使用箭头键向右或向左展开块,以检查其它缩进是否正确。 + +![](https://opensource.com/sites/default/files/uploads/vim-visual-block2.png) + +尽管我对其它 Vim 编辑快捷方式很熟悉,但我仍然喜欢使用可视化模式来整理我想要出来处理的文本。当我在演示过程总演示其它概念时,我的学生会看到一个高亮显示文本的工具,并在这个“仅限他们”的文本编辑器中点击删除。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/getting-started-vim-visual-mode + +作者:[Susan Lauber][a] +选题:[lujun9972][b] +译者:[MjSeven](https://github.com/MjSeven) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/susanlauber +[b]: https://github.com/lujun9972 From 6ddc8fcf8b0d84173ea14974103adc3c91114df8 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Sun, 3 Mar 2019 14:21:31 +0800 Subject: [PATCH 057/796] 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 058/796] 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 059/796] 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 060/796] 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 061/796] 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 062/796] 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 063/796] 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 064/796] 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 065/796] 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 066/796] 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 067/796] =?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 068/796] 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 069/796] 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 070/796] 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 071/796] 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 072/796] 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 073/796] 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 074/796] 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 075/796] 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 076/796] 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 077/796] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E7=BF=BB=E8=AF=91=20?= =?UTF-8?q?20190211=20Introducing=20kids=20to=20computational=20thinking?= =?UTF-8?q?=20with=20Python.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 申请翻译 20190211 Introducing kids to computational thinking with Python.md --- ...11 Introducing kids to computational thinking with Python.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20190211 Introducing kids to computational thinking with Python.md b/sources/talk/20190211 Introducing kids to computational thinking with Python.md index 542b2291e7..c877d3c212 100644 --- a/sources/talk/20190211 Introducing kids to computational thinking with Python.md +++ b/sources/talk/20190211 Introducing kids to computational thinking with Python.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (WangYueScream ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 00a5d1de3384f6632a022d8753dcf6d886cca0ff Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Mon, 4 Mar 2019 18:11:36 +0800 Subject: [PATCH 078/796] 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 079/796] 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 080/796] 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 081/796] 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 082/796] =?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 083/796] 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 084/796] 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 085/796] 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 086/796] 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 087/796] 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 088/796] 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 089/796] 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 090/796] 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 091/796] =?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 092/796] 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 093/796] 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 094/796] 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 095/796] 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 096/796] 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 097/796] 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 098/796] 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 099/796] 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 100/796] 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 101/796] 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 102/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190305=205=20wa?= =?UTF-8?q?ys=20to=20teach=20kids=20to=20program=20with=20Raspberry=20Pi?= =?UTF-8?q?=20sources/tech/20190305=205=20ways=20to=20teach=20kids=20to=20?= =?UTF-8?q?program=20with=20Raspberry=20Pi.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...teach kids to program with Raspberry Pi.md | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 sources/tech/20190305 5 ways to teach kids to program with Raspberry Pi.md diff --git a/sources/tech/20190305 5 ways to teach kids to program with Raspberry Pi.md b/sources/tech/20190305 5 ways to teach kids to program with Raspberry Pi.md new file mode 100644 index 0000000000..bfd980e56e --- /dev/null +++ b/sources/tech/20190305 5 ways to teach kids to program with Raspberry Pi.md @@ -0,0 +1,65 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 ways to teach kids to program with Raspberry Pi) +[#]: via: (https://opensource.com/article/19/3/teach-kids-program-raspberry-pi) +[#]: author: (Anderson Silva https://opensource.com/users/ansilva) + +5 ways to teach kids to program with Raspberry Pi +====== +The fifth article in our guide to getting started with the Raspberry Pi explores resources for helping kids learn to program. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003588_01_rd3os.combacktoschoolseriesgen_rh_032x_0.png?itok=cApG9aB4) + +As countless schools, libraries, and families have proven, the Raspberry Pi is a great way to expose kids to programming. In the first four articles in this series, you've learned about [purchasing][1], [installing][2], and [configuring][3] a Raspberry Pi. In this fifth article, I'll share some helpful resources to get kids started programming with the Raspberry Pi. + +### Scratch + +[Scratch][4] is a great way to introduce kids to basic programming concepts like variables, boolean logic, loops, and more. It's included in Raspbian, and you can find numerous articles and tutorials about Scratch on the internet, including [Is Scratch today like the Logo of the '80s for teaching kids to code?][5] on Opensource.com. + +![](https://opensource.com/sites/default/files/uploads/scratch2.png) + +### Code.org + +[Code.org][6] is another great online resource for kids learning to program. The organization's mission is to expose more people to coding through courses, tutorials, and the popular Hour of Code event. Many schools—including my fifth-grade son's—use it to expose more kids to programming and computer science concepts. + +### Reading + +Reading books is another great way to learn how to program. You don't necessarily need to speak English to learn how to program, but the more you know, the easier it will be, as most programming languages use English keywords to describe the commands. If your English is good enough to follow this Raspberry Pi series, you are most likely well-equipped to read books, forums, and other publications about programming. One book I recommend is [Python for Kids: A Playful Introduction to Programming][7] by Jason Biggs. + +### Raspberry Jam + +Another way to get your kids into programming is by helping them interact with others at meetups. The Raspberry Pi Foundation sponsors events called [Raspberry Jams][8] around the world where kids and adults can join forces and learn together on the Raspberry Pi. If there isn't a Raspberry Jam in your area, the foundation has a [guidebook][9] and other resources to help you start one. + +### Gaming + +Last, but not least, there's a version of [Minecraft][10] for the Raspberry Pi. Minecraft has grown from a multi-player "digital Lego"-like game into a programming platform where anyone can use Python and other languages to build on Minecraft's virtual world. Check out [Getting Started with Minecraft Pi][11] and [Minecraft Hour of Code Tutorials][12]. + +What are your favorite resources for teaching kids to program with Raspberry Pi? Please share them in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/teach-kids-program-raspberry-pi + +作者:[Anderson Silva][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ansilva +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/19/2/how-buy-raspberry-pi +[2]: https://opensource.com/article/19/2/how-boot-new-raspberry-pi +[3]: https://opensource.com/article/19/3/learn-linux-raspberry-pi +[4]: https://scratch.mit.edu/ +[5]: https://opensource.com/article/17/3/logo-scratch-teach-programming-kids +[6]: https://code.org/ +[7]: https://www.amazon.com/Python-Kids-Playful-Introduction-Programming/dp/1593274076 +[8]: https://www.raspberrypi.org/jam/#map-section +[9]: https://static.raspberrypi.org/files/jam/Raspberry-Jam-Guidebook-2017-04-26.pdf +[10]: https://minecraft.net/en-us/edition/pi/ +[11]: https://projects.raspberrypi.org/en/projects/getting-started-with-minecraft-pi +[12]: https://code.org/minecraft From d911e217eeaf258da527206d5b3c8c7b733bacaa Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 12:50:17 +0800 Subject: [PATCH 103/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190305=20Runnin?= =?UTF-8?q?g=20the=20=E2=80=98Real=20Debian=E2=80=99=20on=20Raspberry=20Pi?= =?UTF-8?q?=203+=20[For=20DIY=20Enthusiasts]=20sources/tech/20190305=20Run?= =?UTF-8?q?ning=20the=20=E2=80=98Real=20Debian-=20on=20Raspberry=20Pi=203-?= =?UTF-8?q?=20-For=20DIY=20Enthusiasts.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...- on Raspberry Pi 3- -For DIY Enthusiasts.md | 134 ++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 sources/tech/20190305 Running the ‘Real Debian- on Raspberry Pi 3- -For DIY Enthusiasts.md diff --git a/sources/tech/20190305 Running the ‘Real Debian- on Raspberry Pi 3- -For DIY Enthusiasts.md b/sources/tech/20190305 Running the ‘Real Debian- on Raspberry Pi 3- -For DIY Enthusiasts.md new file mode 100644 index 0000000000..785a6eeb5a --- /dev/null +++ b/sources/tech/20190305 Running the ‘Real Debian- on Raspberry Pi 3- -For DIY Enthusiasts.md @@ -0,0 +1,134 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Running the ‘Real Debian’ on Raspberry Pi 3+ [For DIY Enthusiasts]) +[#]: via: (https://itsfoss.com/debian-raspberry-pi) +[#]: author: (Shirish https://itsfoss.com/author/shirish/) + +Running the ‘Real Debian’ on Raspberry Pi 3+ [For DIY Enthusiasts] +====== + +If you have ever used a Raspberry Pi device, you probably already know that it recommends a Linux distribution called [Raspbian][1]. + +Raspbian is a heavily customized form of Debian to run on low-powered ARM processors. It’s not bad. In fact, it’s an excellent OS for Raspberry Pi devices but it’s not the real Debian. + +[Debian purists like me][2] would prefer to run the actual Debian over the Raspberry Pi’s customized Debian version. I trust Debian more than any other distribution to provide me a vast amount of properly vetted free software packages. Moreover, a project like this would help other ARM devices as well. + +Above all, running the official Debian on Raspberry Pi is sort of challenge and I like such challenges. + +![Real Debian on Raspberry Pi][3] + +I am not the only one who thinks like this. There are many other Debian users who share the same feeling and this is why there exists an ongoing project to create a [Debian image for Raspberry Pi][4]. + +About two and a half months back, a Debian Developer (DD) named [Gunnar Wolf][5] took over that unofficial Raspberry Pi image generation project. + +I’ll be quickly showing you how can you install this Raspberry Pi Debian Buster preview image on your Raspberry Pi 3 (or higher) devices. + +### Getting Debian on Raspberry Pi [For Experts] + +``` +Warning + +Be aware this Debian image is very raw and unsupported at the moment. Though it’s very new, I believe experienced Raspberry Pi and Debian users should be able to use it. +``` + +Now as far as [Debian][6] is concerned, here is the Debian image and instructions that you could use to put the Debian stock image on your Raspberry pi 3 Model B+. + +#### Step 1: Download the Debian Raspberry Pi Buster image + +You can download the preview images using wget command: + +``` +wget https://people.debian.org/~gwolf/raspberrypi3/20190206/20190206-raspberry-pi-3-buster-PREVIEW.img.xz +``` + +#### Step 2: Verify checksum (optional) + +It’s optional but you should [verify the checksum][7]. You can do that by downloading the SHA256 hashfile and then comparing it with that of the downloaded Raspberry Pi Debian image. + +At my end I had moved both the .sha256 file as img.xz to a directory to make it easier to check although it’s not necessary. + +``` +wget https://people.debian.org/~gwolf/raspberrypi3/20190206/20190206-raspberry-pi-3-buster-PREVIEW.img.xz.sha256 + +sha256sum -c 20190206-raspberry-pi-3-buster-PREVIEW.img.xz.sha256 +``` + +#### Step 3: Write the image to your SD card + +Once you have verified the image, take a look at it. It is around 400MB in the compressed xzip format. You can extract it to get an image of around 1.5GB in size. + +Insert your SD card. **Before you carry on to the next command please change the sdX to a suitable name that corresponds to your SD card.** + +The command basically extracts the img.xz archive to the SD card. The progress switch/flag enables you to see a progress line with a number as to know how much the archive has extracted. + +``` +xzcat 20190206-raspberry-pi-3-buster-PREVIEW.img.xz | dd of=/dev/sdX bs=64k oflag=dsync status=progress$ xzcat 20190206-raspberry-pi-3-buster-PREVIEW.img.xz | dd of=/dev/sdX bs=64k oflag=dsync status=progress +``` + +Once you have successfully flashed your SD card, you should be able test if the installation went ok by sshing into your Raspberry Pi. The default root password is raspberry. + +``` +ssh root@rpi3 +``` + +If you are curious to know how the Raspberry Pi image was built, you can look at the [build scripts][8]. + +You can find more info on the project homepage. + +[DEBIAN RASPBERRY PI IMAGE][15] + +### How to contribute to the Raspberry Pi Buster effort + +There is a mailing list called [debian-arm][9] where people could contribute their efforts and ask questions. As you can see in the list, there is already a new firmware which was released [few days back][10] which might make booting directly a reality instead of the workaround shared above. + +If you want you could make a new image using the raspi3-image-spec shared above or wait for Gunnar to make a new image which might take time. + +Most of the maintainers also hang out at #vmdb2 at #OFTC. You can either use your IRC client or [Riot client][11], register your name at Nickserv and connect with either Gunnar Wolf, Roman Perier or/and Lars Wirzenius, author of [vmdb2][12]. I might do a follow-up on vmdb2 as it’s a nice little tool by itself. + +### The Road Ahead + +If there are enough interest and contributors, for instance, the lowest-hanging fruit would be to make sure that the ARM64 port [wiki page][13] is as current as possible. The benefits are and can be enormous. + +There are a huge number of projects which could benefit from either having a [Pi farm][14] to making your media server or a SiP phone or whatever you want to play/work with. + +Another low-hanging fruit might be synchronization between devices, say an ARM cluster sharing reports to either a Debian desktop by way of notification or on mobile or both ways. + +While I have shared about Raspberry Pi, there are loads of single-board computers on the market already and lot more coming, both from MIPS as well as OpenRISC-V so there is going to plenty of competition in the days ahead. + +Also, OpenRISC-V is and would be open-sourcing lot of its IP so non-free firmware or binary blobs would not be needed. Even MIPS is rumored to be more open which may challenge ARM if MIPS and OpenRISC-V are able to get their logistics and pricing right, but that is a story for another day. + +There are many more vendors, I am just sharing the ones whom I am most interested to see what they come up with. + +I hope the above sheds some light why it makes sense to have Debian on the Raspberry Pi. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/debian-raspberry-pi + +作者:[Shirish][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/shirish/ +[b]: https://github.com/lujun9972 +[1]: https://www.raspberrypi.org/downloads/raspbian/ +[2]: https://itsfoss.com/reasons-why-i-love-debian/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/debian-raspberry-pi.png?resize=800%2C450&ssl=1 +[4]: https://wiki.debian.org/RaspberryPi3 +[5]: https://gwolf.org/node/4139 +[6]: https://www.debian.org/ +[7]: https://itsfoss.com/checksum-tools-guide-linux/ +[8]: https://github.com/Debian/raspi3-image-spec +[9]: https://lists.debian.org/debian-arm/2019/02/threads.html +[10]: https://alioth-lists.debian.net/pipermail/pkg-raspi-maintainers/Week-of-Mon-20190225/000310.html +[11]: https://itsfoss.com/riot-desktop/ +[12]: https://liw.fi/vmdb2/ +[13]: https://wiki.debian.org/Arm64Port +[14]: https://raspi.farm/ +[15]: https://wiki.debian.org/RaspberryPi3 From 92aaee54ad9047e0822b0be038c3ad6c11d82532 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 12:53:26 +0800 Subject: [PATCH 104/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190305=205=20Wa?= =?UTF-8?q?ys=20To=20Generate=20A=20Random/Strong=20Password=20In=20Linux?= =?UTF-8?q?=20Terminal=20sources/tech/20190305=205=20Ways=20To=20Generate?= =?UTF-8?q?=20A=20Random-Strong=20Password=20In=20Linux=20Terminal.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...andom-Strong Password In Linux Terminal.md | 366 ++++++++++++++++++ 1 file changed, 366 insertions(+) create mode 100644 sources/tech/20190305 5 Ways To Generate A Random-Strong Password In Linux Terminal.md diff --git a/sources/tech/20190305 5 Ways To Generate A Random-Strong Password In Linux Terminal.md b/sources/tech/20190305 5 Ways To Generate A Random-Strong Password In Linux Terminal.md new file mode 100644 index 0000000000..0f12c53e56 --- /dev/null +++ b/sources/tech/20190305 5 Ways To Generate A Random-Strong Password In Linux Terminal.md @@ -0,0 +1,366 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 Ways To Generate A Random/Strong Password In Linux Terminal) +[#]: via: (https://www.2daygeek.com/5-ways-to-generate-a-random-strong-password-in-linux-terminal/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +5 Ways To Generate A Random/Strong Password In Linux Terminal +====== + +Recently we had written an article about **[password strength and password score check][1]** in our website. + +It will help you to validate your password strength and score. + +We can manually create few passwords which we required but if you would like to generate a password for multiple users or servers, what will be the solution. + +Yes, there are many utilities are available in Linux to fulfill this requirements. However, I’m going to include the best five password generators in this article. + +These tools are generates a strong random passwords for you. Navigate to the following article if you would like to update the password on multiple users and servers. + +These tools are easy to use, that’s why i preferred to go with it. By default it will generate a strong password and if you would like to generate a super strong password then use the available options. + +It will help you to generate a super strong password in the following combination. It should have minimum 12-15 characters length, that includes Alphabets (Lower case & Upper case), Numbers and Special Characters. + +These tools are below. + + * `pwgen:` The pwgen program generates passwords which are designed to be easily memorized by humans, while being as secure as possible. + * `openssl:` The openssl program is a command line tool for using the various cryptography functions of OpenSSL’s crypto library from the shell. + * `gpg:` OpenPGP encryption and signing tool + * `mkpasswd:` generate new password, optionally apply it to a user + * `makepasswd:` makepasswd generates true random passwords using /dev/urandom, with the emphasis on security over pronounceability. + * `/dev/urandom file:` The character special files /dev/random and /dev/urandom (present since Linux 1.3.30) provide an interface to the kernel’s random number generator. + * `md5sum:` md5sum is a computer program that calculates and verifies 128-bit MD5 hashes. + * `sha256sum:` The program sha256sum is designed to verify data integrity using the SHA-256 (SHA-2 family with a digest length of 256 bits). + * `sha1pass:` sha1pass creates a SHA1 password hash. In the absence of a salt value on the command line, a random salt vector will be generated. + + + +### How To Generate A Random Strong Password In Linux Using pwgen Command? + +The pwgen program generates passwords which are designed to be easily memorized by humans, while being as secure as possible. + +Human-memorable passwords are never going to be as secure as completely completely random passwords. + +Use `-s` option to generate completely random, hard-to-memorize passwords. These should only be used for machine passwords as we can’t memorize. + +For **`Fedora`** system, use **[DNF Command][2]** to install pwgen. + +``` +$ sudo dnf install pwgen +``` + +For **`Debian/Ubuntu`** systems, use **[APT-GET Command][3]** or **[APT Command][4]** to install pwgen. + +``` +$ sudo apt install pwgen +``` + +For **`Arch Linux`** based systems, use **[Pacman Command][5]** to install pwgen. + +``` +$ sudo pacman -S pwgen +``` + +For **`RHEL/CentOS`** systems, use **[YUM Command][6]** to install pwgen. + +``` +$ sudo yum install pwgen +``` + +For **`openSUSE Leap`** system, use **[Zypper Command][7]** to install pwgen. + +``` +$ sudo zypper install pwgen +``` + +### How To Use pwgen Command In Linux? + +It’s a simple and straight forward method. Use one of the below preferred examples for you. By default, it generates a human memorable password. + +To do so, simple run the `pwgen` command on your terminal. It generates 160 passwords in a single shot. These 160 passwords are printer with 20 rows and 8 columns. + +``` +$ pwgen +ameiK2oo aibi3Cha EPium0Ie aisoh1Ee Nidee9ae uNga0Bee uPh9ieM1 ahn1ooNg +oc5ooTea tai7eKid tae2yieS hiecaiR8 wohY2Ohk Uab2maed heC4aXoh Ob6Nieso +Shaeriu3 uy9Juk5u hoht7Doo Fah6yah3 faz9Jeew eKiek4ju as0Xuosh Eiwo4epo +oot8teeZ Ui1yoohi Aechae7A Ohdi2ael cae5Thoh Au1aeTei ais0aiC2 Cai2quin +Oox9ohz4 neev0Che ahza8AQu Ahz7eica meiBeeW0 Av3bo7ah quoiTu3f taeNg3ae +Aiko7Aiz SheiGh8E aesaeSh7 haet6Loo AeTel3oN Ath7zeer IeYah4ie UG3ootha +Ohch9Och Phuap6su iel5Xu7s diqui7Bu ieF2dier eeluHa1u Thagei0i Ceeth3oh +OCei1ahj zei2aiYo Jahgh1ia ooqu1Cej eez2aiPo Wahd5soo noo7Mei9 Hie5ashe +Uith4Or2 Xie3uh2b fuF9Eilu eiN2sha9 zae2YaSh oGh5ephi ohvao4Ae aixu6aeM +fo4Ierah iephei6A hae9eeGa eiBeiY3g Aic8Kee9 he8AheCh ohM4bid9 eemae3Zu +eesh2EiM cheiGa4j PooV2vii ahpeeg5E aezauX2c Xe7aethu Ahvaph7a Joh2heec +Ii5EeShi aij7Uo8e ooy2Ahth mieKe2ni eiQuu8fe giedaQu0 eiPhob3E oox1uo2U +eehia4Hu ga9Ahw0a ohxuZei7 eV4OoXio Kid2wu1n ku4Ahf5s uigh8uQu AhWoh0po +vo1Eeb2u Ahth7ve5 ieje4eiL ieci1Ach Meephie9 iephieY8 Eesoom7u eakai2Bo +uo8Ieche Zai3aev5 aGhahf0E Wowoo5th Oraeb0ah Gah3nah0 ieGhah0p aeCh0OhJ +ahQu2feZ ahQu0gah foik7Ush cei1Wai1 Aivi3ooY eephei5U MooZae3O quooRoh7 +aequae5U pae6Ceiv eizahF1k ohmi7ETa ahyaeK1N Mohw2no8 ooc8Oone coo7Ieve +eePhei9h Weequ8eV Vie4iezu neeMiim4 ie6aiZoh Queegh2E shahwi3N Inichie8 +Sid1aeji mohj4Ko7 lieDi0pe Zeemah6a thuevu2E phi4Ohsh paiKeix1 ooz1Ceph +ahV4yore ue2laePh fu1eThui qui7aePh Fahth1nu ohk9puLo aiBeez0b Neengai5 +``` + +To generate a secure random password, use `-s` option with pwgen command. + +``` +$ pwgen -s +CU75lgZd 7HzzKgtA 2ktBJDpR F6XJVhBs UjAm3bNL zO7Dw7JJ pxn8fUvp Ka3lLilG +ywJX7iJl D9ajxb6N 78c1HOg2 g8vtWCra Jp6pBGBw oYuev9Vl gbA6gHV8 G6XQoVO5 +uQN98IU4 50GgQfrX FrTsou2t YQorO4x6 UGer8Yi2 O7DB5nw1 1ax370UR 1xVRPkA1 +RVaGDr2i Nt11ekUd 9Vm3D244 ck8Lnpd0 SjDt8uWn 5ERT4tf8 4EONFzyY Jc6T83jg +WZa6bKPW H4HMo1YU bsDDRik3 gBwV7LOW 9H1QRQ4x 3Ak7RcSe IJu2RBF9 e508xrLC +SzTrW191 AslxDa6E IkWWov2b iOb6EmTy qHt82OwG 5ZFO7B53 97zmjOPu A4KZuhYV +uQpoJR4D 0eKyOiUr Rz96smeO 3HTABu3N 6W0VmEls uPsp5zpw 8UD3VkMG YTct6Rd4 +VKo0cVmq E07ZX7j9 kQSlvA69 Nm3fpv3i xWvF2xMu yEfcw8uA oQGVX3l9 grTzx7Xj +s4GVEYtM uJl5sYMe n3icRPiY ED3Mup4B k3M9KHI7 IkxqoSM0 dt2cxmMU yb2tUkut +2Q9wGZQx 8Rpo11s9 I13siOHu 7GV64Fjv 3VONzD8i SCDfVD3F oiPTx239 6BQakoiJ +XUEokiC4 ybL7VGmL el2RfvWk zKc7CLcE 3FqNBSyA NjDWrvZ5 KI3NSX4h VFyo6VPr +h4q3XeqZ FDYMoX6f uTU5ZzU3 6u4ob4Ep wiYPt05n CZga66qh upzH6Z9y RuVcqbe8 +taQv11hq 1xsY67a8 EVo9GLXA FCaDLGb1 bZyh0YN8 0nTKo0Qy RRVUwn9t DuU8mwwv +x96LWpCb tFLz3fBG dNb4gCKf n6VYcOiH 1ep6QYFZ x8kaJtrY 56PDWuW6 1R0If4kV +2XK0NLQK 4XQqhycl Ip08cn6c Bnx9z2Bz 7gjGlON7 CJxLR1U4 mqMwir3j ovGXWu0z +MfDjk5m8 4KwM9SAN oz0fZ5eo 5m8iRtco oP5BpLh0 Z5kvwr1W f34O2O43 hXao1Sp8 +tKoG5VNI f13fuYvm BQQn8MD3 bmFSf6Mf Z4Y0o17U jT4wO1DG cz2clBES Lr4B3qIY +ArKQRND6 8xnh4oIs nayiK2zG yWvQCV3v AFPlHSB8 zfx5bnaL t5lFbenk F2dIeBr4 +C6RqDQMy gKt28c9O ZCi0tQKE 0Ekdjh3P ox2vWOMI 14XF4gwc nYA0L6tV rRN3lekn +lmwZNjz1 4ovmJAr7 shPl9o5f FFsuNwj0 F2eVkqGi 7gw277RZ nYE7gCLl JDn05S5N +``` + +If you would like to generate a strong five passwords with 14 characters length, use the following format. + +``` +$ pwgen -s 14 5 +7YxUwDyfxGVTYD em2NT6FceXjPfT u8jlrljbrclcTi IruIX3Xu0TFXRr X8M9cB6wKNot1e +``` + +If you really want to generate a super strong random twenty passwords, use the following format. + +``` +$ pwgen -cnys 14 20 +mQ3E=vfGfZ,5[B #zmj{i5|ZS){jg Ht_8i7OqJ%N`~2 443fa5iJ\W-L?] ?Qs$o=vz2vgQBR +^'Ry0Az|J9p2+0 t2oA/n7U_'|QRx EsX*%_(4./QCRJ ACr-,8yF9&eM[* !Xz1C'bw?tv50o +8hfv-fK(VxwQGS q!qj?sD7Xmkb7^ N#Zp\_Y2kr%!)~ 4*pwYs{bq]Hh&Y |4u=-Q1!jS~8=; +]{$N#FPX1L2B{h I|01fcK.z?QTz" l~]JD_,W%5bp.E +i2=D3;BQ}p+$I n.a3,.D3VQ3~&i +``` + +### How To Generate A Random Strong Password In Linux Using openssl Command? + +The openssl program is a command line tool for using the various cryptography functions of OpenSSL’s crypto library from the shell. + +Run the openssl command with the following format to generate a random strong password with 14 characters. + +``` +$ openssl rand -base64 14 +WjzyDqdkWf3e53tJw/c= +``` + +If you would like to generate ten random strong password with 14 characters using openssl command then use the following for loop. + +``` +$ for pw in {1..10}; do openssl rand -base64 14; done +6i0hgHDBi3ohZ9Mil8I= +gtn+y1bVFJFanpJqWaA= +rYu+wy+0nwLf5lk7TBA= +xrdNGykIzxaKDiLF2Bw= +cltejRkDPdFPC/zI0Pg= +G6aroK6d4xVVYFTrZGs= +jJEnFoOk1+UTSx/wJrY= +TFxVjBmLx9aivXB3yxE= +oQtOLPwTuO8df7dIv9I= +ktpBpCSQFOD+5kIIe7Y= +``` + +### How To Generate A Random Strong Password In Linux Using gpg Command? + +gpg is the OpenPGP part of the GNU Privacy Guard (GnuPG). It is a tool to provide digital encryption and signing services using the OpenPGP standard. gpg features complete key management and all the bells and whistles you would expect from a full OpenPGP implementation. + +Run the gpg command with the following format to generate a random strong password with 14 characters. + +``` +$ gpg --gen-random --armor 1 14 +or +$ gpg2 --gen-random --armor 1 14 +jq1mtY4gBa6gIuJrggM= +``` + +If you would like to generate ten random strong password with 14 characters using gpg command then use the following for loop. + +``` +$ for pw in {1..10}; do gpg --gen-random --armor 1 14; done +or +$ for pw in {1..10}; do gpg2 --gen-random --armor 1 14; done +F5ZzLSUMet2kefG6Ssc= +8hh7BFNs8Qu0cnrvHrY= +B+PEt28CosR5xO05/sQ= +m21bfx6UG1cBDzVGKcE= +wALosRXnBgmOC6+++xU= +TGpjT5xRxo/zFq/lNeg= +ggsKxVgpB/3aSOY15W4= +iUlezWxL626CPc9omTI= +pYb7xQwI1NTlM2rxaCg= +eJjhtA6oHhBrUpLY4fM= +``` + +### How To Generate A Random Strong Password In Linux Using mkpasswd Command? + +mkpasswd generates passwords and can apply them automatically to users. With no arguments, mkpasswd returns a new password. It’s part of an expect package so, you have to install expect package to use mkpasswd command. + +For **`Fedora`** system, use **[DNF Command][2]** to install mkpasswd. + +``` +$ sudo dnf install expect +``` + +For **`Debian/Ubuntu`** systems, use **[APT-GET Command][3]** or **[APT Command][4]** to install mkpasswd. + +``` +$ sudo apt install expect +``` + +For **`Arch Linux`** based systems, use **[Pacman Command][5]** to install mkpasswd. + +``` +$ sudo pacman -S expect +``` + +For **`RHEL/CentOS`** systems, use **[YUM Command][6]** to install mkpasswd. + +``` +$ sudo yum install expect +``` + +For **`openSUSE Leap`** system, use **[Zypper Command][7]** to install mkpasswd. + +``` +$ sudo zypper install expect +``` + +Run the `mkpasswd` command in terminal to generate a random password. + +``` +$ mkpasswd +37_slQepD +``` + +Run the mkpasswd command with the following format to generate a random strong password with 14 characters. + +``` +$ mkpasswd -l 14 +W1qP1uv=lhghgh +``` + +Run the mkpasswd command with the following format to generate a random strong password with 14 characters. It combinations of alphabetic (Lower & Upper case), Numeric number and special characters. + +``` +$ mkpasswd -l 14 -d 3 -C 3 -s 3 +3aad!bMWG49"t, +``` + +If you would like to generate ten random strong password with 14 characters (It combination of alphabetic (Lower & Upper case), Numeric number and special characters) using mkpasswd command then use the following for loop. + +``` +$ for pw in {1..10}; do mkpasswd -l 14 -d 3 -C 3 -s 3; done +zmSwP[q9;P1r6[ +E42zcvzM"i3%B\ +8}1#[email protected] +0X:zB(mmU22?nj +0sqqL44M}ko(O^ +43tQ(.6jG;ceRq +-jB6cp3x1GZ$e= +$of?Rj9kb2N(1J +9HCf,nn#gjO79^ +Tu9m56+Ev_Yso( +``` + +### How To Generate A Random Strong Password In Linux Using makepasswd Command? + +makepasswd generates true random passwords using /dev/urandom, with the emphasis on security over pronounceability. It can also encrypt plaintext passwords given on the command line. + +Run the `makepasswd` command in terminal to generate a random password. + +``` +$ makepasswd +HdCJafVaN +``` + +Run the makepasswd command with the following format to generate a random strong password with 14 characters. + +``` +$ makepasswd --chars 14 +HxJDv5quavrqmU +``` + +Run the makepasswd command with the following format to generate ten random strong password with 14 characters. + +``` +$ makepasswd --chars 14 --count 10 +TqmKVWnRGeoVNr +mPV2P98hLRUsai +MhMXPwyzYi2RLo +dxMGgLmoFpYivi +8p0G7JvJjd6qUP +7SmX95MiJcQauV +KWzrh5npAjvNmL +oHPKdq1uA9tU85 +V1su9GjU2oIGiQ +M2TMCEoahzLNYC +``` + +### How To Generate A Random Strong Password In Linux Using Multiple Commands? + +Still if you are looking other options then you can use the following utilities to generate a random password in Linux. + +**Using md5sum:** md5sum is a computer program that calculates and verifies 128-bit MD5 hashes. + +``` +$ date | md5sum +9baf96fb6e8cbd99601d97a5c3acc2c4 - +``` + +**Using /dev/urandom:** The character special files /dev/random and /dev/urandom (present since Linux 1.3.30) provide an interface to the kernel’s random number generator. File /dev/random has major device number 1 and minor device number 8. File /dev/urandom has major device number 1 and minor device number 9. + +``` +$ cat /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c 14 +15LQB9J84Btnzz +``` + +**Using sha256sum:** The program sha256sum is designed to verify data integrity using the SHA-256 (SHA-2 family with a digest length of 256 bits). + +``` +$ date | sha256sum +a114ae5c458ae0d366e1b673d558d921bb937e568d9329b525cf32290478826a - +``` + +**Using sha1pass:** sha1pass creates a SHA1 password hash. In the absence of a salt value on the command line, a random salt vector will be generated. + +``` +$ sha1pass +$4$9+JvykOv$e7U0jMJL2yBOL+RVa2Eke8SETEo$ +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/5-ways-to-generate-a-random-strong-password-in-linux-terminal/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/how-to-check-password-complexity-strength-and-score-in-linux/ +[2]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/ +[3]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[4]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[5]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ +[6]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ +[7]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ From 1ded72a0b5cc165daa2eedc6257a3f15db2f4e7a Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 12:57:43 +0800 Subject: [PATCH 105/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190304=20Learn?= =?UTF-8?q?=20Linux=20with=20the=20Raspberry=20Pi=20sources/tech/20190304?= =?UTF-8?q?=20Learn=20Linux=20with=20the=20Raspberry=20Pi.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...90304 Learn Linux with the Raspberry Pi.md | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 sources/tech/20190304 Learn Linux with the Raspberry Pi.md diff --git a/sources/tech/20190304 Learn Linux with the Raspberry Pi.md b/sources/tech/20190304 Learn Linux with the Raspberry Pi.md new file mode 100644 index 0000000000..079e42dbc1 --- /dev/null +++ b/sources/tech/20190304 Learn Linux with the Raspberry Pi.md @@ -0,0 +1,53 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Learn Linux with the Raspberry Pi) +[#]: via: (https://opensource.com/article/19/3/learn-linux-raspberry-pi) +[#]: author: (Andersn Silva https://opensource.com/users/ansilva) + +Learn Linux with the Raspberry Pi +====== +The fourth article in our guide to getting started with the Raspberry Pi dives into the Linux command line. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/command_line_prompt.png?itok=wbGiJ_yg) + +In the [third article][1] in this series on getting started with Raspberry Pi, I shared info on installing Raspbian, the official version of Linux for Raspberry Pi. Now that you've installed Raspbian and booted up your new Pi, you're ready to start learning about Linux. + +It's impossible to tackle a topic as big as "how to use Linux" in a short article like this, so instead I'll give you some ideas about how you can use the Raspberry Pi to learn more about Linux in general. + +Start by spending time on the command line (aka the "terminal"). Linux [window managers][2] and graphical interfaces have come a long way since the mid-'90s. Nowadays you can use Linux by pointing-and-clicking on things, just as easily as you can in other operating systems. In my opinion, there is a difference between just "using Linux" and being "a Linux user," and the latter means at a minimum being able to navigate in the terminal. + +![](https://opensource.com/sites/default/files/uploads/man-terminal.png) + +If you want to become a Linux user, start by trying out the following on the command line: + + * Navigate your home directory with commands like **ls** , **cd** , and **pwd**. + * Create, delete, and rename directories using the **mkdir** , **rm** , **mv** , and **cp** commands. + * Create a text file with a command line editor such as Vi, Vim, Emacs, or Nano. + * Try out some other useful commands, such as **chmod** , **chown** , **w** , **cat** , **more** , **less** , **tail** , **free** , **df** , **ps** , **uname** , and **kill** + * Look around **/bin** and **/usr/bin** for other commands. + + + +The best way to get help with a command is by reading its "man page" (short for manual); type **man ** on the command line to pull it up. And make sure to search the internet for Linux command cheat sheets—you should find a lot of options that will help you learn. + +Raspbian, like most Linux distributions, has many commands and over time you will end up using some commands a lot more than others. I've been using Linux on the command line for over two decades, and there are still some commands that I've never used, even ones that have been around as long as I've been using Linux. + +At the end of the day, you can use your graphical interface environment to get work done faster, but make sure to dive into the Linux command line, for that's where you will get the true power and knowledge of the operating system. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/learn-linux-raspberry-pi + +作者:[Andersn Silva][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ansilva +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/19/2/how-boot-new-raspberry-pi +[2]: https://opensource.com/article/18/8/window-manager From 1bf6f5a8e063de670de838f6b4d3096b35d3c3d3 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 13:00:51 +0800 Subject: [PATCH 106/796] =?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 107/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190301=20How=20?= =?UTF-8?q?to=20use=20sudo=20access=20in=20winSCP=20sources/tech/20190301?= =?UTF-8?q?=20How=20to=20use=20sudo=20access=20in=20winSCP.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...190301 How to use sudo access in winSCP.md | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 sources/tech/20190301 How to use sudo access in winSCP.md diff --git a/sources/tech/20190301 How to use sudo access in winSCP.md b/sources/tech/20190301 How to use sudo access in winSCP.md new file mode 100644 index 0000000000..750c37e318 --- /dev/null +++ b/sources/tech/20190301 How to use sudo access in winSCP.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to use sudo access in winSCP) +[#]: via: (https://kerneltalks.com/tools/how-to-use-sudo-access-in-winscp/) +[#]: author: (kerneltalks https://kerneltalks.com) + +How to use sudo access in winSCP +====== + +Learn how to use sudo access in winSCP with screenshots. + +![How to use sudo access in winSCP][1]sudo access in winSCP + +First of all you need to check where is your SFTP server binary located on server you are trying to connect with winSCP. + +You can check SFTP server binary location with below command – + +``` +[root@kerneltalks ~]# cat /etc/ssh/sshd_config |grep -i sftp-server +Subsystem sftp /usr/libexec/openssh/sftp-server +``` + +Here you can see sftp server binary is located at `/usr/libexec/openssh/sftp-server` + +Now open winSCP and click `Advanced` button to open up advanced settings. + +![winSCP advance settings][2] +winSCP advance settings + +It will open up advanced setting window like one below. Here select `SFTP `under `Environment` on left hand side panel. You will be presented with option on right hand side. + +Now, add SFTP server value here with command `sudo su -c` here as displayed in screenshot below – + +![SFTP server setting in winSCP][3] +SFTP server setting in winSCP + +So we added `sudo su -c /usr/libexec/openssh/sftp-server` in settings here. Now click Ok and connect to server as you normally do. + +After connection you will be able to transfer files from directory where you normally need sudo permission to access. + +That’s it! You logged to server using winSCP and sudo access. + +-------------------------------------------------------------------------------- + +via: https://kerneltalks.com/tools/how-to-use-sudo-access-in-winscp/ + +作者:[kerneltalks][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://kerneltalks.com +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/kerneltalks.com/wp-content/uploads/2019/03/How-to-use-sudo-access-in-winSCP.png?ssl=1 +[2]: https://i0.wp.com/kerneltalks.com/wp-content/uploads/2019/03/winscp-advanced-settings.jpg?ssl=1 +[3]: https://i1.wp.com/kerneltalks.com/wp-content/uploads/2019/03/SFTP-server-setting-in-winSCP.jpg?ssl=1 From c20d2b40c0e64ea77b2d805a83b12d82af73614d Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Wed, 6 Mar 2019 13:30:03 +0800 Subject: [PATCH 108/796] 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 109/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190304=20How=20?= =?UTF-8?q?to=20Install=20MongoDB=20on=20Ubuntu=20sources/tech/20190304=20?= =?UTF-8?q?How=20to=20Install=20MongoDB=20on=20Ubuntu.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...190304 How to Install MongoDB on Ubuntu.md | 238 ++++++++++++++++++ 1 file changed, 238 insertions(+) create mode 100644 sources/tech/20190304 How to Install MongoDB on Ubuntu.md diff --git a/sources/tech/20190304 How to Install MongoDB on Ubuntu.md b/sources/tech/20190304 How to Install MongoDB on Ubuntu.md new file mode 100644 index 0000000000..5dad6b0b54 --- /dev/null +++ b/sources/tech/20190304 How to Install MongoDB on Ubuntu.md @@ -0,0 +1,238 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Install MongoDB on Ubuntu) +[#]: via: (https://itsfoss.com/install-mongodb-ubuntu) +[#]: author: (Sergiu https://itsfoss.com/author/sergiu/) + +How to Install MongoDB on Ubuntu +====== + +**This tutorial presents two ways to install MongoDB on Ubuntu and Ubuntu-based Linux distributions.** + +[MongoDB][1] is an increasingly popular free and open-source NoSQL database that stores data in collections of JSON-like, flexible documents, in contrast to the usual table approach you’ll find in SQL databases. + +You are most likely to find MongoDB used in modern web applications. Its document model makes it very intuitive to access and handle with various programming languages. + +![mongodb Ubuntu][2] + +In this article, I’ll cover two ways you can install MongoDB on your Ubuntu system. + +### Installing MongoDB on Ubuntu based Distributions + + 1. Install MongoDB using Ubuntu’s repository. Easy but not the latest version of MongoDB + 2. Install MongoDB using its official repository. Slightly complicated but you get the latest version of MongoDB. + + + +The first installation method is easier, but I recommend the second method if you plan on using the latest release with official support. + +Some people might prefer using snap packages. There are snaps available in the Ubuntu Software Center, but I wouldn’t recommend using them; they’re outdated at the moment and I won’t be covering that. + +#### Method 1. Install MongoDB from Ubuntu Repository + +This is the easy way to install MongoDB on your system, you only need to type in a simple command. + +##### Installing MongoDB + +First, make sure your packages are up-to-date. Open up a terminal and type: + +``` +sudo apt update && sudo apt upgrade -y +``` + +Go ahead and install MongoDB with: + +``` +sudo apt install mongodb +``` + +That’s it! MongoDB is now installed on your machine. + +The MongoDB service should automatically be started on install, but to check the status type + +``` +sudo systemctl status mongodb +``` + +![Check if the MongoDB service is running.][3] + +You can see that the service is **active**. + +##### Running MongoDB + +MongoDB is currently a systemd service, so we’ll use **systemctl** to check and modify it’s state, using the following commands: + +``` +sudo systemctl status mongodb +sudo systemctl stop mongodb +sudo systemctl start mongodb +sudo systemctl restart mongodb +``` + +You can also change if MongoDB automatically starts when the system starts up ( **default** : enabled): + +``` +sudo systemctl disable mongodb +sudo systemctl enable mongodb +``` + +To start working with (creating and editing) databases, type: + +``` +mongo +``` + +This will start up the **mongo shell**. Please check out the [manual][4] for detailed information on the available queries and options. + +**Note:** Depending on how you plan to use MongoDB, you might need to adjust your Firewall. That’s unfortunately more involved than what I can cover here and depends on your configuration. + +##### Uninstall MongoDB + +If you installed MongoDB from the Ubuntu Repository and want to uninstall it (maybe to install using the officially supported way), type: + +``` +sudo systemctl stop mongodb +sudo apt purge mongodb +sudo apt autoremove +``` + +This should completely get rid of your MongoDB install. Make sure to **backup** any collections or documents you might want to keep since they will be wiped out! + +#### Method 2. Install MongoDB Community Edition on Ubuntu + +This is the way the recommended way to install MongoDB, using the package manager. You’ll have to type a few more commands and it might be intimidating if you are newer to the Linux world. + +But there’s nothing to be afraid of! We’ll go through the installation process step by step. + +##### Installing MongoDB + +The package maintained by MongoDB Inc. is called **mongodb-org** , not **mongodb** (this is the name of the package in the Ubuntu Repository). Make sure **mongodb** is not installed on your system before applying this steps. The packages will conflict. Let’s get to it! + +First, we’ll have to import the public key: + +``` +sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4 +``` + +Now, you need to add a new repository in your sources list so that you can install MongoDB Community Edition and also get automatic updates: + +``` +echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu $(lsb_release -cs)/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list +``` + +To be able to install **mongodb-org** , we’ll have to update our package database so that your system is aware of the new packages available: + +``` +sudo apt update +``` + +Now you can ether install the **latest stable version** of MongoDB: + +``` +sudo apt install -y mongodb-org +``` + +or a **specific version** (change the version number after **equal** sign) + +``` +sudo apt install -y mongodb-org=4.0.6 mongodb-org-server=4.0.6 mongodb-org-shell=4.0.6 mongodb-org-mongos=4.0.6 mongodb-org-tools=4.0.6 +``` + +If you choose to install a specific version, make sure you change the version number everywhere. If you only change it in the **mongodb-org=4.0.6** part, the latest version will be installed. + +By default, when updating using the package manager ( **apt-get** ), MongoDB will be updated to the newest updated version. To stop that from happening (and freezing to the installed version), use: + +``` +echo "mongodb-org hold" | sudo dpkg --set-selections +echo "mongodb-org-server hold" | sudo dpkg --set-selections +echo "mongodb-org-shell hold" | sudo dpkg --set-selections +echo "mongodb-org-mongos hold" | sudo dpkg --set-selections +echo "mongodb-org-tools hold" | sudo dpkg --set-selections +``` + +You have now successfully installed MongoDB! + +##### Configuring MongoDB + +By default, the package manager will create **/var/lib/mongodb** and **/var/log/mongodb** and MongoDB will run using the **mongodb** user account. + +I won’t go into changing these default settings since that is beyond the scope of this guide. You can check out the [manual][5] for detailed information. + +The settings in **/etc/mongod.conf** are applied when starting/restarting the **mongodb** service instance. + +##### Running MongoDB + +To start the mongodb daemon **mongod** , type: + +``` +sudo service mongod start +``` + +Now you should verify that the **mongod** process started successfully. This information is stored (by default) at **/var/log/mongodb/mongod.log**. Let’s check the contents of that file: + +``` +sudo cat /var/log/mongodb/mongod.log +``` + +![Check MongoDB logs to see if the process is running properly.][6] + +As long as you get this: **[initandlisten] waiting for connections on port 27017** somewhere in there, the process is running properly. + +**Note: 27017** is the default port of **mongod.** + +To stop/restart **mongod** enter: + +``` +sudo service mongod stop +sudo service mongod restart +``` + +Now, you can use MongoDB by opening the **mongo shell** : + +``` +mongo +``` + +##### Uninstall MongoDB + +Run the following commands + +``` +sudo service mongod stop +sudo apt purge mongodb-org* +``` + +To remove the **databases** and **log files** (make sure to **backup** what you want to keep!): + +``` +sudo rm -r /var/log/mongodb +sudo rm -r /var/lib/mongodb +``` + +**Wrapping Up** + +MongoDB is a great NoSQL database, easy to integrate into modern projects. I hope this tutorial helped you to set it up on your Ubuntu machine! Let us know how you plan on using MongoDB in the comments below. + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-mongodb-ubuntu + +作者:[Sergiu][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/sergiu/ +[b]: https://github.com/lujun9972 +[1]: https://www.mongodb.com/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/mongodb-ubuntu.jpeg?resize=800%2C450&ssl=1 +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/mongodb_check_status.jpg?fit=800%2C574&ssl=1 +[4]: https://docs.mongodb.com/manual/tutorial/getting-started/ +[5]: https://docs.mongodb.com/manual/ +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/mongodb_org_check_logs.jpg?fit=800%2C467&ssl=1 From c38904c25bf786e21934e25b65afdd8d9097e563 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 15:47:43 +0800 Subject: [PATCH 110/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190302=20How=20?= =?UTF-8?q?to=20buy=20a=20Raspberry=20Pi=20sources/tech/20190302=20How=20t?= =?UTF-8?q?o=20buy=20a=20Raspberry=20Pi.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20190302 How to buy a Raspberry Pi.md | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 sources/tech/20190302 How to buy a Raspberry Pi.md diff --git a/sources/tech/20190302 How to buy a Raspberry Pi.md b/sources/tech/20190302 How to buy a Raspberry Pi.md new file mode 100644 index 0000000000..974a6b75fb --- /dev/null +++ b/sources/tech/20190302 How to buy a Raspberry Pi.md @@ -0,0 +1,51 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to buy a Raspberry Pi) +[#]: via: (https://opensource.com/article/19/3/how-buy-raspberry-pi) +[#]: author: (Anderson Silva https://opensource.com/users/ansilva) + +How to buy a Raspberry Pi +====== +Find out the best ways to get a Raspberry Pi in the second article in our getting started guide + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/open_business_sign_store.jpg?itok=g4QibRqg) + +The first article in this series on getting started with Raspberry Pi offered some advice on [which model you should buy][1]. Now that you have an idea of which version you want, let's find out how to get one. + +The most obvious—and probably the safest and simplest—way is through the [official Raspberry Pi website][2]. If you click on "Buy a Raspberry Pi" from the homepage, you'll be taken to the organization's [online store][3], where you can find authorized Raspberry Pi sellers in your country where you can place an order. If your country isn't listed, there is a "Rest of the World" option, which should let you put in an international order. + +Second, check Amazon.com or another major online technology retailer in your country that allows smaller shops to sell new and used items. Given the relatively low cost and size of the Raspberry Pi, it should be fairly easy for smaller shop owners to import and export the boards for reselling purposes. Before you place an order, keep an eye on the sellers' reviews though. + +Third, ask your geek friends! You never know if someone has an unused Raspberry Pi gathering dust. I have given at least three Raspberry Pis away to family, not as planned gifts, but because they were just so curious about this mini-computer. I had so many lying around that I just told them to keep one! + +### Don't forget the extras + +One final thought: don't forget that you'll need some peripherals to set up and operate your Raspberry Pi. At a minimum, you'll need a keyboard, an HDMI cable to connect to a display (and a display), a Micro SD card to install the operating system, a power cord, and a mouse will be handy, too. + +![](https://opensource.com/sites/default/files/uploads/raspberrypi_2a_pi0w-kit.jpg) + +If you don't already have these items, try borrowing them from friends or order them at the same time you buy your Raspberry Pi. You may want to consider one of the starter kits available from the authorized Raspberry Pi vendors—that will avoid the hassle of searching for parts one at a time. + +![](https://opensource.com/sites/default/files/uploads/raspberrypi_2b_pi3b.jpg) + +Now that you have a Raspberry Pi, in the next article in this series, we'll install the operating system and start using it. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/how-buy-raspberry-pi + +作者:[Anderson Silva][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ansilva +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/19/2/which-raspberry-pi-should-you-get +[2]: https://www.raspberrypi.org/ +[3]: https://www.raspberrypi.org/products/ From a65967215f5f7a6c726e45d61242905607ea1a72 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 15:51:23 +0800 Subject: [PATCH 111/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190303=20Manage?= =?UTF-8?q?=20Your=20Mirrors=20with=20ArchLinux=20Mirrorlist=20Manager=20s?= =?UTF-8?q?ources/tech/20190303=20Manage=20Your=20Mirrors=20with=20ArchLin?= =?UTF-8?q?ux=20Mirrorlist=20Manager.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...rrors with ArchLinux Mirrorlist Manager.md | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 sources/tech/20190303 Manage Your Mirrors with ArchLinux Mirrorlist Manager.md diff --git a/sources/tech/20190303 Manage Your Mirrors with ArchLinux Mirrorlist Manager.md b/sources/tech/20190303 Manage Your Mirrors with ArchLinux Mirrorlist Manager.md new file mode 100644 index 0000000000..7618d3f711 --- /dev/null +++ b/sources/tech/20190303 Manage Your Mirrors with ArchLinux Mirrorlist Manager.md @@ -0,0 +1,94 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Manage Your Mirrors with ArchLinux Mirrorlist Manager) +[#]: via: (https://itsfoss.com/archlinux-mirrorlist-manager) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +Manage Your Mirrors with ArchLinux Mirrorlist Manager +====== + +**ArchLinux Mirrorlist Manager is a simple GUI program that allows you to easily manage mirrors in your Arch Linux system.** + +For Linux users, it is important to make sure that you keep your mirror list in good shape. Today we will take a quick look at an application designed to help manage your Arch mirror list. + +![ArchLinux Mirrorlist Manager][1]ArchLinux Mirrorlist Manager + +### What is a Mirror? + +For those new to the world of Linux, Linux operating systems depend on a series of servers placed around the world. These servers contain identical copies of all of the packages and software available for a particular distro. This is why they are called “mirrors”. + +The ultimate goal is to have multiple mirrors in each country. This allows local users to quickly update their systems. However, this is not always true. Sometimes mirrors from another country can be faster. + +### ArchLinux Mirrorlist Manager makes managing mirrors simpler in Arch Linux + +![ArchLinux Mirrorlist Manager][2]Main Screen + +[Managing and sorting][3] the available mirrors in Arch is not easy. It involves fairly lengthy commands. Thankfully, someone came up with a solution. + +Last year, [Rizwan Hasan][4] created a little Python and Qt application entitled [ArchLinux Mirrorlist Manager][5]. You might recognize Rizwan’s name because it is not the first time that we featured something he created on this site. Over a year ago, I wrote about a new Arch-based distro that Rizwan created named [MagpieOS][6]. I imagine that Rizwan’s experience with MagpieOS inspired him to create this application. + +There really isn’t much to ArchLinux Mirrorlist Manager. It allows you to rank mirrors by response speed and limit the results by number and country of origin. + +In other words, if you are located in Germany, you can restrict your mirrors to the 3 fastest in Germany. + +### Install ArchLinux Mirrorlist Manager + +``` +It is only for Arch Linux users + +Pay attention! ArchLinux Mirrorlist Manager is for Arch Linux distribution only. Don’t try to use it on other Arch-based distributions unless you make sure that the distro uses Arch mirrors. Otherwise, you might face issues that I encountered with Manjaro (explained in the section below). +``` + +``` +Mirrorlist Manager alternative for Manjaro + +When it comes to using something Archy, my go-to system is Manjaro. In preparation for this article, I decided to install ArchLinux Mirrorlist Manager on my Manjaro machine. It quickly sorted the available mirror and saved them to my mirror list. + +I then proceeded to try to update my system and immediately ran into problems. When ArchLinux Mirrorlist Manager sorted the mirrors my system was using, it replaced all of my Manjaro mirrors with vanilla Arch mirrors. (Manjaro is based on Arch, but has its own mirrors because the dev team tests all package updates before pushing them to the users to ensure there are no system-breaking bugs.) Thankfully, the Manjaro forum helped me fix my mistake. + +If you are a Manjaro user, please do not make the same mistake that I did. ArchLinux Mirrorlist Manager is only for Arch and Arch-based distros that use Arch’s mirrors. + +Luckily, there is an easy to use terminal application that Manjaro users can use to manage their mirror lists. It is called [Pacman-mirrors][7]. Just like ArchLinux Mirrorlist Manager, you can sort by response speed. Just type `sudo pacman-mirrors --fasttrack`. If you want to limit the results to the five fastest mirrors, you can type `sudo pacman-mirrors --fasttrack 5`. To restrict the results to one or more countries, type `sudo pacman-mirrors --country Germany,Spain,Austria`. You can limit the results to your country by typing `sudo pacman-mirrors --geoip`. You can visit the [Manjaro wiki][7] for more information about Pacman-mirrors. + +After you run Pacman-mirrors, you have to synchronize your package database and update your system by typing `sudo pacman -Syyu`. + +Note: Pacman-mirrors is for **Manjaro only**. +``` + +ArchLinux Mirrorlist Manager is available in the [Arch User Repository][8]. More advanced Arch users can download the PKGBUILD directly from [the GitHub page][9]. + +### Final Thoughts on ArchLinux Mirrorlist Manager + +Even though [ArchLinux Mirrorlist Manager][5] isn’t very useful for me, I’m glad it exists. It shows that Linux users are actively trying to make Linux easier to use. As I said earlier, managing a mirror list on Arch is not easy. Rizwan’s little tool will help make Arch more usable by the beginning user. + +Have you ever used ArchLinux Mirrorlist Manager? What is your method to manage your Arch mirrors? Please let us know in the comments below. + +If you found this article interesting, please take a minute to share it on social media, Hacker News or [Reddit][10]. + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/archlinux-mirrorlist-manager + +作者:[John Paul][a] +选题:[lujun9972][b] +译者:[lujun9972](https://github.com/lujun9972) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/mirrorlist-manager2.png?ssl=1 +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/mirrorlist-manager4.jpg?ssl=1 +[3]: https://wiki.archlinux.org/index.php/Mirrors +[4]: https://github.com/Rizwan-Hasan +[5]: https://github.com/Rizwan-Hasan/ArchLinux-Mirrorlist-Manager +[6]: https://itsfoss.com/magpieos/ +[7]: https://wiki.manjaro.org/index.php?title=Pacman-mirrors +[8]: https://aur.archlinux.org/packages/mirrorlist-manager +[9]: https://github.com/Rizwan-Hasan/MagpieOS-Packages/tree/master/ArchLinux-Mirrorlist-Manager +[10]: http://reddit.com/r/linuxusersgroup From 56d704d9279070cdbc92169c0a6aad7ece0c5e7d Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 15:53:06 +0800 Subject: [PATCH 112/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190228=20MiyoLi?= =?UTF-8?q?nux:=20A=20Lightweight=20Distro=20with=20an=20Old-School=20Appr?= =?UTF-8?q?oach=20sources/tech/20190228=20MiyoLinux-=20A=20Lightweight=20D?= =?UTF-8?q?istro=20with=20an=20Old-School=20Approach.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ight Distro with an Old-School Approach.md | 161 ++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 sources/tech/20190228 MiyoLinux- A Lightweight Distro with an Old-School Approach.md diff --git a/sources/tech/20190228 MiyoLinux- A Lightweight Distro with an Old-School Approach.md b/sources/tech/20190228 MiyoLinux- A Lightweight Distro with an Old-School Approach.md new file mode 100644 index 0000000000..3217e304cd --- /dev/null +++ b/sources/tech/20190228 MiyoLinux- A Lightweight Distro with an Old-School Approach.md @@ -0,0 +1,161 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (MiyoLinux: A Lightweight Distro with an Old-School Approach) +[#]: via: (https://www.linux.com/blog/learn/2019/2/miyolinux-lightweight-distro-old-school-approach) +[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) + +MiyoLinux: A Lightweight Distro with an Old-School Approach +====== +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/miyo_main.jpg?itok=ErLiqGwp) + +I must confess, although I often wax poetic about the old ways of the Linux desktop, I much prefer my distributions to help make my daily workflow as efficient as possible. Because of that, my taste in Linux desktop distributions veers very far toward the modern side of things. I want a distribution that integrates apps seamlessly, gives me notifications, looks great, and makes it easy to work with certain services that I use. + +However, every so often it’s nice to dip my toes back into those old-school waters and remind myself why I fell in love with Linux in the first place. That’s precisely what [MiyoLinux][1] did for me recently. This lightweight distribution is based on [Devuan][2] and makes use of the [i3 Tiling Window Manager][3]. + +Why is it important that MiyoLinux is based on Devuan? Because that means it doesn’t use systemd. There are many within the Linux community who’d be happy to make the switch to an old-school Linux distribution that opts out of systemd. If that’s you, MiyoLinux might just charm you into submission. + +But don’t think MiyoLinux is going to be as easy to get up and running as, say, Ubuntu Linux, Elementary OS, or Linux Mint. Although it’s not nearly as challenging as Arch or Gentoo, MiyoLinux does approach installation and basic usage a bit differently. Let’s take a look at how this particular distro handles things. + +### Installation + +The installation GUI of MiyoLinux is pretty basic. The first thing you’ll notice is that you are presented with a good amount of notes, regarding the usage of the MiyoLinux desktop. If you happen to be testing MiyoLinux via VirtualBox, you’ll wind up having to deal with the frustration of not being able to resize the window (Figure 1), as the Guest Additions cannot be installed. This also means mouse integration cannot be enabled during the installation, so you’ll have to tab through the windows and use your keyboard cursor keys and Enter key to make selections. + +![MiyoLinux][5] + +Figure 1: The first step in the MiyoLinux installation. + +[Used with permission][6] + +Once you click the Install MiyoLinux button, you’ll be prompted to continue using either ‘su” or sudo. Click the use sudo button to continue with the installation. + +The next screen of importance is the Installation Options window (Figure 2), where you can select various options for MiyoLinux (such as encryption, file system labels, disable automatic login, etc.). + +![Configuration][8] + +Figure 2: Configuration Installation options for MiyoLinux. + +[Used with permission][6] + +The MiyoLinux installation does not include an automatic partition tool. Instead, you’ll be prompted to run either cfdisk or GParted (Figure 3). If you don’t know your way around cfdisk, select GParted and make use of the GUI tool. + +![partitioning ][10] + +Figure 3: Select your partitioning tool for MiyoLinux. + +[Used with permission][6] + +With your disk partitioned (Figure 4), you’ll be required to take care of the following steps: + + * Configure the GRUB bootloader. + + * Select the filesystem for the bootloader. + + * Configure time zone and locales. + + * Configure keyboard, keyboard language, and keyboard layout. + + * Okay the installation. + + + + +Once, you’ve okay’d the installation, all packages will be installed and you will then be prompted to install the bootloader. Following that, you’ll be prompted to configure the following: + + * Hostname. + + * User (Figure 5). + + * Root password. + + + + +With the above completed, reboot and log into your new MiyoLinux installation. + +![hostname][12] + +Figure 5: Configuring hostname and username. + +[Creative Commons Zero][13] + +### Usage + +Once you’ve logged into the MiyoLinux desktop, you’ll find things get a bit less-than-user-friendly. This is by design. You won’t find any sort of mouse menu available anywhere on the desktop. Instead you use keyboard shortcuts to open the different types of menus. The Alt+m key combination will open the PMenu, which is what one would consider a fairly standard desktop mouse menu (Figure 6). + +The Alt+d key combination will open the dmenu, a search tool at the top of the desktop, where you can scroll through (using the cursor keys) or search for an app you want to launch (Figure 7). + +![dmenu][15] + +Figure 7: The dmenu in action. + +[Used with permission][6] + +### Installing Apps + +If you open the PMenu, click System > Synaptic Package Manager. From within that tool you can search for any app you want to install. However, if you find Synaptic doesn’t want to start from the PMenu, open the dmenu, search for terminal, and (once the terminal opens), issue the command sudo synaptic. That will get the package manager open, where you can start installing any applications you want (Figure 8). + +![Synaptic][17] + +Figure 8: The Synaptic Package Manager on MiyoLinux. + +[Used with permission][6] + +Of course, you can always install applications from the command line. MiyoLinux depends upon the Apt package manager, so installing applications is as easy as: + +``` +sudo apt-get install libreoffice -y +``` + +Once installed, you can start the new package from either the PMenu or dmenu tools. + +### MiyoLinux Accessories + +If you find you need a bit more from the MiyoLinux desktop, type the keyboard combination Alt+Ctrl+a to open the MiyoLinux Accessories tool (Figure 9). From this tool you can configure a number of options for the desktop. + +![Accessories][19] + +Figure 9: Configure i3, Conky, Compton, your touchpad, and more with the Accessories tool. + +[Used with permission][6] + +All other necessary keyboard shortcuts are listed on the default desktop wallpaper. Make sure to put those shortcuts to memory, as you won’t get very far in the i3 desktop without them. + +### A Nice Nod to Old-School Linux + +If you’re itching to throw it back to a time when Linux offered you a bit of challenge to your daily grind, MiyoLinux might be just the operating system for you. It’s a lightweight operating system that makes good use of a minimal set of tools. Anyone who likes their distributions to be less modern and more streamlined will love this take on the Linux desktop. However, if you prefer your desktop with the standard bells and whistles, found on modern distributions, you’ll probably find MiyoLinux nothing more than a fun distraction from the standard fare. + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2019/2/miyolinux-lightweight-distro-old-school-approach + +作者:[Jack Wallen][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/users/jlwallen +[b]: https://github.com/lujun9972 +[1]: https://sourceforge.net/p/miyolinux/wiki/Home/ +[2]: https://devuan.org/ +[3]: https://i3wm.org/ +[4]: /files/images/miyo1jpg +[5]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/miyo_1.jpg?itok=5PxRDYRE (MiyoLinux) +[6]: /licenses/category/used-permission +[7]: /files/images/miyo2jpg +[8]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/miyo_2.jpg?itok=svlVr7VI (Configuration) +[9]: /files/images/miyo3jpg +[10]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/miyo_3.jpg?itok=lpNzZBPz (partitioning) +[11]: /files/images/miyo5jpg +[12]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/miyo_5.jpg?itok=lijIsgZ2 (hostname) +[13]: /licenses/category/creative-commons-zero +[14]: /files/images/miyo7jpg +[15]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/miyo_7.jpg?itok=I8Ow3PX6 (dmenu) +[16]: /files/images/miyo8jpg +[17]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/miyo_8.jpg?itok=oa502KfM (Synaptic) +[18]: /files/images/miyo9jpg +[19]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/miyo_9.jpg?itok=gUM4mxEv (Accessories) From 3bad4583b106f65b12207a77a3ec93d6ac6f1e0d Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 16:01:07 +0800 Subject: [PATCH 113/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190302=20Create?= =?UTF-8?q?=20a=20Custom=20System=20Tray=20Indicator=20For=20Your=20Tasks?= =?UTF-8?q?=20on=20Linux=20sources/tech/20190302=20Create=20a=20Custom=20S?= =?UTF-8?q?ystem=20Tray=20Indicator=20For=20Your=20Tasks=20on=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Tray Indicator For Your Tasks on Linux.md | 187 ++++++++++++++++++ 1 file changed, 187 insertions(+) create mode 100644 sources/tech/20190302 Create a Custom System Tray Indicator For Your Tasks on Linux.md diff --git a/sources/tech/20190302 Create a Custom System Tray Indicator For Your Tasks on Linux.md b/sources/tech/20190302 Create a Custom System Tray Indicator For Your Tasks on Linux.md new file mode 100644 index 0000000000..d9d42b7a2f --- /dev/null +++ b/sources/tech/20190302 Create a Custom System Tray Indicator For Your Tasks on Linux.md @@ -0,0 +1,187 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Create a Custom System Tray Indicator For Your Tasks on Linux) +[#]: via: (https://fosspost.org/tutorials/custom-system-tray-icon-indicator-linux) +[#]: author: (M.Hanny Sabbagh https://fosspost.org/author/mhsabbagh) + +Create a Custom System Tray Indicator For Your Tasks on Linux +====== + +System Tray icons are still considered to be an amazing functionality today. By just right-clicking on the icon, and then selecting which actions you would like to take, you may ease your life a lot and save many unnecessary clicks on daily basis. + +When talking about useful system tray icons, examples like Skype, Dropbox and VLC do come to mind: + +![Create a Custom System Tray Indicator For Your Tasks on Linux 11][1] + +However, system tray icons can actually be quite a lot more useful; By simply building one yourself for your own needs. In this tutorial, we’ll explain how to do that for you in very simple steps. + +### Prerequisites + +We are going to build a custom system tray indicator using Python. Python is probably installed by default on all the major Linux distributions, so just check it’s there (version 2.7). Additionally, we’ll need the gir1.2-appindicator3 package installed. It’s the library allowing us to easily create system tray indicators. + +To install it on Ubuntu/Mint/Debian: + +``` +sudo apt-get install gir1.2-appindicator3 +``` + +On Fedora: + +``` +sudo dnf install libappindicator-gtk3 +``` + +For other distributions, just search for any packages containing appindicator. + +On GNOME Shell, system tray icons are removed starting from 3.26. You’ll need to install the [following extension][2] (Or possibly other extensions) to re-enable the feature on your desktop. Otherwise, you won’t be able to see the indicator we are going to create here. + +### Basic Code + +Here’s the basic code of the indicator: + +``` +#!/usr/bin/python +import os +from gi.repository import Gtk as gtk, AppIndicator3 as appindicator + +def main(): + indicator = appindicator.Indicator.new("customtray", "semi-starred-symbolic", appindicator.IndicatorCategory.APPLICATION_STATUS) + indicator.set_status(appindicator.IndicatorStatus.ACTIVE) + indicator.set_menu(menu()) + gtk.main() + +def menu(): + menu = gtk.Menu() + + command_one = gtk.MenuItem('My Notes') + command_one.connect('activate', note) + menu.append(command_one) + + exittray = gtk.MenuItem('Exit Tray') + exittray.connect('activate', quit) + menu.append(exittray) + + menu.show_all() + return menu + +def note(_): + os.system("gedit $HOME/Documents/notes.txt") + +def quit(_): + gtk.main_quit() + +if __name__ == "__main__": + main() +``` + +We’ll explain how the code works later. But for know, just save it in a text file under the name tray.py, and run it using Python: + +``` +python tray.py +``` + +You’ll see the indicator working as follows: + +![Create a Custom System Tray Indicator For Your Tasks on Linux 13][3] + +Now, to explain how we did the magic: + + * The first 3 lines of the code are nothing more than just specifying the Python path and importing the libraries we are going to use in our indicator. + + * def main() : This is the main function of the indicator. Under it we write the code to initialize and build the indicator. + + * indicator = appindicator.Indicator.new(“customtray”, “semi-starred-symbolic”, appindicator.IndicatorCategory.APPLICATION_STATUS) : Here we are specially creating a new indicator and calling it `customtray` . This is the special name of the indicator so that the system doesn’t mix it with other indicators that may be running. Also, we used the `semi-starred-symbolic` icon name as the default icon for our indicator. You could possibly change thing to any other things; Say `firefox` (if you want to see Firefox icon being used for the indicator), or any other icon name you would like. The last part regarding the `APPLICATION_STATUS` is just ordinary code for the categorization/scope of that indicator. + + * `indicator.set_status(appindicator.IndicatorStatus.ACTIVE)` : This line just turns the indicator on. + + * `indicator.set_menu(menu())` : Here, we are saying that we want to use the `menu()` function (which we’ll define later) for creating the menu items of our indicator. This is important so that when you click on the indicator, you can see a list of possible actions to take. + + * `gtk.main()` : Just run the main GTK loop. + + * Under `menu()` you’ll see that we are creating the actions/items we want to provide using our indicator. `command_one = gtk.MenuItem(‘My Notes’)` simply initializes the first menu item with the text “My notes”, and then `command_one.connect(‘activate’, note)` connects the `activate` signal of that menu item to the `note()` function defined later; In other words, we are telling our system here: “When this menu item is clicked, run the note() function”. Finally, `menu.append(command_one)` adds that menu item to the list. + + * The lines regarding `exittray` are just for creating an exit menu item to close the indicator any time you want. + + * `menu.show_all()` and `return menu` are just ordinary codes for returning the menu list to the indicator. + + * Under `note(_)` you’ll see the code that must be executed when the “My Notes” menu item is clicked. Here, we just wrote `os.system(“gedit $HOME/Documents/notes.txt”)` ; The `os.system` function is a function that allows us to run shell commands from inside Python, so here we wrote a command to open a file called `notes.txt` under the `Documents` folder in our home directory using the `gedit` editor. This for example can be your daily notes taking program from now on! + +### Adding your Needed Tasks + +There are only 2 things you need to touch in the code: + + 1. Define a new menu item under `menu()` for your desired task. + + 2. Create a new function to run a specific action when that menu item is clicked. + + +So, let’s say that you want to create a new menu item, which when clicked, plays a specific video/audio file on your hard disk using VLC? To do it, simply add the following 3 lines in line 17: + +``` +command_two = gtk.MenuItem('Play video/audio') +command_two.connect('activate', play) +menu.append(command_two) +``` + +And the following lines in line 30: + +``` +def play(_): + os.system("vlc /home//Videos/somevideo.mp4") +``` + +Replace /home//Videos/somevideo.mp4 with the path to the video/audio file you want. Now save the file and run the indicator again: + +``` +python tray.py +``` + +This is how you’ll see it now: + +![Create a Custom System Tray Indicator For Your Tasks on Linux 15][4] + +And when you click on the newly-created menu item, VLC will start playing! + +To create other items/tasks, simply redo the steps again. Just be careful to replace command_two with another name, like command_three, so that no clash between variables happen. And then define new separate functions like what we did with the play(_) function. + +The possibilities are endless from here; I am using this way for example to fetch some data from the web (using the urllib2 library) and display them for me any time. I am also using it for playing an mp3 file in the background using the mpg123 command, and I am defining another menu item to killall mpg123 to stop playing that audio whenever I want. CS:GO on Steam for example takes a huge time to exit (the window doesn’t close automatically), so as a workaround for this, I simply minimize the window and click on a menu item that I created which will execute killall -9 csgo_linux64. + +You can use this indicator for anything: Updating your system packages, possibly running some other scripts any time you want.. Literally anything. + +### Autostart on Boot + +We want our system tray indicator to start automatically on boot, we don’t want to run it manually each time. To do that, simply add the following command to your startup applications (after you replace the path to the tray.py file with yours): + +``` +nohup python /home//tray.py & +``` + +The very next time you reboot your system, the indicator will start working automatically after boot! + +### Conclusion + +You now know how to create your own system tray indicator for any task that you may want. This method should save you a lot of time depending on the nature and number of tasks you need to run on daily basis. Some users may prefer creating aliases from the command line, but this will require you to always open the terminal window or have a drop-down terminal emulator available, while here, the system tray indicator is always working and available for you. + +Have you used this method to run your tasks before? Would love to hear your thoughts. + + +-------------------------------------------------------------------------------- + +via: https://fosspost.org/tutorials/custom-system-tray-icon-indicator-linux + +作者:[M.Hanny Sabbagh][a] +选题:[lujun9972][b] +译者:[lujun9972](https://github.com/lujun9972) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fosspost.org/author/mhsabbagh +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/fosspost.org/wp-content/uploads/2019/02/Screenshot-at-2019-02-28-0808.png?resize=407%2C345&ssl=1 (Create a Custom System Tray Indicator For Your Tasks on Linux 12) +[2]: https://extensions.gnome.org/extension/1031/topicons/ +[3]: https://i2.wp.com/fosspost.org/wp-content/uploads/2019/03/Screenshot-at-2019-03-02-1041.png?resize=434%2C140&ssl=1 (Create a Custom System Tray Indicator For Your Tasks on Linux 14) +[4]: https://i2.wp.com/fosspost.org/wp-content/uploads/2019/03/Screenshot-at-2019-03-02-1141.png?resize=440%2C149&ssl=1 (Create a Custom System Tray Indicator For Your Tasks on Linux 16) From b23423b1df54ff0ba9101987c5634a3e6d85b6fe Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 16:11:42 +0800 Subject: [PATCH 114/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190301=20What's?= =?UTF-8?q?=20happening=20in=20the=20OpenStack=20community=3F=20sources/ta?= =?UTF-8?q?lk/20190301=20What-s=20happening=20in=20the=20OpenStack=20commu?= =?UTF-8?q?nity.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...-s happening in the OpenStack community.md | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 sources/talk/20190301 What-s happening in the OpenStack community.md diff --git a/sources/talk/20190301 What-s happening in the OpenStack community.md b/sources/talk/20190301 What-s happening in the OpenStack community.md new file mode 100644 index 0000000000..28e3bf2fd3 --- /dev/null +++ b/sources/talk/20190301 What-s happening in the OpenStack community.md @@ -0,0 +1,73 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What's happening in the OpenStack community?) +[#]: via: (https://opensource.com/article/19/3/whats-happening-openstack) +[#]: author: (Jonathan Bryce https://opensource.com/users/jonathan-bryce) + +What's happening in the OpenStack community? +====== + +In many ways, 2018 was a transformative year for the OpenStack Foundation. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/travel-mountain-cloud.png?itok=ZKsJD_vb) + +Since 2010, the OpenStack community has been building open source software to run cloud computing infrastructure. Initially, the focus was public and private clouds, but open infrastructure has been pulled into many new important use cases like telecoms, 5G, and manufacturing IoT. + +As OpenStack software matured and grew in scope to support new technologies like bare metal provisioning and container infrastructure, the community widened its thinking to embrace users who deploy and run the software in addition to the developers who build the software. Questions like, "What problems are users trying to solve?" "Which technologies are users trying to integrate?" and "What are the gaps?" began to drive the community's thinking and decision making. + +In response to those questions, the OSF reorganized its approach and created a new "open infrastructure" framework focused on use cases, including edge, container infrastructure, CI/CD, and private and hybrid cloud. And, for the first time, the OSF is hosting open source projects outside of the OpenStack project. + +Following are three highlights from the [OSF 2018 Annual Report][1]; I encourage you to read the entire report for more detailed information about what's new. + +### Pilot projects + +On the heels of launching [Kata Containers][2] in December 2017, the OSF launched three pilot projects in 2018—[Zuul][3], [StarlingX][4], and [Airship][5]—that help further our goals of taking our technology into additional relevant markets. Each project follows the tenets we consider key to the success of true open source, [the Four Opens][6]: open design, open collaboration, open development, and open source. While these efforts are still new, they have been extremely valuable in helping us learn how we should expand the scope of the OSF, as well as showing others the kind of approach we will take. + +While the OpenStack project remained at the core of the team's focus, pilot projects are helping expand usage of open infrastructure across markets and already benefiting the OpenStack community. This has attracted dozens of new developers to the open infrastructure community, which will ultimately benefit the OpenStack community and users. + +There is direct benefit from these contributors working upstream in OpenStack, such as through StarlingX, as well as indirect benefit from the relationships we've built with the Kubernetes community through the Kata Containers project. Airship is similarly bridging the gaps between the Kubernetes and OpenStack ecosystems. This shows users how the technologies work together. A rise in contributions to Zuul has provided the engine for OpenStack CI and keeps our development running smoothly. + +### Containers collaboration + +In addition to investing in new pilot projects, we continued efforts to work with key adjacent projects in 2018, and we made particularly good progress with Kubernetes. OSF staffer Chris Hoge helps lead the cloud provider special interest group, where he has helped standardize how Kubernetes deployments expect to run on top of various infrastructure. This has clarified OpenStack's place in the Kubernetes ecosystem and led to valuable integration points, like having OpenStack as part of the Kubernetes release testing process. + +Additionally, OpenStack Magnum was certified as a Kubernetes installer by the CNCF. Through the Kata Containers community, we have deepened these relationships into additional areas within the container ecosystem resulting in a number of companies getting involved for the first time. + +### Evolving events + +We knew heading into 2018 that the environment around our events was changing and we needed to respond. During the year, we held two successful project team gatherings (PTGs) in Dublin and Denver, reaching capacity for both events while also including new projects and OpenStack operators. We held OpenStack Summits in Vancouver and Berlin, both experiencing increases in attendance and project diversity since Sydney in 2017, with each Summit including more than 30 open source projects. Recognizing this broader audience and the OSF's evolving strategy, the OpenStack Summit was renamed the [Open Infrastructure Summit][7], beginning with the Denver event coming up in April. + +In 2018, we boosted investment in China, onboarding a China Community Manager based in Shanghai and hosting a strategy day in Beijing with 30+ attendees from Gold and Platinum Members in China. This effort will continue in 2019 as we host our first Summit in China: the [Open Infrastructure Summit Shanghai][8] in November. + +We also worked with the community in 2018 to define a new model for events to maximize participation while saving on travel and expenses for the individuals and companies who are increasingly stretched across multiple open source communities. We arrived at a plan that we will implement and iterate on in 2019 where we will collocate PTGs as standalone events adjacent to our Open Infrastructure Summits. + +### Looking ahead + +We've seen impressive progress, but the biggest accomplishment might be in establishing a framework for the future of the foundation itself. In 2018, we advanced the open infrastructure mission by establishing OSF as an effective place to collaborate for CI/CD, container infrastructure, and edge computing, in addition to the traditional public and private cloud use cases. The open infrastructure approach opened a lot of doors in 2018, from the initial release of software from each pilot project, to live 5G demos, to engagement with hyperscale public cloud providers. + +Ultimately, our value comes from the effectiveness of our communities and the software they produce. As 2019 unfolds, our community is excited to apply learnings from 2018 to the benefit of developers, users, and the commercial ecosystem across all our projects. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/whats-happening-openstack + +作者:[Jonathan Bryce][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jonathan-bryce +[b]: https://github.com/lujun9972 +[1]: https://www.openstack.org/foundation/2018-openstack-foundation-annual-report +[2]: https://katacontainers.io/ +[3]: https://zuul-ci.org/ +[4]: https://www.starlingx.io/ +[5]: https://www.airshipit.org/ +[6]: https://www.openstack.org/four-opens/ +[7]: https://www.openstack.org/summit/denver-2019/ +[8]: https://www.openstack.org/summit/shanghai-2019 From c7c857c95e45236f6f7f2cf026c57763c0730d09 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 16:19:42 +0800 Subject: [PATCH 115/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190228=203=20op?= =?UTF-8?q?en=20source=20behavior-driven=20development=20tools=20sources/t?= =?UTF-8?q?ech/20190228=203=20open=20source=20behavior-driven=20developmen?= =?UTF-8?q?t=20tools.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ource behavior-driven development tools.md | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 sources/tech/20190228 3 open source behavior-driven development tools.md diff --git a/sources/tech/20190228 3 open source behavior-driven development tools.md b/sources/tech/20190228 3 open source behavior-driven development tools.md new file mode 100644 index 0000000000..9c004a14c2 --- /dev/null +++ b/sources/tech/20190228 3 open source behavior-driven development tools.md @@ -0,0 +1,83 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 open source behavior-driven development tools) +[#]: via: (https://opensource.com/article/19/2/behavior-driven-development-tools) +[#]: author: (Christine Ketterlin Fisher https://opensource.com/users/cketterlin) + +3 open source behavior-driven development tools +====== +Having the right motivation is as important as choosing the right tool when implementing BDD. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_code_keyboard_orange_hands.png?itok=G6tJ_64Y) + +[Behavior-driven development][1] (BDD) seems very easy. Tests are written in an easily readable format that allows for feedback from product owners, business sponsors, and developers. Those tests are living documentation for your team, so you don't need requirements. The tools are easy to use and allow you to automate your test suite. Reports are generated with each test run to document every step and show you where tests are failing. + +Quick recap: Easily readable! Living documentation! Automation! Reports! What could go wrong, and why isn't everybody doing this? + +### Getting started with BDD + +So, you're ready to jump in and can't wait to pick the right open source tool for your team. You want it to be easy to use, automate all your tests, and provide easily understandable reports for each test run. Great, let's get started! + +Except, not so fast … First, what is your motivation for trying to implement BDD on your team? If the answer is simply to automate tests, go ahead and choose any of the tools listed below because chances are you're going to see minimal success in the long run. + +### My first effort + +I manage a team of business analysts (BA) and quality assurance (QA) engineers, but my background is on the business analysis side. About a year ago, I attended a talk where a developer talked about the benefits of BDD. He said that he and his team had given it a try during their last project. That should have been the first red flag, but I didn't realize it at the time. You cannot simply choose to "give BDD a try." It takes planning, preparation, and forethought into what you want your team to accomplish. + +However, you can try various parts of BDD without a large investment, and I eventually realized he and his team had written feature files and automated those tests using Cucumber. I also learned it was an experiment done solely by the team's developers, not the BA or QA staff, which defeats the purpose of understanding the end user's behavior. + +During the talk we were encouraged to try BDD, so my test analyst and I went to our boss and said we were willing to give it a shot. And then, we didn't know what to do. We had no guidance, no plan in place, and a leadership team who just wanted to automate testing. I don't think I need to tell you how this story ended. Actually, there wasn't even an end, just a slow fizzle after a few initial attempts at writing behavioral scenarios. + +### A fresh start + +Fast-forward a year, and I'm at a different company with a team of my own and BDD on the brain. I knew there was value there, but I also knew it went deeper than what I had initially been sold. I spent a lot of time thinking about how BDD could make a positive impact, not only on my team, but on our entire development team. Then I read [Discovery: Explore Behaviour Using Examples][2] by Gaspar Nagy and Seb Rose, and one of the first things I learned was that automation of tests is a benefit of BDD, but it should not be the main goal. No wonder we failed! + +This book changed how I viewed BDD and helped me start to fill in the pieces I had been missing. We are now on the (hopefully correct!) path to implementing BDD on our team. It involves active involvement from our product owners, business analysts, and manual and automated testers and buy-in and support from our executive leadership. We have a plan in place for our approach and our measures of success. + +We are still writing requirements (don't ever let anyone tell you that these scenarios can completely replace requirements!), but we are doing so with a more critical eye and evaluating where requirements and test scenarios overlap and how we can streamline the two. + +I have told the team we cannot even try to automate these tests for at least two quarters, at which point we'll evaluate and determine whether we're ready to move forward or not. Our current priorities are defining our team's standard language, practicing writing given/when/then scenarios, learning the Gherkin syntax, determining where to store these tests, and investigating how to integrate these tests into our pipeline. + +### 3 BDD tools to choose + +At its core, BDD is a way to help the entire team understand the end user's actions and behaviors, which will lead to more clear requirements, tests, and ultimately higher-quality applications. Before you pick your tool, do your pre-work. Think about your motivation, and understand that while the different parts and pieces of BDD are fairly simple, integrating them into your team is more challenging and needs careful thought and planning. Also, think about where your people fit in. + +Every organization has different roles, and BDD should not belong solely to developers nor test automation engineers. If you don't involve the business side, you're never going to gain the full benefit of this methodology. Once you have a strategy defined and are ready to move forward with automating your BDD scenarios, there are several open source tools for you to choose from. + +#### Cucumber + +[Cucumber][3] is probably the most recognized tool available that supports BDD. It is widely seen as a straightforward tool to learn and is easy to get started with. Cucumber relies on test scenarios that are written in plain text and follow the given/when/then format. Each scenario is an individual test. Scenarios are grouped into features, which is comparable to a test suite. Scenarios must be written in the Gherkin syntax for Cucumber to understand and execute the scenario's steps. The human-readable steps in the scenarios are tied to the step definitions in your code through the Cucumber framework. To successfully write and automate the scenarios, you need the right mix of business knowledge and technical ability. Identify the skill sets on your team to determine who will write and maintain the scenarios and who will automate them; most likely these should be managed by different roles. Because these tests are executed from the step definitions, reporting is very robust and can show you at which exact step your test failed. Cucumber works well with a variety of browser and API automation tools. + +#### JBehave + +[JBehave][4] is very similar to Cucumber. Scenarios are still written in the given/when/then format and are easily understandable by the entire team. JBehave supports Gherkin but also has its own JBehave syntax that can be used. Gherkin is more universal, but either option will work as long as you are consistent in your choice. JBehave has more configuration options than Cucumber, and its reports, although very detailed, need more configuration to get feedback from each step. JBehave is a powerful tool, but because it can be more customized, it is not quite as easy to get started with. Teams need to ask themselves exactly what features they need and whether or not learning the tool's various configurations is worth the time investment. + +#### Gauge + +Where Cucumber and JBehave are specifically designed to work with BDD, [Gauge][5] is not. If automation is your main goal (and not the entire BDD process), it is worth a look. Gauge tests are written in Markdown, which makes them easily readable. However, without a more standard format, such as the given/when/then BDD scenarios, tests can vary widely and, depending on the author, some tests will be much more digestible for business owners than others. Gauge works with multiple languages, so the automation team can leverage what they already use. Gauge also offers reporting with screenshots to show where the tests failed. + +### What are your needs? + +Implementing BDD allows the team to test the users' behaviors. This can be done without automating any tests at all, but when done correctly, can result in a powerful, reusable test suite. As a team, you will need to identify exactly what your automation needs are and whether or not you are truly going to use BDD or if you would rather focus on automating tests that are written in plain text. Either way, open source tools are available for you to use and to help support your testing evolution. + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/behavior-driven-development-tools + +作者:[Christine Ketterlin Fisher][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/cketterlin +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Behavior-driven_development +[2]: https://www.amazon.com/gp/product/1983591254/ref=dbs_a_def_rwt_bibl_vppi_i0 +[3]: https://cucumber.io/ +[4]: https://jbehave.org/ +[5]: https://www.gauge.org/ From bc89e28cd3818b02d003f8ceaa10931d4fd372f8 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 17:00:09 +0800 Subject: [PATCH 116/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190228=20Connec?= =?UTF-8?q?ting=20a=20VoIP=20phone=20directly=20to=20an=20Asterisk=20serve?= =?UTF-8?q?r=20sources/tech/20190228=20Connecting=20a=20VoIP=20phone=20dir?= =?UTF-8?q?ectly=20to=20an=20Asterisk=20server.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...IP phone directly to an Asterisk server.md | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 sources/tech/20190228 Connecting a VoIP phone directly to an Asterisk server.md diff --git a/sources/tech/20190228 Connecting a VoIP phone directly to an Asterisk server.md b/sources/tech/20190228 Connecting a VoIP phone directly to an Asterisk server.md new file mode 100644 index 0000000000..16b9d442e2 --- /dev/null +++ b/sources/tech/20190228 Connecting a VoIP phone directly to an Asterisk server.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Connecting a VoIP phone directly to an Asterisk server) +[#]: via: (https://feeding.cloud.geek.nz/posts/connecting-voip-phone-directly-to-asterisk-server/) +[#]: author: (François Marier https://fmarier.org/) + +Connecting a VoIP phone directly to an Asterisk server +====== + +On my [Asterisk][1] server, I happen to have two on-board ethernet boards. Since I only used one of these, I decided to move my VoIP phone from the local network switch to being connected directly to the Asterisk server. + +The main advantage is that this phone, running proprietary software of unknown quality, is no longer available on my general home network. Most importantly though, it no longer has access to the Internet, without my having to firewall it manually. + +Here's how I configured everything. + +### Private network configuration + +On the server, I started by giving the second network interface a static IP address in `/etc/network/interfaces`: + +``` +auto eth1 +iface eth1 inet static + address 192.168.2.2 + netmask 255.255.255.0 +``` + +On the VoIP phone itself, I set the static IP address to `192.168.2.3` and the DNS server to `192.168.2.2`. I then updated the SIP registrar IP address to `192.168.2.2`. + +The DNS server actually refers to an [unbound daemon][2] running on the Asterisk server. The only configuration change I had to make was to listen on the second interface and allow the VoIP phone in: + +``` +server: + interface: 127.0.0.1 + interface: 192.168.2.2 + access-control: 0.0.0.0/0 refuse + access-control: 127.0.0.1/32 allow + access-control: 192.168.2.3/32 allow +``` + +Finally, I opened the right ports on the server's firewall in `/etc/network/iptables.up.rules`: + +``` +-A INPUT -s 192.168.2.3/32 -p udp --dport 5060 -j ACCEPT +-A INPUT -s 192.168.2.3/32 -p udp --dport 10000:20000 -j ACCEPT +``` + +### Accessing the admin page + +Now that the VoIP phone is no longer available on the local network, it's not possible to access its admin page. That's a good thing from a security point of view, but it's somewhat inconvenient. + +Therefore I put the following in my `~/.ssh/config` to make the admin page available on `http://localhost:8081` after I connect to the Asterisk server via ssh: + +``` +Host asterisk + LocalForward 8081 192.168.2.3:80 +``` + +-------------------------------------------------------------------------------- + +via: https://feeding.cloud.geek.nz/posts/connecting-voip-phone-directly-to-asterisk-server/ + +作者:[François Marier][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fmarier.org/ +[b]: https://github.com/lujun9972 +[1]: https://www.asterisk.org/ +[2]: https://feeding.cloud.geek.nz/posts/setting-up-your-own-dnssec-aware/ From 9cc8fe51127ba072798a29330a59963b70afb58b Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 17:10:49 +0800 Subject: [PATCH 117/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190301=20Guide?= =?UTF-8?q?=20to=20Install=20VMware=20Tools=20on=20Linux=20sources/tech/20?= =?UTF-8?q?190301=20Guide=20to=20Install=20VMware=20Tools=20on=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Guide to Install VMware Tools on Linux.md | 143 ++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 sources/tech/20190301 Guide to Install VMware Tools on Linux.md diff --git a/sources/tech/20190301 Guide to Install VMware Tools on Linux.md b/sources/tech/20190301 Guide to Install VMware Tools on Linux.md new file mode 100644 index 0000000000..e6a43bcde1 --- /dev/null +++ b/sources/tech/20190301 Guide to Install VMware Tools on Linux.md @@ -0,0 +1,143 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Guide to Install VMware Tools on Linux) +[#]: via: (https://itsfoss.com/install-vmware-tools-linux) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Guide to Install VMware Tools on Linux +====== + +**VMware Tools enhances your VM experience by allowing you to share clipboard and folder among other things. Learn how to install VMware tools on Ubuntu and other Linux distributions.** + +In an earlier tutorial, you learned to [install VMware Workstation on Ubuntu][1]. You can further enhance the functionality of your virtual machines by installing VMware Tools. + +If you have already installed a guest OS on VMware, you must have noticed the requirement for [VMware tools][2] – even though not completely aware of what it is needed for. + +In this article, we will highlight the importance of VMware tools, the features it offers, and the method to install VMware tools on Ubuntu or any other Linux distribution. + +### VMware Tools: Overview & Features + +![Installing VMware Tools on Ubuntu][3]Installing VMware Tools on Ubuntu + +For obvious reasons, the virtual machine (your Guest OS) will not behave exactly like the host. There will be certain limitations in terms of its performance and operationg. And, that is why a set of utilities (VMware Tools) was introduced. + +VMware tools help in managing the guest OS in an efficient manner while also improving its performance. + +#### What exactly is VMware tool responsible for? + +![How to Install VMware tools on Linux][4] + +You have got a vague idea of what it does – but let us talk about the details: + + * Synchronize the time between the guest OS and the host to make things easier. + * Unlocks the ability to pass messages from host OS to guest OS. For example, you copy a text on the host to your clipboard and you can easily paste it to your guest OS. + * Enables sound in guest OS. + * Improves video resolution. + * Improves the cursor movement. + * Fixes incorrect network speed data. + * Eliminates inadequate color depth. + + + +These are the major changes that happen when you install VMware tools on Guest OS. But, what exactly does it contain / feature in order to unlock/enhance these functionalities? Let’s see.. + +#### VMware tools: Core Feature Details + +![Sharing clipboard between guest and host OS with VMware Tools][5]Sharing clipboard between guest and host OS with VMware Tools + +If you do not want to know what it includes to enable the functionalities, you can skip this part. But, for the curious readers, let us briefly discuss about it: + +**VMware device drivers:** It really depends on the OS. Most of the major operating systems do include device drivers by default. So, you do not have to install it separately. This generally involves – memory control driver, mouse driver, audio driver, NIC driver, VGA driver and so on. + +**VMware user process:** This is where things get really interesting. With this, you get the ability to copy-paste and drag-drop between the host and the guest OS. You can basically copy and paste the text from the host to the virtual machine or vice versa. + +You get to drag and drop files as well. In addition, it enables the pointer release/lock when you do not have an SVGA driver installed. + +**VMware tools lifecycle management** : Well, we will take a look at how to install VMware tools below – but this feature helps you easily install/upgrade VMware tools in the virtual machine. + +**Shared Folders** : In addition to these, VMware tools also allow you to have shared folders between the guest OS and the host. + +![Sharing folder between guest and host OS using VMware Tools in Linux][6]Sharing folder between guest and host OS using VMware Tools in Linux + +Of course, what it does and facilitates also depends on the host OS. For example, on Windows, you get a Unity mode on VMware to run programs on virtual machine and operate it from the host OS. + +### How to install VMware Tools on Ubuntu & other Linux distributions + +**Note:** For Linux guest operating systems, you should already have “Open VM Tools” suite installed, eliminating the need of installing VMware tools separately, most of the time. + +Most of the time, when you install a guest OS, you will get a prompt as a software update or a popup telling you to install VMware tools if the operating system supports [Easy Install][7]. + +Windows and Ubuntu does support Easy Install. So, even if you are using Windows as your host OS or trying to install VMware tools on Ubuntu, you should first get an option to install the VMware tools easily as popup message. Here’s how it should look like: + +![Pop-up to install VMware Tools][8]Pop-up to install VMware Tools + +This is the easiest way to get it done. So, make sure you have an active network connection when you setup the virtual machine. + +If you do not get any of these pop ups – or options to easily install VMware tools. You have to manually install it. Here’s how to do that: + +1\. Launch VMware Workstation Player. + +2\. From the menu, navigate through **Virtual Machine - > Install VMware tools**. If you already have it installed, and want to repair the installation, you will observe the same option to appear as “ **Re-install VMware tools** “. + +3\. Once you click on that, you will observe a virtual CD/DVD mounted in the guest OS. + +4\. Open that and copy/paste the **tar.gz** file to any location of your choice and extract it, here we choose the **Desktop**. + +![][9] + +5\. After extraction, launch the terminal and navigate to the folder inside by typing in the following command: + +``` +cd Desktop/VMwareTools-10.3.2-9925305/vmware-tools-distrib +``` + +You need to check the name of the folder and path in your case – depending on the version and where you extracted – it might vary. + +![][10] + +Replace **Desktop** with your storage location (such as cd Downloads) and the rest should remain the same if you are installing **10.3.2 version**. + +6\. Now, simply type in the following command to start the installation: + +``` +sudo ./vmware-install.pl -d +``` + +![][11] + +You will be asked the password for permission to install, type it in and you should be good to go. + +That’s it. You are done. These set of steps should be applicable to almost any Ubuntu-based guest operating system. If you want to install VMware tools on Ubuntu Server, or any other OS. + +**Wrapping Up** + +Installing VMware tools on Ubuntu Linux is pretty easy. In addition to the easy method, we have also explained the manual method to do it. If you still need help, or have a suggestion regarding the installation, let us know in the comments down below. + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-vmware-tools-linux + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/install-vmware-player-ubuntu-1310/ +[2]: https://kb.vmware.com/s/article/340 +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmware-tools-downloading.jpg?fit=800%2C531&ssl=1 +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/install-vmware-tools-linux.png?resize=800%2C450&ssl=1 +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmware-tools-features.gif?resize=800%2C500&ssl=1 +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmware-tools-shared-folder.jpg?fit=800%2C660&ssl=1 +[7]: https://docs.vmware.com/en/VMware-Workstation-Player-for-Linux/15.0/com.vmware.player.linux.using.doc/GUID-3F6B9D0E-6CFC-4627-B80B-9A68A5960F60.html +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmware-tools.jpg?fit=800%2C481&ssl=1 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmware-tools-extraction.jpg?fit=800%2C564&ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmware-tools-folder.jpg?fit=800%2C487&ssl=1 +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmware-tools-installation-ubuntu.jpg?fit=800%2C492&ssl=1 From 1b589c74d545fd75b4737d070dad665eb22d3ad2 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 17:12:47 +0800 Subject: [PATCH 118/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190228=20Why=20?= =?UTF-8?q?CLAs=20aren't=20good=20for=20open=20source=20sources/talk/20190?= =?UTF-8?q?228=20Why=20CLAs=20aren-t=20good=20for=20open=20source.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...28 Why CLAs aren-t good for open source.md | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 sources/talk/20190228 Why CLAs aren-t good for open source.md diff --git a/sources/talk/20190228 Why CLAs aren-t good for open source.md b/sources/talk/20190228 Why CLAs aren-t good for open source.md new file mode 100644 index 0000000000..ca39619762 --- /dev/null +++ b/sources/talk/20190228 Why CLAs aren-t good for open source.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why CLAs aren't good for open source) +[#]: via: (https://opensource.com/article/19/2/cla-problems) +[#]: author: (Richard Fontana https://opensource.com/users/fontana) + +Why CLAs aren't good for open source +====== +Few legal topics in open source are as controversial as contributor license agreements. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/write-hand_0.jpg?itok=Uw5RJD03) + +Few legal topics in open source are as controversial as [contributor license agreements][1] (CLAs). Unless you count the special historical case of the [Fedora Project Contributor Agreement][2] (which I've always seen as an un-CLA), or, like [Karl Fogel][3], you classify the [DCO][4] as a [type of CLA][5], today Red Hat makes no use of CLAs for the projects it maintains. + +It wasn't always so. Red Hat's earliest projects followed the traditional practice I've called "inbound=outbound," in which contributions to a project are simply provided under the project's open source license with no execution of an external, non-FOSS contract required. But in the early 2000s, Red Hat began experimenting with the use of contributor agreements. Fedora started requiring contributors to sign a CLA based on the widely adapted [Apache ICLA][6], while a Free Software Foundation-derived copyright assignment agreement and a pair of bespoke CLAs were inherited from the Cygnus and JBoss acquisitions, respectively. We even took [a few steps][7] towards adopting an Apache-style CLA across the rapidly growing set of Red Hat-led projects. + +This came to an end, in large part because those of us on the Red Hat legal team heard and understood the concerns and objections raised by Red Hat engineers and the wider technical community. We went on to become de facto leaders of what some have called the anti-CLA movement, marked notably by our [opposition to Project Harmony][8] and our [efforts][9] to get OpenStack to replace its CLA with the DCO. (We [reluctantly][10] sign tolerable upstream project CLAs out of practical necessity.) + +### Why CLAs are problematic + +Our choice not to use CLAs is a reflection of our values as an authentic open source company with deep roots in the free software movement. Over the years, many in the open source community have explained why CLAs, and the very similar mechanism of copyright assignment, are a bad policy for open source. + +One reason is the red tape problem. Normally, open source development is characterized by frictionless contribution, which is enabled by inbound=outbound without imposition of further legal ceremony or process. This makes it relatively easy for new contributors to get involved in a project, allowing more effective growth of contributor communities and driving technical innovation upstream. Frictionless contribution is a key part of the advantage open source development holds over proprietary alternatives. But frictionless contribution is negated by CLAs. Having to sign an unusual legal agreement before a contribution can be accepted creates a bureaucratic hurdle that slows down development and discourages participation. This cost persists despite the growing use of automation by CLA-using projects. + +CLAs also give rise to an asymmetry of legal power among a project's participants, which also discourages the growth of strong contributor and user communities around a project. With Apache-style CLAs, the company or organization leading the project gets special rights that other contributors do not receive, while those other contributors must shoulder certain legal obligations (in addition to the red tape burden) from which the project leader is exempt. The problem of asymmetry is most severe in copyleft projects, but it is present even when the outbound license is permissive. + +When assessing the arguments for and against CLAs, bear in mind that today, as in the past, the vast majority of the open source code in any product originates in projects that follow the inbound=outbound practice. The use of CLAs by a relatively small number of projects causes collateral harm to all the others by signaling that, for some reason, open source licensing is insufficient to handle contributions flowing into a project. + +### The case for CLAs + +Since CLAs continue to be a minority practice and originate from outside open source community culture, I believe that CLA proponents should bear the burden of explaining why they are necessary or beneficial relative to their costs. I suspect that most companies using CLAs are merely emulating peer company behavior without critical examination. CLAs have an understandable, if superficial, appeal to risk-averse lawyers who are predisposed to favor greater formality, paper, and process regardless of the business costs. Still, some arguments in favor of CLAs are often advanced and deserve consideration. + +**Easy relicensing:** If administered appropriately, Apache-style CLAs give the project steward effectively unlimited power to sublicense contributions under terms of the steward's choice. This is sometimes seen as desirable because of the potential need to relicense a project under some other open source license. But the value of easy relicensing has been greatly exaggerated by pointing to a few historical cases involving major relicensing campaigns undertaken by projects with an unusually large number of past contributors (all of which were successful without the use of a CLA). There are benefits in relicensing being hard because it results in stable legal expectations around a project and encourages projects to consult their contributor communities before undertaking significant legal policy changes. In any case, most inbound=outbound open source projects never attempt to relicense during their lifetime, and for the small number that do, relicensing will be relatively painless because typically the number of past contributors to contact will not be large. + +**Provenance tracking:** It is sometimes claimed that CLAs enable a project to rigorously track the provenance of contributions, which purportedly has some legal benefit. It is unclear what is achieved by the use of CLAs in this regard that is not better handled through such non-CLA means as preserving Git commit history. And the DCO would seem to be much better suited to tracking contributions, given that it is normally used on a per-commit basis, while CLAs are signed once per contributor and are administratively separate from code contributions. Moreover, provenance tracking is often described as though it were a benefit for the public, yet I know of no case where a project provides transparent, ready public access to CLA acceptance records. + +**License revocation:** Some CLA advocates warn of the prospect that a contributor may someday attempt to revoke a past license grant. To the extent that the concern is about largely judgment-proof individual contributors with no corporate affiliation, it is not clear why an Apache-style CLA provides more meaningful protection against this outcome compared to the use of an open source license. And, as with so many of the legal risks raised in discussions of open source legal policy, this appears to be a phantom risk. I have heard of only a few purported attempts at license revocation over the years, all of which were resolved quickly when the contributor backed down in the face of community pressure. + +**Unauthorized employee contribution:** This is a special case of the license revocation issue and has recently become a point commonly raised by CLA advocates. When an employee contributes to an upstream project, normally the employer owns the copyrights and patents for which the project needs licenses, and only certain executives are authorized to grant such licenses. Suppose an employee contributed proprietary code to a project without approval from the employer, and the employer later discovers this and demands removal of the contribution or sues the project's users. This risk of unauthorized contributions is thought to be minimized by use of something like the [Apache CCLA][11] with its representations and signature requirement, coupled with some adequate review process to ascertain that the CCLA signer likely was authorized to sign (a step which I suspect is not meaningfully undertaken by most CLA-using companies). + +Based on common sense and common experience, I contend that in nearly all cases today, employee contributions are done with the actual or constructive knowledge and consent of the employer. If there were an atmosphere of high litigation risk surrounding open source software, perhaps this risk should be taken more seriously, but litigation arising out of open source projects remains remarkably uncommon. + +More to the point, I know of no case where an allegation of copyright or patent infringement against an inbound=outbound project, not stemming from an alleged open source license violation, would have been prevented by use of a CLA. Patent risk, in particular, is often cited by CLA proponents when pointing to the risk of unauthorized contributions, but the patent license grants in Apache-style CLAs are, by design, quite narrow in scope. Moreover, corporate contributions to an open source project will typically be few in number, small in size (and thus easily replaceable), and likely to be discarded as time goes on. + +### Alternatives + +If your company does not buy into the anti-CLA case and cannot get comfortable with the simple use of inbound=outbound, there are alternatives to resorting to an asymmetric and administratively burdensome Apache-style CLA requirement. The use of the DCO as a complement to inbound=outbound addresses at least some of the concerns of risk-averse CLA advocates. If you must use a true CLA, there is no need to use the Apache model (let alone a [monstrous derivative][10] of it). Consider the non-specification core of the [Eclipse Contributor Agreement][12]—essentially the DCO wrapped inside a CLA—or the Software Freedom Conservancy's [Selenium CLA][13], which merely ceremonializes an inbound=outbound contribution policy. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/cla-problems + +作者:[Richard Fontana][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/fontana +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/18/3/cla-vs-dco-whats-difference +[2]: https://opensource.com/law/10/6/new-contributor-agreement-fedora +[3]: https://www.red-bean.com/kfogel/ +[4]: https://developercertificate.org +[5]: https://producingoss.com/en/contributor-agreements.html#developer-certificate-of-origin +[6]: https://www.apache.org/licenses/icla.pdf +[7]: https://www.freeipa.org/page/Why_CLA%3F +[8]: https://opensource.com/law/11/7/trouble-harmony-part-1 +[9]: https://wiki.openstack.org/wiki/OpenStackAndItsCLA +[10]: https://opensource.com/article/19/1/cla-proliferation +[11]: https://www.apache.org/licenses/cla-corporate.txt +[12]: https://www.eclipse.org/legal/ECA.php +[13]: https://docs.google.com/forms/d/e/1FAIpQLSd2FsN12NzjCs450ZmJzkJNulmRC8r8l8NYwVW5KWNX7XDiUw/viewform?hl=en_US&formkey=dFFjXzBzM1VwekFlOWFWMjFFRjJMRFE6MQ#gid=0 From 100fa31fdec177f8a935e45a92ca76d5c1acfe14 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 17:14:21 +0800 Subject: [PATCH 119/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190301=20Which?= =?UTF-8?q?=20Raspberry=20Pi=20should=20you=20choose=3F=20sources/tech/201?= =?UTF-8?q?90301=20Which=20Raspberry=20Pi=20should=20you=20choose.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...01 Which Raspberry Pi should you choose.md | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 sources/tech/20190301 Which Raspberry Pi should you choose.md diff --git a/sources/tech/20190301 Which Raspberry Pi should you choose.md b/sources/tech/20190301 Which Raspberry Pi should you choose.md new file mode 100644 index 0000000000..b7c5009051 --- /dev/null +++ b/sources/tech/20190301 Which Raspberry Pi should you choose.md @@ -0,0 +1,48 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Which Raspberry Pi should you choose?) +[#]: via: (https://opensource.com/article/19/3/which-raspberry-pi-choose) +[#]: author: (Anderson Silva https://opensource.com/users/ansilva) + +Which Raspberry Pi should you choose? +====== +In the first article in our series on getting started with Raspberry Pi, learn the three criteria for choosing the right model for you. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/raspberrypi_board_vector_red.png?itok=yaqYjYqI) + +This is the first article in a 14-day series on getting started with the [Raspberry Pi][1]. Although the series is geared towards people who have never used a Raspberry Pi or Linux or programming, there will definitely be things for more experienced readers—and I encourage those readers to leave comments and tips that build on what I write. If everyone contributes, we can make this series even more useful for beginners, other experienced readers, and even me! + +So, you want to give the Raspberry Pi a shot, but you don't know which model to buy. Maybe you want one for your classroom or your kid, but there are so many options, and you aren't sure which one is right for you. + +![](https://opensource.com/sites/default/files/uploads/raspberrypi_1_boards.png) + +My three main criteria for choosing a new Raspberry Pi are: + + * **Cost:** Don't just consider the cost of the Raspberry Pi board, but also factor the peripherals you will need in order to use it. In the US, the Raspberry Pi's cost varies from $5 (for the Raspberry Pi Zero) to $35 (for the Raspberry Pi 3 B and 3 B+). However, if you pick the Zero you will probably also need a USB hub for your mouse and keyboard, possibly a wireless adapter, and some sort of display adapter. Unless you have most (if not all) of the peripherals needed for whatever you want to do with your Raspberry Pi, make sure to add those to your Pi budget. Also, in some countries, a Raspberry Pi on its own (even without any peripherals) may be a cost burden for many students and teachers. + + * **Availability:** Finding the Raspberry Pi you want can vary depending on your location, as it may be easier (or harder) to get certain versions in some countries. Availability is an even bigger issue after new models are released, and it can take a few days or even weeks for new versions to become available in your market. + + * **Purpose:** Location and cost may not affect everyone, but every buyer must consider why they want a Raspberry Pi. The eight different models vary in RAM, CPU core, CPU speed, physical size, network connectivity, peripheral expansion, etc. For example, if you want the most robust solution with more "horsepower," you probably will want the Raspberry Pi 3 B+, which has the most RAM, fastest CPU, and largest number of cores. If you want something that won't require network connectivity, won't be used for CPU-intensive work, and can be hidden in a small space, you could go with a Raspberry Pi Zero. + + +[Wikipedia's Raspberry Pi specs chart][2] is an easy way to compare the eight Raspberry Pis models. + +Now that you know what to look for in a Raspberry Pi, in the next article, I will explain how to buy one. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/which-raspberry-pi-choose + +作者:[Anderson Silva][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ansilva +[b]: https://github.com/lujun9972 +[1]: https://www.raspberrypi.org/ +[2]: https://en.wikipedia.org/wiki/Raspberry_Pi#Specifications From 39480dbf3d6d536a37a0ba29ef03ba9da1f7b88a Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 18:46:31 +0800 Subject: [PATCH 120/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190228=20IRC=20?= =?UTF-8?q?vs=20IRL:=20How=20to=20run=20a=20good=20IRC=20meeting=20sources?= =?UTF-8?q?/talk/20190228=20IRC=20vs=20IRL-=20How=20to=20run=20a=20good=20?= =?UTF-8?q?IRC=20meeting.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...C vs IRL- How to run a good IRC meeting.md | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 sources/talk/20190228 IRC vs IRL- How to run a good IRC meeting.md diff --git a/sources/talk/20190228 IRC vs IRL- How to run a good IRC meeting.md b/sources/talk/20190228 IRC vs IRL- How to run a good IRC meeting.md new file mode 100644 index 0000000000..99f0c5c465 --- /dev/null +++ b/sources/talk/20190228 IRC vs IRL- How to run a good IRC meeting.md @@ -0,0 +1,56 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (IRC vs IRL: How to run a good IRC meeting) +[#]: via: (https://opensource.com/article/19/2/irc-vs-irl-meetings) +[#]: author: (Ben Cotton https://opensource.com/users/bcotton) + +IRC vs IRL: How to run a good IRC meeting +====== +Internet Relay Chat meetings can be a great way to move a project forward if you follow these best practices. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_community_1.png?itok=rT7EdN2m) + +There's an art to running a meeting in any format. Many people have learned to run in-person or telephone meetings, but [Internet Relay Chat][1] (IRC) meetings have unique characteristics that differ from "in real life" (IRL) meetings. This article will share the advantages and disadvantages of the IRC format as well as tips that will help you lead IRC meetings more effectively. + +Why IRC? Despite the wealth of real-time chat options available today, [IRC remains a cornerstone of open source projects][2]. If your project uses another communication method, don't worry. Most of this advice works for any synchronous text chat mechanism, perhaps with a few tweaks here and there. + +### Challenges of IRC meetings + +IRC meetings pose certain challenges compared to in-person meetings. You know that lag between when one person finishes talking and the next one begins? It's worse in IRC because people have to type what they're thinking. This is slower than talking and—unlike with talking—you can't tell when someone else is trying to compose a message. Moderators must remember to insert long pauses when asking for responses or moving to the next topic. And someone who wants to speak up should insert a brief message (e.g., a period) to let the moderator know. + +IRC meetings also lack the metadata you get from other methods. You can't read facial expressions or tone of voice in text. This means you have to be careful with your word choice and phrasing. + +And IRC meetings make it really easy to get distracted. At least when someone is looking at funny cat GIFs during an in-person meeting, you'll see them smile and hear them laugh at inopportune times. In IRC, unless they accidentally paste the wrong text, there's no peer pressure even to pretend to pay attention. With IRC, you can even be in multiple meetings at once. I've done this, but it's dangerous if you need to be an active participant. + +### Benefits of IRC meetings + +IRC meetings have some unique advantages, too. IRC is a very resource-light medium. It doesn't tax bandwidth or CPU. This lowers the barrier for participation, which is advantageous for both the underprivileged and people who are on the road. For volunteer contributors, it means they may be able to participate during their workday. And it means participants don't need to find a quiet space where they can talk without bothering those around them. + +With a meeting bot, IRC can produce meeting minutes instantly. In Fedora, we use Zodbot, an instance of Debian's [Meetbot][3], to log meetings and provide interaction. When a meeting ends, the minutes and full logs are immediately available to the community. This can reduce the administrative overhead of running the meeting. + +### It's like a normal meeting, but different + +Conducting a meeting via IRC or other text-based medium means thinking about the meeting in a slightly different way. Although it lacks some of the benefits of higher-bandwidth modes of communication, it has advantages, too. Running an IRC meeting provides the opportunity to develop discipline that can help you run any type of meeting. + +Like any meeting, IRC meetings are best when there's a defined agenda and purpose. A good meeting moderator knows when to let the conversation follow twists and turns and when it's time to reel it back in. There's no hard and fast rule here—it's very much an art. But IRC offers an advantage in this regard. By setting the channel topic to the meeting's current topic, people have a visible reminder of what they should be talking about. + +If your project doesn't already conduct synchronous meetings, you should give it some thought. For projects with a diverse set of time zones, finding a mutually agreeable time to hold a meeting is hard. You can't rely on meetings as your only source of coordination. But they can be a valuable part of how your project works. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/irc-vs-irl-meetings + +作者:[Ben Cotton][a] +选题:[lujun9972][b] +译者:[lujun9972](https://github.com/lujun9972) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/bcotton +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Internet_Relay_Chat +[2]: https://opensource.com/article/16/6/getting-started-irc +[3]: https://wiki.debian.org/MeetBot From 8c8bfcf91233101430ba4670eb652d9de03ae34e Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 18:52:55 +0800 Subject: [PATCH 121/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190227=20How=20?= =?UTF-8?q?To=20Find=20Available=20Network=20Interfaces=20On=20Linux=20sou?= =?UTF-8?q?rces/tech/20190227=20How=20To=20Find=20Available=20Network=20In?= =?UTF-8?q?terfaces=20On=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...d Available Network Interfaces On Linux.md | 202 ++++++++++++++++++ 1 file changed, 202 insertions(+) create mode 100644 sources/tech/20190227 How To Find Available Network Interfaces On Linux.md diff --git a/sources/tech/20190227 How To Find Available Network Interfaces On Linux.md b/sources/tech/20190227 How To Find Available Network Interfaces On Linux.md new file mode 100644 index 0000000000..e71aa15459 --- /dev/null +++ b/sources/tech/20190227 How To Find Available Network Interfaces On Linux.md @@ -0,0 +1,202 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Find Available Network Interfaces On Linux) +[#]: via: (https://www.ostechnix.com/how-to-find-available-network-interfaces-on-linux/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +How To Find Available Network Interfaces On Linux +====== + +![](https://www.ostechnix.com/wp-content/uploads/2019/02/network-interface-720x340.jpeg) + +One of the common task we do after installing a Linux system is network configuration. Of course, you can configure network interfaces during the installation time. But, some of you might prefer to do it after installation or change the existing settings. As you know already, you must first know how many interfaces are available on the system in-order to configure network settings from command line. This brief tutorial addresses all the possible ways to find available network interfaces on Linux and Unix operating systems. + +### Find Available Network Interfaces On Linux + +We can find the available network cards in couple ways. + +**Method 1 – Using ‘ifconfig’ Command:** + +The most commonly used method to find the network interface details is using **‘ifconfig’** command. I believe some of Linux users might still use this. + +``` +$ ifconfig -a +``` + +Sample output: + +``` +enp5s0: flags=4098 mtu 1500 +ether 24:b6:fd:37:8b:29 txqueuelen 1000 (Ethernet) +RX packets 0 bytes 0 (0.0 B) +RX errors 0 dropped 0 overruns 0 frame 0 +TX packets 0 bytes 0 (0.0 B) +TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 + +lo: flags=73 mtu 65536 +inet 127.0.0.1 netmask 255.0.0.0 +inet6 ::1 prefixlen 128 scopeid 0x10 +loop txqueuelen 1000 (Local Loopback) +RX packets 171420 bytes 303980988 (289.8 MiB) +RX errors 0 dropped 0 overruns 0 frame 0 +TX packets 171420 bytes 303980988 (289.8 MiB) +TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 + +wlp9s0: flags=4163 mtu 1500 +inet 192.168.225.37 netmask 255.255.255.0 broadcast 192.168.225.255 +inet6 2409:4072:6183:c604:c218:85ff:fe50:474f prefixlen 64 scopeid 0x0 +inet6 fe80::c218:85ff:fe50:474f prefixlen 64 scopeid 0x20 +ether c0:18:85:50:47:4f txqueuelen 1000 (Ethernet) +RX packets 564574 bytes 628671925 (599.5 MiB) +RX errors 0 dropped 0 overruns 0 frame 0 +TX packets 299706 bytes 60535732 (57.7 MiB) +TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 +``` + +As you see in the above output, I have two network interfaces namely **enp5s0** (on board wired ethernet adapter) and **wlp9s0** (wireless network adapter) on my Linux box. Here, **lo** is loopback interface, which is used to access all network services locally. It has an ip address of 127.0.0.1. + +We can also use the same ‘ifconfig’ command in many UNIX variants, for example **FreeBSD** , to list available network cards. + +**Method 2 – Using ‘ip’ Command:** + +The ‘ifconfig’ command is deprecated in the latest Linux versions. So you can use **‘ip’** command to display the network interfaces as shown below. + +``` +$ ip link show +``` + +Sample output: + +``` +1: lo: mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 + link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 +2: enp5s0: mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000 + link/ether 24:b6:fd:37:8b:29 brd ff:ff:ff:ff:ff:ff +3: wlp9s0: mtu 1500 qdisc noqueue state UP mode DORMANT group default qlen 1000 + link/ether c0:18:85:50:47:4f brd ff:ff:ff:ff:ff:ff +``` + +![](https://www.ostechnix.com/wp-content/uploads/2019/02/ip-command.png) + +You can also use the following commands as well. + +``` +$ ip addr + +$ ip -s link +``` + +Did you notice that these command also shows the connected state of the network interfaces? If you closely look at the above output, you will notice that my Ethernet card is not connected with network cable (see the word **“DOWN”** in the above output). And wireless network card is connected (See the word **“UP”** ). For more details, check our previous guide to [**find the connected state of network interfaces on Linux**][1]. + +These two commands (ifconfig and ip) are just enough to find the available network cards on your Linux systems. + +However, there are few other methods available to list network interfaces on Linux. Here you go. + +**Method 3:** + +The Linux Kernel saves the network interface details inside **/sys/class/net** directory. You can verify the list of available interfaces by looking into this directory. + +``` +$ ls /sys/class/net +``` + +Output: + +``` +enp5s0 lo wlp9s0 +``` + +**Method 4:** + +In Linux operating systems, **/proc/net/dev** file contains statistics about network interfaces. + +To view the available network cards, just view its contents using command: + +``` +$ cat /proc/net/dev +``` + +Output: + +``` +Inter-| Receive | Transmit +face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed +wlp9s0: 629189631 566078 0 0 0 0 0 0 60822472 300922 0 0 0 0 0 0 +enp5s0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +lo: 303980988 171420 0 0 0 0 0 0 303980988 171420 0 0 0 0 0 0 +``` + +**Method 5: Using ‘netstat’ command** + +The **netstat** command displays various details such as network connections, routing tables, interface statistics, masquerade connections, and multicast memberships. + +``` +$ netstat -i +``` + +**Sample output:** + +``` +Kernel Interface table +Iface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg +lo 65536 171420 0 0 0 171420 0 0 0 LRU +wlp9s0 1500 565625 0 0 0 300543 0 0 0 BMRU +``` + +Please be mindful that netstat is obsolete. The Replacement for “netstat -i” is “ip -s link”. Also note that this method will list only the active interfaces, not all available interfaces. + +**Method 6: Using ‘nmcli’ command** + +The nmcli is nmcli is a command-line tool for controlling NetworkManager and reporting network status. It is used to create, display, edit, delete, activate, and deactivate network connections and display network status. + +If you have Linux system with Network Manager installed, you can list the available network interfaces using nmcli tool using the following commands: + +``` +$ nmcli device status +``` + +Or, + +``` +$ nmcli connection show +``` + +You know now how to find the available network interfaces on Linux. Next, check the following guides to know how to configure IP address on Linux. + +[How To Configure Static IP Address In Linux And Unix][2] + +[How To Configure IP Address In Ubuntu 18.04 LTS][3] + +[How To Configure Static And Dynamic IP Address In Arch Linux][4] + +[How To Assign Multiple IP Addresses To Single Network Card In Linux][5] + +If you know any other quick ways to do it, please share them in the comment section below. I will check and update the guide with your inputs. + +And, that’s all. More good stuffs to come. Stay tuned! + +Cheers! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-find-available-network-interfaces-on-linux/ + +作者:[SK][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: https://www.ostechnix.com/how-to-find-out-the-connected-state-of-a-network-cable-in-linux/ +[2]: https://www.ostechnix.com/configure-static-ip-address-linux-unix/ +[3]: https://www.ostechnix.com/how-to-configure-ip-address-in-ubuntu-18-04-lts/ +[4]: https://www.ostechnix.com/configure-static-dynamic-ip-address-arch-linux/ +[5]: https://www.ostechnix.com/how-to-assign-multiple-ip-addresses-to-single-network-card-in-linux/ From 3e2039c3b98178d0bb64beb7ef7285b06ef5b28d Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 19:02:52 +0800 Subject: [PATCH 122/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190228=20A=20Br?= =?UTF-8?q?ief=20History=20of=20FOSS=20Practices=20sources/talk/20190228?= =?UTF-8?q?=20A=20Brief=20History=20of=20FOSS=20Practices.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...90228 A Brief History of FOSS Practices.md | 113 ++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 sources/talk/20190228 A Brief History of FOSS Practices.md diff --git a/sources/talk/20190228 A Brief History of FOSS Practices.md b/sources/talk/20190228 A Brief History of FOSS Practices.md new file mode 100644 index 0000000000..58e90a8efa --- /dev/null +++ b/sources/talk/20190228 A Brief History of FOSS Practices.md @@ -0,0 +1,113 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A Brief History of FOSS Practices) +[#]: via: (https://itsfoss.com/history-of-foss) +[#]: author: (Avimanyu Bandyopadhyay https://itsfoss.com/author/avimanyu/) + +A Brief History of FOSS Practices +====== + +We focus a great deal about Linux and Free & Open Source Software at It’s FOSS. Ever wondered how old such FOSS Practices are? How did this Practice come by? What is the History behind this revolutionary concept? + +In this history and trivia article, let’s take a look back in time through this brief write-up and note some interesting initiatives in the past that have grown so huge today. + +### Origins of FOSS + +![History of FOSS][1] + +The origins of FOSS goes back to the 1950s. When hardware was purchased, there used to be no additional charges for bundled software and the source code would also be available in order to fix possible bugs in the software. + +It was actually a common Practice back then for users with the freedom to customize the code. + +At that time, mostly academicians and researchers in the industry were the collaborators to develop such software. + +The term Open Source was not there yet. Instead, the term that was popular at that time was “Public Domain Software”. As of today, ideologically, both are very much [different][2] in nature even though they may sound similar. + + + +Back in 1955, some users of the [IBM 701][3] computer system from Los Angeles, voluntarily founded a group called SHARE. The “SHARE Program Library Agency” (SPLA) distributed information and software through magnetic tapes. + +Technical information shared, was about programming languages, operating systems, database systems, and user experiences for enterprise users of small, medium, and large-scale IBM computers. + +The initiative that is now more than 60 years old, continues to follow its goals quite actively. SHARE has its upcoming event coming up as [SHARE Phoenix 2019][4]. You can download and check out their complete timeline [here][5]. + +### The GNU Project + +Announced at MIT on September 27, 1983, by Richard Stallman, the GNU Project is what immensely empowers and supports the Free Software Community today. + +### Free Software Foundation + +The “Free Software Movement” by Richard Stallman established a new norm for developing Free Software. + +He founded The Free Software Foundation (FSF) on 4th October 1985 to support the free software movement. Software that ensures that the end users have freedom in using, studying, sharing and modifying that software came to be called as Free Software. + +**Free as in Free Speech, Not Free Beer** + + + +The Free Software Movement laid the following rules to establish the distinctiveness of the idea: + + * The freedom to run the program as you wish, for any purpose (freedom 0). + * The freedom to study how the program works, and change it so it does your computing as you wish (freedom 1). Access to the source code is a precondition for this. + * The freedom to redistribute copies so you can help your neighbor (freedom 2). + * The freedom to distribute copies of your modified versions to others (freedom 3). By doing this you can give the whole community a chance to benefit from your changes. Access to the source code is a precondition for this. + +### The Linux Kernel + + + +How can we miss this section at It’s FOSS! The Linux kernel was released as freely modifiable source code in 1991 by Linus Torvalds. At first, it was neither Free Software nor used an Open-source software license. In February 1992, Linux was relicensed under the GPL. + +### The Linux Foundation + +The Linux Foundation has a goal to empower open source projects to accelerate technology development and commercial adoption. It is an initiative that was taken in 2000 via the [Open Source Development Labs][6] (OSDL) which later merged with the [Free Standards Group][7]. + +Linus Torvalds works at The Linux Foundation who provide complete support to him so that he can work full-time on improving Linux. + +### Open Source + +When the source code of [Netscape][8] Communicator was released in 1998, the label “Open Source” was adopted by a group of individuals at a strategy session held on February 3rd, 1998 in Palo Alto, California. The idea grew from a visionary realization that the [Netscape announcement][9] had changed the way people looked at commercial software. + +This opened up a whole new world, creating a new perspective that revealed the superiority and advantage of an open development process that could be powered by collaboration. + +[Christine Peterson][10] was the one among that group of individuals who originally suggested the term “Open Source” as we perceive today (mentioned [earlier][11]). + +### Evolution of Business Models + +The concept of Open Source is a huge phenomenon right now and there are several companies that continue to adopt the Open Source Approach to this day. [As of April 2015, 78% of companies used Open Source Software][12] with different [Open Source Licenses][13]. + +Several organisations have adopted [different business models][14] for Open Source. Red Hat and Mozilla are two good examples. + +So this was a brief recap of some interesting facts from FOSS History. Do let us know your thoughts if you want to share in the comments below. + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/history-of-foss + +作者:[Avimanyu Bandyopadhyay][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/avimanyu/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/history-of-foss.png?resize=800%2C450&ssl=1 +[2]: https://opensource.org/node/878 +[3]: https://en.wikipedia.org/wiki/IBM_701 +[4]: https://event.share.org/home +[5]: https://www.share.org/d/do/11532 +[6]: https://en.wikipedia.org/wiki/Open_Source_Development_Labs +[7]: https://en.wikipedia.org/wiki/Free_Standards_Group +[8]: https://en.wikipedia.org/wiki/Netscape +[9]: https://web.archive.org/web/20021001071727/http://wp.netscape.com:80/newsref/pr/newsrelease558.html +[10]: https://en.wikipedia.org/wiki/Christine_Peterson +[11]: https://itsfoss.com/nanotechnology-open-science-ai/ +[12]: https://www.zdnet.com/article/its-an-open-source-world-78-percent-of-companies-run-open-source-software/ +[13]: https://itsfoss.com/open-source-licenses-explained/ +[14]: https://opensource.com/article/17/12/open-source-business-models From b354f9e00c3a132067f6603c2e29930ccae647d9 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 19:05:24 +0800 Subject: [PATCH 123/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190226=20All=20?= =?UTF-8?q?about=20{Curly=20Braces}=20in=20Bash=20sources/tech/20190226=20?= =?UTF-8?q?All=20about=20-Curly=20Braces-=20in=20Bash.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...190226 All about -Curly Braces- in Bash.md | 239 ++++++++++++++++++ 1 file changed, 239 insertions(+) create mode 100644 sources/tech/20190226 All about -Curly Braces- in Bash.md diff --git a/sources/tech/20190226 All about -Curly Braces- in Bash.md b/sources/tech/20190226 All about -Curly Braces- in Bash.md new file mode 100644 index 0000000000..42d37abdec --- /dev/null +++ b/sources/tech/20190226 All about -Curly Braces- in Bash.md @@ -0,0 +1,239 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (All about {Curly Braces} in Bash) +[#]: via: (https://www.linux.com/blog/learn/2019/2/all-about-curly-braces-bash) +[#]: author: (Paul Brown https://www.linux.com/users/bro66) + +All about {Curly Braces} in Bash +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/curly-braces-1920.jpg?itok=cScRhWrX) + +At this stage of our Bash basics series, it would be hard not to see some crossover between topics. For example, you have already seen a lot of brackets in the examples we have shown over the past several weeks, but the focus has been elsewhere. + +For the next phase of the series, we’ll take a closer look at brackets, curly, curvy, or straight, how to use them, and what they do depending on where you use them. We will also tackle other ways of enclosing things, like when to use quotes, double-quotes, and backquotes. + +This week, we're looking at curly brackets or _braces_ : `{}`. + +### Array Builder + +You have already encountered curly brackets before in [The Meaning of Dot][1]. There, the focus was on the use of the dot/period (`.`), but using braces to build a sequence was equally important. + +As we saw then: + +``` +echo {0..10} +``` + +prints out the numbers from 0 to 10. Using: + +``` +echo {10..0} +``` + +prints out the same numbers, but in reverse order. And, + +``` +echo {10..0..2} +``` + +prints every second number, starting with 10 and making its way backwards to 0. + +Then, + +``` +echo {z..a..2} +``` + +prints every second letter, starting with _z_ and working its way backwards until _a_. + +And so on and so forth. + +Another thing you can do is combine two or more sequences: + +``` +echo {a..z}{a..z} +``` + +This prints out all the two letter combinations of the alphabet, from _aa_ to _zz_. + +Is this useful? Well, actually it is. You see, arrays in Bash are defined by putting elements between parenthesis `()` and separating each element using a space, like this: + +``` +month=("Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec") +``` + +To access an element within the array, you use its index within brackets `[]`: + +``` +$ echo ${month[3]} # Array indexes start at [0], so [3] points to the fourth item + +Apr +``` + +You can accept all those brackets, parentheses, and braces on faith for a moment. We'll talk about them presently. + +Notice that, all things being equal, you can create an array with something like this: + +``` +letter_combos=({a..z}{a..z}) +``` + +and `letter_combos` points to an array that contains all the 2-letter combinations of the entire alphabet. + +You can also do this: + +``` +dec2bin=({0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}{0..1}) +``` + +This last one is particularly interesting because `dec2bin` now contains all the binary numbers for an 8-bit register, in ascending order, starting with 00000000, 00000001, 00000010, etc., until reaching 11111111. You can use this to build yourself an 8-bit decimal-to-binary converter. Say you want to know what 25 is in binary. You can do this: + +``` +$ echo ${dec2bin[25]} + +00011001 +``` + +Yes, there are better ways of converting decimal to binary as we saw in [the article where we discussed & as a logical operator][2], but it is still interesting, right? + +### Parameter expansion + +Getting back to + +``` +echo ${month[3]} +``` + +Here the braces `{}` are not being used as apart of a sequence builder, but as a way of generating _parameter expansion_. Parameter expansion involves what it says on the box: it takes the variable or expression within the braces and expands it to whatever it represents. + +In this case, `month` is the array we defined earlier, that is: + +``` +month=("Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec") +``` + +And, item 3 within the array points to `"Apr"` (remember: the first index in an array in Bash is `[0]`). That means that `echo ${month[3]}`, after the expansion, translates to `echo "Apr"`. + +Interpreting a variable as its value is one way of expanding it, but there are a few more you can leverage. You can use parameter expansion to manipulate what you read from variable, say, by cutting a chunk off the end. + +Suppose you have a variable like: + +``` +a="Too longgg" +``` + +The command: + +``` +echo ${a%gg} +``` + +chops off the last two gs and prints " _Too long_ ". + +Breaking this down, + + * `${...}` tells the shell to expand whatever is inside it + * `a` is the variable you are working with + * `%` tells the shell you want to chop something off the end of the expanded variable ("Too longgg") + * and `gg` is what you want to chop off. + + + +This can be useful for converting files from one format to another. Allow me to explain with a slight digression: + +[ImageMagick][3] is a set of command line tools that lets you manipulate and modify images. One of its most useful tools ImageMagick comes with is `convert`. In its simplest form `convert` allows you to, given an image in a certain format, make a copy of it in another format. + +The following command takes a JPEG image called _image.jpg_ and creates a PNG copy called _image.png_ : + +``` +convert image.jpg image.png +``` + +ImageMagick is often pre-installed on most Linux distros. If you can't find it, look for it in your distro's software manager. + +Okay, end of digression. On to the example: + +With variable expansion, you can do the same as shown above like this: + +``` +i=image.jpg + +convert $i ${i%jpg}png +``` + +What you are doing here is chopping off the extension `jpg` from `i` and then adding `png`, making the command `convert image.jpg image.png`. + +You may be wondering how this is more useful than just writing in the name of the file. Well, when you have a directory containing hundreds of JPEG images, you need to convert to PNG, run the following in it: + +``` +for i in *.jpg; do convert $i ${i%jpg}png; done +``` + +... and, hey presto! All the pictures get converted automatically. + +If you need to chop off a chunk from the beginning of a variable, instead of `%`, use `#`: + +``` +$ a="Hello World!" + +$ echo Goodbye${a#Hello} + +Goodbye World! +``` + +There's quite a bit more to parameter expansion, but a lot of it makes sense only when you are writing scripts. We'll explore more on that topic later in this series. + +### Output Grouping + +Meanwhile, let's finish up with something simple: you can also use `{ ... }` to group the output from several commands into one big blob. The command: + +``` +echo "I found all these PNGs:"; find . -iname "*.png"; echo "Within this bunch of files:"; ls > PNGs.txt +``` + +will execute all the commands but will only copy into the _PNGs.txt_ file the output from the last `ls` command in the list. However, doing + +``` +{ echo "I found all these PNGs:"; find . -iname "*.png"; echo "Within this bunch of files:"; ls; } > PNGs.txt +``` + +creates the file _PNGs.txt_ with everything, starting with the line " _I found all these PNGs:_ ", then the list of PNG files returned by `find`, then the line "Within this bunch of files:" and finishing up with the complete list of files and directories within the current directory. + +Notice that there is space between the braces and the commands enclosed within them. That’s because `{` and `}` are _reserved words_ here, commands built into the shell. They would roughly translate to " _group the outputs of all these commands together_ " in plain English. + +Also notice that the list of commands has to end with a semicolon (`;`) or the whole thing will bork. + +### Next Time + +In our next installment, we'll be looking at more things that enclose other things, but of different shapes. Until then, have fun! + +Read more: + +[And, Ampersand, and & in Linux][4] + +[Ampersands and File Descriptors in Bash][5] + +[Logical & in Bash][2] + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2019/2/all-about-curly-braces-bash + +作者:[Paul Brown][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/users/bro66 +[b]: https://github.com/lujun9972 +[1]: https://www.linux.com/blog/learn/2019/1/linux-tools-meaning-dot +[2]: https://www.linux.com/blog/learn/2019/2/logical-ampersand-bash +[3]: http://www.imagemagick.org/ +[4]: https://www.linux.com/blog/learn/2019/2/and-ampersand-and-linux +[5]: https://www.linux.com/blog/learn/2019/2/ampersands-and-file-descriptors-bash From 9bc188ba498fa327cb5bc7affe36dfc3582161a9 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 19:07:24 +0800 Subject: [PATCH 124/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190227=20Let=20?= =?UTF-8?q?your=20engineers=20choose=20the=20license:=20A=20guide=20source?= =?UTF-8?q?s/talk/20190227=20Let=20your=20engineers=20choose=20the=20licen?= =?UTF-8?q?se-=20A=20guide.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...r engineers choose the license- A guide.md | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 sources/talk/20190227 Let your engineers choose the license- A guide.md diff --git a/sources/talk/20190227 Let your engineers choose the license- A guide.md b/sources/talk/20190227 Let your engineers choose the license- A guide.md new file mode 100644 index 0000000000..81a8dd8ee2 --- /dev/null +++ b/sources/talk/20190227 Let your engineers choose the license- A guide.md @@ -0,0 +1,62 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Let your engineers choose the license: A guide) +[#]: via: (https://opensource.com/article/19/2/choose-open-source-license-engineers) +[#]: author: (Jeffrey Robert Kaufman https://opensource.com/users/jkaufman) + +Let your engineers choose the license: A guide +====== +Enabling engineers to make licensing decisions is wise and efficient. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_hands_team_collaboration.png?itok=u82QepPk) + +Imagine you are working for a company that will be starting a new open source community project. Great! You have taken a positive first step to give back and enable a virtuous cycle of innovation that the open source community-based development model provides. + +But what about choosing an open source license for your project? You ask your manager for guidance, and she provides some perspective but quickly realizes that there is no formal company policy or guidelines. As any wise manager would do, she asks you to develop formal corporate guidelines for choosing an open source license for such projects. + +Simple, right? You may be surprised to learn some unexpected challenges. This article will describe some of the complexities you may encounter and some perspective based on my recent experience with a similar project at Red Hat. + +It may be useful to quickly review some of the more common forms of open source licensing. Open source licenses may be generally placed into two main buckets, copyleft and permissive. + +> Copyleft licenses, such as the GPL, allow access to source code, modifications to the source, and distribution of the source or binary versions in their original or modified forms. Copyleft additionally provides that essential software freedoms (run, study, change, and distribution) will be allowed and ensured for any recipients of that code. A copyleft license prohibits restrictions or limitations on these essential software freedoms. +> +> Permissive licenses, similar to copyleft, also generally allow access to source code, modifications to the source, and distribution of the source or binary versions in their original or modified forms. However, unlike copyleft licenses, additional restrictions may be included with these forms of licenses, including proprietary limitations such as prohibiting the creation of modified works or further distribution. + +Red Hat is one of the leading open source development companies, with thousands of open source developers continuously working upstream and contributing to an assortment of open source projects. When I joined Red Hat, I was very familiar with its flagship Red Hat Enterprise Linux offering, often referred to as RHEL. Although I fully expected that the company contributes under a wide assortment of licenses based on project requirements, I thought our preference and top recommendation for our engineers would be GPLv2 due to our significant involvement with Linux. In addition, GPL is a copyleft license, and copyleft ensures that the essential software freedoms (run, study, change, distribute) will be extended to any recipients of that code. What could be better for sustaining the open source ecosystem than a copyleft license? + +Fast forwarding on my journey to craft internal license choice guidelines for Red Hat, the end result was to not have any license preference at all. Instead, we delegate that responsibility, to the maximum extent possible, to our engineers. Why? Because each open source project and community is unique and there are social aspects to these communities that may have preferences towards various licensing philosophies (e.g., copyleft or permissive). Engineers working in those communities understand all these issues and are best equipped to choose the proper license on this knowledge. Mandating certain licenses for code contributions often will conflict with these community norms and result in reduction or prohibition in contributed content. + +For example, perhaps your organization believes that the latest GPL license (GPLv3) is the best for your company due to its updated provisions. If you mandated GPLv3 for all future contributions vs. GPLv2, you would be prohibited from contributing code to the Linux kernel, since that is a GPLv2 project and will likely remain that way for a very long time. Your engineers, being part of that open source community project, would know that and would automatically choose GPLv2 in the absence of such a mandate. + +Bottom line: Enabling engineers to make these decisions is wise and efficient. + +To the extent your organization may have to restrict the use of certain licenses (e.g., due to certain intellectual property concerns), this should naturally be part of your guidelines or policy. I believe it is much better to delegate to the maximum extent possible to those that understand all the nuances, politics, and licensing philosophies of these varied communities and restrict license choice only when absolutely necessary. Even having a preference for a certain license over another can be problematic. Open source engineers may have deeply rooted feelings about copyleft (either for or against), and forcing one license over the other (unless absolutely necessary for business reasons) may result in creating ill-will and ostracizing an engineer or engineering department within your organization + +In summary, Red Hat's guidelines are very simple and are summarized below: + + 1. We suggest choosing an open source license from a set of 10 different licenses that are very common and meet the needs of most new open source projects. + + 2. We allow the use of other licenses but we ask that a reason is provided to the open source legal team so we can collect and better understand some of the new and perhaps evolving needs of the open source communities that we serve. (As stated above, our engineers are on the front lines and are best equipped to deliver this type of information.) + + 3. The open source legal team always has the right to override a decision, but this would be very rare and only would occur if we were aware of some community or legal concern regarding a specific license or project. + + 4. Publishing source code without a license is never permitted. + +In summary, the advantages of these guidelines are enormous. They are very efficient and lead to a very low-friction development and approval system within our organization. + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/choose-open-source-license-engineers + +作者:[Jeffrey Robert Kaufman][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jkaufman +[b]: https://github.com/lujun9972 From 01f18c190cf11afc256e8deff8089fb48597536a Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 19:11:06 +0800 Subject: [PATCH 125/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190227=20How=20?= =?UTF-8?q?To=20Check=20Password=20Complexity/Strength=20And=20Score=20In?= =?UTF-8?q?=20Linux=3F=20sources/tech/20190227=20How=20To=20Check=20Passwo?= =?UTF-8?q?rd=20Complexity-Strength=20And=20Score=20In=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Complexity-Strength And Score In Linux.md | 165 ++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 sources/tech/20190227 How To Check Password Complexity-Strength And Score In Linux.md diff --git a/sources/tech/20190227 How To Check Password Complexity-Strength And Score In Linux.md b/sources/tech/20190227 How To Check Password Complexity-Strength And Score In Linux.md new file mode 100644 index 0000000000..59b18f8a87 --- /dev/null +++ b/sources/tech/20190227 How To Check Password Complexity-Strength And Score In Linux.md @@ -0,0 +1,165 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Check Password Complexity/Strength And Score In Linux?) +[#]: via: (https://www.2daygeek.com/how-to-check-password-complexity-strength-and-score-in-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +How To Check Password Complexity/Strength And Score In Linux? +====== + +We all know the password importance. It’s a best practices to use hard and guess password. + +Also, i advise you to use the different password for each services such as email, ftp, ssh, etc., + +In top of that i suggest you guys to change the password frequently to avoid an unnecessary hacking attempt. + +By default RHEL and it’s clone uses `cracklib` module to check password strength. + +We are going to teach you, how to check the password strength using cracklib module. + +If you would like to check the password score which you have created then use the `pwscore` package. + +If you would like to create a good password, basically it should have minimum 12-15 characters length. + +It should be created in the following combinations like, Alphabets (Lower case & Upper case), Numbers and Special Characters. + +There are many utilities are available in Linux to check a password complexity and we are going to discuss about `cracklib` module today. + +### How To Install cracklib module In Linux? + +The cracklib module is available in most of the distribution repository so, use the distribution official package manager to install it. + +For **`Fedora`** system, use **[DNF Command][1]** to install cracklib. + +``` +$ sudo dnf install cracklib +``` + +For **`Debian/Ubuntu`** systems, use **[APT-GET Command][2]** or **[APT Command][3]** to install libcrack2. + +``` +$ sudo apt install libcrack2 +``` + +For **`Arch Linux`** based systems, use **[Pacman Command][4]** to install cracklib. + +``` +$ sudo pacman -S cracklib +``` + +For **`RHEL/CentOS`** systems, use **[YUM Command][5]** to install cracklib. + +``` +$ sudo yum install cracklib +``` + +For **`openSUSE Leap`** system, use **[Zypper Command][6]** to install cracklib. + +``` +$ sudo zypper install cracklib +``` + +### How To Use The cracklib module In Linux To Check Password Complexity? + +I have added few example in this article to make you understand better about this module. + +If you are given any words like, person name or place name or common word then you will be getting an message “it is based on a dictionary word”. + +``` +$ echo "password" | cracklib-check +password: it is based on a dictionary word +``` + +The default password length in Linux is `Seven` characters. If you give any password less than seven characters then you will be getting an message “it is WAY too short”. + +``` +$ echo "123" | cracklib-check +123: it is WAY too short +``` + +You will be getting `OK` When you give good password like us. + +``` +$ echo "ME$2w!@fgty6723" | cracklib-check +ME!@fgty6723: OK +``` + +### How To Install pwscore In Linux? + +The pwscore package is available in most of the distribution official repository so, use the distribution package manager to install it. + +For **`Fedora`** system, use **[DNF Command][1]** to install libpwquality. + +``` +$ sudo dnf install libpwquality +``` + +For **`Debian/Ubuntu`** systems, use **[APT-GET Command][2]** or **[APT Command][3]** to install libpwquality. + +``` +$ sudo apt install libpwquality +``` + +For **`Arch Linux`** based systems, use **[Pacman Command][4]** to install libpwquality. + +``` +$ sudo pacman -S libpwquality +``` + +For **`RHEL/CentOS`** systems, use **[YUM Command][5]** to install libpwquality. + +``` +$ sudo yum install libpwquality +``` + +For **`openSUSE Leap`** system, use **[Zypper Command][6]** to install libpwquality. + +``` +$ sudo zypper install libpwquality +``` + +If you are given any words like, person name or place name or common word then you will be getting a message “it is based on a dictionary word”. + +``` +$ echo "password" | pwscore +Password quality check failed: + The password fails the dictionary check - it is based on a dictionary word +``` + +The default password length in Linux is `Seven` characters. If you give any password less than seven characters then you will be getting an message “it is WAY too short”. + +``` +$ echo "123" | pwscore +Password quality check failed: + The password is shorter than 8 characters +``` + +You will be getting `password score` When you give good password like us. + +``` +$ echo "ME!@fgty6723" | pwscore +90 +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/how-to-check-password-complexity-strength-and-score-in-linux/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/ +[2]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[3]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[4]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ +[5]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ +[6]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ From 2d7af94ac168215b253164f5d52d8847a08c1959 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 6 Mar 2019 19:12:25 +0800 Subject: [PATCH 126/796] 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 127/796] 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 128/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190226=20Linux?= =?UTF-8?q?=20security:=20Cmd=20provides=20visibility,=20control=20over=20?= =?UTF-8?q?user=20activity=20sources/tech/20190226=20Linux=20security-=20C?= =?UTF-8?q?md=20provides=20visibility,=20control=20over=20user=20activity.?= =?UTF-8?q?md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... visibility, control over user activity.md | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 sources/tech/20190226 Linux security- Cmd provides visibility, control over user activity.md diff --git a/sources/tech/20190226 Linux security- Cmd provides visibility, control over user activity.md b/sources/tech/20190226 Linux security- Cmd provides visibility, control over user activity.md new file mode 100644 index 0000000000..952e76f1f3 --- /dev/null +++ b/sources/tech/20190226 Linux security- Cmd provides visibility, control over user activity.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux security: Cmd provides visibility, control over user activity) +[#]: via: (https://www.networkworld.com/article/3342454/linux-security-cmd-provides-visibility-control-over-user-activity.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Linux security: Cmd provides visibility, control over user activity +====== + +![](https://images.techhive.com/images/article/2017/01/background-1900329_1920-100705659-large.jpg) + +There's a new Linux security tool you should be aware of — Cmd (pronounced "see em dee") dramatically modifies the kind of control that can be exercised over Linux users. It reaches way beyond the traditional configuration of user privileges and takes an active role in monitoring and controlling the commands that users are able to run on Linux systems. + +Provided by a company of the same name, Cmd focuses on cloud usage. Given the increasing number of applications being migrated into cloud environments that rely on Linux, gaps in the available tools make it difficult to adequately enforce required security. However, Cmd can also be used to manage and protect on-premises systems. + +### How Cmd differs from traditional Linux security controls + +The leaders at Cmd — Milun Tesovic and Jake King — say organizations cannot confidently predict or control user behavior until they understand how users work routinely and what is considered “normal.” They seek to provide a tool that will granularly control, monitor, and authenticate user activity. + +Cmd monitors user activity by forming user activity profiles (characterizing the activities these users generally perform), noticing abnormalities in their online behavior (login times, commands used, user locations, etc.), and preventing and reporting certain activities (e.g., downloading or modifying files and running privileged commands) that suggest some kind of system compromise might be underway. The product's behaviors are configurable and changes can be made rapidly. + +The kind of tools most of us are using today to detect threats, identify vulnerabilities, and control user privileges have taken us a long way, but we are still fighting the battle to keep our systems and data safe. Cmd brings us a lot closer to identifying the intentions of hostile users whether those users are people who have managed to break into accounts or represent insider threats. + +![1 sources live sessions][1] + +View live Linux sessions + +### How does Cmd work? + +In monitoring and managing user activity, Cmd: + + * Collects information that profiles user activity + * Uses the baseline to determine what is considered normal + * Detects and proactively prevents threats using specific indicators + * Sends alerts to responsible people + + + +![2 triggers][3] + +Building custom policies in Cmd + +Cmd goes beyond defining what sysadmins can control through traditional methods, such as configuring sudo privileges, providing much more granular and situation-specific controls. + +Administrators can select escalation policies that can be managed separately from the user privilege controls managed by Linux sysadmins. + +The Cmd agent provides real-time visibility (not after-the-fact log analysis) and can block actions, require additional authentication, or negotiate authorization as needed. + +Also, Cmd supports custom rules based on geolocation if user locations are available. And new policies can be pushed to agents deployed on hosts within minutes. + +![3 command blocked][4] + +Building a trigger query in Cmd + +### Funding news for Cmd + +[Cmd][2] recently got a financial boost, having [completed of a $15 million round of funding][5] led by [GV][6] (formerly Google Ventures) with participation from Expa, Amplify Partners, and additional strategic investors. This brings the company's raised funding to $21.6 million and will help it continue to add new defensive capabilities to the product and grow its engineering teams. + +In addition, the company appointed Karim Faris, general partner at GV, to its board of directors. + +Join the Network World communities on [Facebook][7] and [LinkedIn][8] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3342454/linux-security-cmd-provides-visibility-control-over-user-activity.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://images.idgesg.net/images/article/2019/02/1-sources-live-sessions-100789431-large.jpg +[2]: https://cmd.com +[3]: https://images.idgesg.net/images/article/2019/02/2-triggers-100789432-large.jpg +[4]: https://images.idgesg.net/images/article/2019/02/3-command-blocked-100789433-large.jpg +[5]: https://www.linkedin.com/pulse/changing-cybersecurity-announcing-cmds-15-million-funding-jake-king/ +[6]: https://www.gv.com/ +[7]: https://www.facebook.com/NetworkWorld/ +[8]: https://www.linkedin.com/company/network-world From 9c9f2b80e1c76ce33aea2667854f3b5cd416deda Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 19:24:34 +0800 Subject: [PATCH 129/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190227=20How=20?= =?UTF-8?q?to=20Display=20Weather=20Information=20in=20Ubuntu=2018.04=20so?= =?UTF-8?q?urces/tech/20190227=20How=20to=20Display=20Weather=20Informatio?= =?UTF-8?q?n=20in=20Ubuntu=2018.04.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...lay Weather Information in Ubuntu 18.04.md | 290 ++++++++++++++++++ 1 file changed, 290 insertions(+) create mode 100644 sources/tech/20190227 How to Display Weather Information in Ubuntu 18.04.md diff --git a/sources/tech/20190227 How to Display Weather Information in Ubuntu 18.04.md b/sources/tech/20190227 How to Display Weather Information in Ubuntu 18.04.md new file mode 100644 index 0000000000..da0c0df203 --- /dev/null +++ b/sources/tech/20190227 How to Display Weather Information in Ubuntu 18.04.md @@ -0,0 +1,290 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Display Weather Information in Ubuntu 18.04) +[#]: via: (https://itsfoss.com/display-weather-ubuntu) +[#]: author: (Sergiu https://itsfoss.com/author/sergiu/) + +How to Display Weather Information in Ubuntu 18.04 +====== + +You’ve got a fresh Ubuntu install and you’re [customizing Ubuntu][1] to your liking. You want the best experience and the best apps for your needs. + +The only thing missing is a weather app. Luckily for you, we got you covered. Just make sure you have the Universe repository enabled. + +![Tools to Display Weather Information in Ubuntu Linux][2] + +### 8 Ways to Display Weather Information in Ubuntu 18.04 + +Back in the Unity days, there were a few popular options like My Weather Indicator to display weather on your system. Those options are either discontinued or not available in Ubuntu 18.04 and higher versions anymore. + +Fortunately, there are many other options to choose from. Some are minimalist and plain simple to use, some offer detailed information (or even present you with news headlines) and some are made for terminal gurus. Whatever your needs may be, the right app is waiting for you. + +**Note:** The presented apps are in no particular order of ranking. + +**Top Panel Apps** + +These applications usually sit on the top panel of your screen. Good for quick look at the temperature. + +#### 1\. OpenWeather Shell Extension + +![Open Weather Gnome Shell Extesnsion][3] + +**Key features:** + + * Simple to install and customize + * Uses OpenWeatherMap (by default) + * Many Units and Layout options + * Can save multiple locations (that can easily be changed) + + + +This is a great extension presenting you information in a simple manner. There are multiple ways to install this. It is the weather app that I find myself using the most, because it’s just a simple, no-hassle integrated weather display for the top panel. + +**How to Install:** + +I recommend reading this [detailed tutorial about using GNOME extensions][4]. The easiest way to install this extension is to open up a terminal and run: + +``` +sudo apt install gnome-shell-extension-weather +``` + +Then all you have to restart the gnome shell by executing: + +``` +Alt+F2 +``` + +Enter **r** and press **Enter**. + +Now open up **Tweaks** (gnome tweak tool) and enable **Openweather** in the **Extensions** tab. + +#### 2\. gnome-weather + +![Gnome Weather App UI][5] +![Gnome Weather App Top Panel][6] + +**Key features:** + + * Pleasant Design + * Integrated into Calendar (Top Panel) + * Simple Install + * Flatpak install available + + + +This app is great for new users. The installation is only one command and the app is easy to use. Although it doesn’t have as many features as other apps, it is still great if you don’t want to bother with multiple settings and a complex install procedure. + +**How to Install:** + +All you have to do is run: + +``` +sudo apt install gnome-weather +``` + +Now search for **Weather** and the app should pop up. After logging out (and logging back in), the Calendar extension will be displayed. + +If you prefer, you can get a [flatpak][7] version. + +#### 3\. Meteo + +![Meteo Weather App UI][8] +![Meteo Weather System Tray][9] + +**Key features:** + + * Great UI + * Integrated into System Tray (Top Panel) + * Simple Install + * Great features (Maps) + + + +Meteo is a snap app on the heavier side. Most of that weight comes from the great Maps features, with maps presenting temperatures, clouds, precipitations, pressure and wind speed. It’s a distinct feature that I haven’t encountered in any other weather app. + +**Note** : After changing location, you might have to quit and restart the app for the changes to be applied in the system tray. + +**How to Install:** + +Open up the **Ubuntu Software Center** and search for **Meteo**. Install and launch. + +**Desktop Apps** + +These are basically desktop widgets. They look good and provide more information at a glance. + +#### 4\. Temps + +![Temps Weather App UI][10] + +**Key features:** + + * Beautiful Design + * Useful Hotkeys + * Hourly Temperature Graph + + + +Temps is an electron app with a beautiful UI (though not exactly “light”). The most unique features are the temperature graphs. The hotkeys might feel unintuitive at first, but they prove to be useful in the long run. The app will minimize when you click somewhere else. Just press Ctrl+Shift+W to bring it back. + +This app is **Open-Source** , and the developer can’t afford the cost of a faster API key, so you might want to create your own API at [OpenWeatherMap][11]. + +**How to Install:** + +Go to the website and download the version you need (probably 64-bit). Extract the archive. Open the extracted directory and double-click on **Temps**. Press Ctrl+Shift+W if the window minimizes. + +#### 5\. Cumulus + +![Cumulus Weather App UI][12] + +**Key features:** + + * Color Selector for background and text + + * Re-sizable window + + * Tray Icon (temperature only) + + * Allows multiple instances with different locations etc. + + + + +Cumulus is a greatly customizable weather app, with a backend supporting Yahoo! Weather and OpenWeatherMap. The UI is great and the installer is simple to use. This app has amazing features. It’s one of the few weather apps that allow for multiple instances. You should definitely try it you are looking for an experience tailored to your preferences. + +**How to Install:** + +Go to the website and download the (online) installer. Open up a terminal and **cd** (change directory) to the directory where you downloaded the file. + +Then run + +``` +chmod +x Cumulus-online-installer-x64 +./Cumulus-online-installer-x64 +``` + +Search for **Cumulus** and enjoy the app! + +**Terminal Apps** + +You are a terminal dweller? You can check the weather right in your terminal. + +#### 7\. WeGo + +![WeGo Weather App Terminal][13] + +**Key features:** + + * Supports different APIs + * Pretty detailed + * Customizable config + * Multi-language support + * 1 to 7 day forecast + + + +WeGo is a Go app for displaying weather info in the terminal. It’s install can be a little tricky, but it’s easy to set up. You’ll need to register an API Key [here][14] (if using **forecast.io** , which is default). Once you set it up, it’s fairly practical for someone who mostly works in the terminal. + +**How to Install:** + +I recommend you to check out the GitHub page for complete information on installation, setup and features. + +#### 8\. Wttr.in + +![Wttr.in Weather App Terminal][15] + +**Key features:** + + * Simple install + * Easy to use + * Lightweight + * 3 day forecast + * Moon phase + + + +If you really live in the terminal, this is the weather app for you. This is as lightweight as it gets. You can specify location (by default the app tries to detect your current location) and a few other parameters (eg. units). + +**How to Install:** + +Open up a terminal and install Curl: + +``` +sudo apt install curl +``` + +Then: + +``` +curl wttr.in +``` + +That’s it. You can specify location and parameters like so: + +``` +curl wttr.in/london?m +``` + +To check out other options type: + +``` +curl wttr.in/:help +``` + +If you found some settings you enjoy and you find yourself using them frequently, you might want to add an **alias**. To do so, open **~/.bashrc** with your favorite editor (that’s **vim** , terminal wizard). Go to the end and paste in + +``` +alias wttr='curl wttr.in/CITY_NAME?YOUR_PARAMS' +``` + +For example: + +``` +alias wttr='curl wttr.in/london?m' +``` + +Save and close **~/.bashrc** and run the command below to source the new file. + +``` +source ~/.bashrc +``` + +Now, typing **wttr** in the terminal and pressing Enter should execute your custom command. + +**Wrapping Up** + +These are a handful of the weather apps available for Ubuntu. We hope our list helped you discover an app fitting your needs, be that something with pleasant aesthetics or just a quick tool. + +What is your favorite weather app? Tell us about what you enjoy and why in the comments section. + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/display-weather-ubuntu + +作者:[Sergiu][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/sergiu/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/gnome-tricks-ubuntu/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/display-weather-ubuntu.png?resize=800%2C450&ssl=1 +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/open_weather_gnome_shell-1-1.jpg?fit=800%2C383&ssl=1 +[4]: https://itsfoss.com/gnome-shell-extensions/ +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/gnome_weather_ui.jpg?fit=800%2C599&ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/gnome_weather_top_panel.png?fit=800%2C587&ssl=1 +[7]: https://flatpak.org/ +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/meteo_ui.jpg?fit=800%2C547&ssl=1 +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/meteo_system_tray.png?fit=800%2C653&ssl=1 +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/temps_ui.png?fit=800%2C623&ssl=1 +[11]: https://openweathermap.org/ +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/cumulus_ui.png?fit=800%2C651&ssl=1 +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/wego_terminal.jpg?fit=800%2C531&ssl=1 +[14]: https://developer.forecast.io/register +[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/wttr_in_terminal.jpg?fit=800%2C526&ssl=1 From bcb410f91816972b7b593632c8742389fff51e69 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 19:25:57 +0800 Subject: [PATCH 130/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190223=20No!=20?= =?UTF-8?q?Ubuntu=20is=20NOT=20Replacing=20Apt=20with=20Snap=20sources/tal?= =?UTF-8?q?k/20190223=20No-=20Ubuntu=20is=20NOT=20Replacing=20Apt=20with?= =?UTF-8?q?=20Snap.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...- Ubuntu is NOT Replacing Apt with Snap.md | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 sources/talk/20190223 No- Ubuntu is NOT Replacing Apt with Snap.md diff --git a/sources/talk/20190223 No- Ubuntu is NOT Replacing Apt with Snap.md b/sources/talk/20190223 No- Ubuntu is NOT Replacing Apt with Snap.md new file mode 100644 index 0000000000..bb7dd14943 --- /dev/null +++ b/sources/talk/20190223 No- Ubuntu is NOT Replacing Apt with Snap.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (No! Ubuntu is NOT Replacing Apt with Snap) +[#]: via: (https://itsfoss.com/ubuntu-snap-replaces-apt-blueprint/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +No! Ubuntu is NOT Replacing Apt with Snap +====== + +Stop believing the rumors that Ubuntu is planning to replace Apt with Snap in the [Ubuntu 19.04 release][1]. These are only rumors. + +![Snap replacing apt rumors][2] + +Don’t get what I am talking about? Let me give you some context. + +There is a ‘blueprint’ on Ubuntu’s launchpad website, titled ‘Replace APT with snap as default package manager’. It talks about replacing Apt (package manager at the heart of Debian) with Snap ( a new packaging system by Ubuntu). + +> Thanks to Snap, the need for APT is disappearing, fast… why don’t we use snap at the system level? + +The post further says “Imagine, for example, being able to run “sudo snap install cosmic” to upgrade to the current release, “sudo snap install –beta disco” (in March) to upgrade to a beta release, or, for that matter, “sudo snap install –edge disco” to upgrade to a pre-beta release. It would make the whole process much easier, and updates could simply be delivered as updates to the corresponding snap, which could then just be pushed to the repositories and there it is. This way, instead of having a separate release updater, it would be possible to A, run all system updates completely and silently in the background to avoid nagging the user (a la Chrome OS), and B, offer release upgrades in the GNOME software store, Mac-style, as banners, so the user can install them easily. It would make the user experience both more consistent and even more user-friendly than it currently is.” + +It might sound good and promising and if you take a look at [this link][3], even you might start believing the rumor. Why? Because at the bottom of the blueprint information, it lists Ubuntu-founder Mark Shuttleworth as the approver. + +![Apt being replaced with Snap blueprint rumor][4]Mark Shuttleworth’s name adds to the confusion + +The rumor got fanned when the Switch to Linux YouTube channel covered it. You can watch the video from around 11:30. + + + +When this ‘news’ was brought to my attention, I reached out to Alan Pope of Canonical and asked him if he or his colleagues at Canonical (Ubuntu’s parent company) could confirm it. + +Alan clarified that the so called blueprint was not associated with official Ubuntu team. It was created as a proposal by some community member not affiliated with Ubuntu. + +> That’s not anything official. Some random community person made it. Anyone can write a blueprint. +> +> Alan Pope, Canonical + +Alan further elaborated that anyone can create such blueprints and tag Mark Shuttleworth or other Ubuntu members in it. Just because Mark’s name was listed as the approver, it doesn’t mean he already approved the idea. + +Canonical has no such plans to replace Apt with Snap. It’s not as simple as the blueprint in question suggests. + +After talking with Alan, I decided to not write about this topic because I don’t want to fan baseless rumors and confuse people. + +Unfortunately, the ‘replace Apt with Snap’ blueprint is still being shared on various Ubuntu and Linux related groups and forums. Alan had to publicly dismiss these rumors in a series of tweets: + +> Seen this [#Ubuntu][5] blueprint being shared around the internet. It's not official, not a thing we're doing. Just because someone made a blueprint, doesn't make it fact. +> +> — Alan Pope 🇪🇺🇬🇧 (@popey) [February 23, 2019][6] + +I don’t want you, the It’s FOSS reader, to fell for such silly rumors so I quickly penned this article. + +If you come across ‘apt being replaced with snap’ discussion, you may tell people that it’s not true and provide them this link as a reference. + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ubuntu-snap-replaces-apt-blueprint/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/ubuntu-19-04-release-features/ +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/snap-replacing-apt.png?resize=800%2C450&ssl=1 +[3]: https://blueprints.launchpad.net/ubuntu/+spec/package-management-default-snap +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/apt-snap-blueprint.jpg?ssl=1 +[5]: https://twitter.com/hashtag/Ubuntu?src=hash&ref_src=twsrc%5Etfw +[6]: https://twitter.com/popey/status/1099238146393468931?ref_src=twsrc%5Etfw From 132b18ec04c155c3c55ce4ad7e8118d268d12742 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 19:31:26 +0800 Subject: [PATCH 131/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190226=20Reduci?= =?UTF-8?q?ng=20security=20risks=20with=20centralized=20logging=20sources/?= =?UTF-8?q?talk/20190226=20Reducing=20security=20risks=20with=20centralize?= =?UTF-8?q?d=20logging.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...security risks with centralized logging.md | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 sources/talk/20190226 Reducing security risks with centralized logging.md diff --git a/sources/talk/20190226 Reducing security risks with centralized logging.md b/sources/talk/20190226 Reducing security risks with centralized logging.md new file mode 100644 index 0000000000..60bbd7a80b --- /dev/null +++ b/sources/talk/20190226 Reducing security risks with centralized logging.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Reducing security risks with centralized logging) +[#]: via: (https://opensource.com/article/19/2/reducing-security-risks-centralized-logging) +[#]: author: (Hannah Suarez https://opensource.com/users/hcs) + +Reducing security risks with centralized logging +====== +Centralizing logs and structuring log data for processing can mitigate risks related to insufficient logging. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security_privacy_lock.png?itok=ZWjrpFzx) + +Logging and log analysis are essential to securing infrastructure, particularly when we consider common vulnerabilities. This article, based on my lightning talk [Let's use centralized log collection to make incident response teams happy][1] at FOSDEM'19, aims to raise awareness about the security concerns around insufficient logging, offer a way to avoid the risk, and advocate for more secure practices _(disclaimer: I work for NXLog)._ + +### Why log collection and why centralized logging? + +Logging is, to be specific, an append-only sequence of records written to disk. In practice, logs help you investigate an infrastructure issue as you try to find a cause for misbehavior. A challenge comes up when you have heterogeneous systems with their own standards and formats, and you want to be able to handle and process these in a dependable way. This often comes at the cost of metadata. Centralized logging solutions require commonality, and that commonality often removes the rich metadata many open source logging tools provide. + +### The security risk of insufficient logging and monitoring + +The Open Web Application Security Project ([OWASP][2]) is a nonprofit organization that contributes to the industry with incredible projects (including many [tools][3] focusing on software security). The organization regularly reports on the riskiest security challenges for application developers and maintainers. In its most recent report on the [top 10 most critical web application security risks][4], OWASP added Insufficient Logging and Monitoring to its list. OWASP warns of risks due to insufficient logging, detection, monitoring, and active response in the following types of scenarios. + + * Important auditable events, such as logins, failed logins, and high-value transactions are not logged. + * Warnings and errors generate none, inadequate, or unclear log messages. + * Logs are only being stored locally. + * The application is unable to detect, escalate, or alert for active attacks in real time or near real time. + + + +These instances can be mitigated by centralizing logs (i.e., not storing logs locally) and structuring log data for processing (i.e., in alerting dashboards and security suites). + +For example, imagine a DNS query leads to a malicious site named **hacked.badsite.net**. With DNS monitoring, administrators monitor and proactively analyze DNS queries and responses. The efficiency of DNS monitoring relies on both sufficient logging and log collection in order to catch potential issues as well as structuring the resulting DNS log for further processing: + +``` +2019-01-29 +Time (GMT)      Source                  Destination             Protocol-Info +12:42:42.112898 SOURCE_IP               xxx.xx.xx.x             DNS     Standard query 0x1de7  A hacked.badsite.net +``` + +You can try this yourself and run through other examples and snippets with the [NXLog Community Edition][5] _(disclaimer again: I work for NXLog)._ + +### Important aside: unstructured vs. structured data + +It's important to take a moment and consider the log data format. For example, let's consider this log message: + +``` +debug1: Failed password for invalid user amy from SOURCE_IP port SOURCE_PORT ssh2 +``` + +This log contains a predefined structure, such as a metadata keyword before the colon ( **debug1** ). However, the rest of the log field is an unstructured string ( **Failed password for invalid user amy from SOURCE_IP port SOURCE_PORT ssh2** ). So, while the message is easily available in a human-readable format, it is not a format a computer can easily parse. + +Unstructured event data poses limitations including difficulty of parsing, searching, and analyzing the logs. The important metadata is too often set in an unstructured data field in the form of a freeform string like the example above. Logging administrators will come across this problem at some point as they attempt to standardize/normalize log data and centralize their log sources. + +### Where to go next + +Alongside centralizing and structuring your logs, make sure you're collecting the right log data—Sysmon, PowerShell, Windows EventLog, DNS debug, NetFlow, ETW, kernel monitoring, file integrity monitoring, database logs, external cloud logs, and so on. Also have the right tools and processes in place to collect, aggregate, and help make sense of the data. + +Hopefully, this gives you a starting point to centralize log collection across diverse sources; send them to outside sources like dashboards, monitoring software, analytics software, specialized software like security information and event management (SEIM) suites; and more. + +What does your centralized logging strategy look like? Share your thoughts in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/reducing-security-risks-centralized-logging + +作者:[Hannah Suarez][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/hcs +[b]: https://github.com/lujun9972 +[1]: https://fosdem.org/2019/schedule/event/lets_use_centralized_log_collection_to_make_incident_response_teams_happy/ +[2]: https://www.owasp.org/index.php/Main_Page +[3]: https://github.com/OWASP +[4]: https://www.owasp.org/index.php/Top_10-2017_Top_10 +[5]: https://nxlog.co/products/nxlog-community-edition/download From 8bd61abae61a973b82659578d68dd7f5a2f4b349 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 19:34:30 +0800 Subject: [PATCH 132/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190226=20How=20?= =?UTF-8?q?To=20SSH=20Into=20A=20Particular=20Directory=20On=20Linux=20sou?= =?UTF-8?q?rces/tech/20190226=20How=20To=20SSH=20Into=20A=20Particular=20D?= =?UTF-8?q?irectory=20On=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...SH Into A Particular Directory On Linux.md | 114 ++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 sources/tech/20190226 How To SSH Into A Particular Directory On Linux.md diff --git a/sources/tech/20190226 How To SSH Into A Particular Directory On Linux.md b/sources/tech/20190226 How To SSH Into A Particular Directory On Linux.md new file mode 100644 index 0000000000..37d52656a8 --- /dev/null +++ b/sources/tech/20190226 How To SSH Into A Particular Directory On Linux.md @@ -0,0 +1,114 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To SSH Into A Particular Directory On Linux) +[#]: via: (https://www.ostechnix.com/how-to-ssh-into-a-particular-directory-on-linux/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +How To SSH Into A Particular Directory On Linux +====== + +![](https://www.ostechnix.com/wp-content/uploads/2019/02/SSH-Into-A-Particular-Directory-720x340.png) + +Have you ever been in a situation where you want to SSH to a remote server and immediately cd into a directory and continue work interactively? You’re on the right track! This brief tutorial describes how to directly SSH into a particular directory of a remote Linux system. Not just SSH into a specific directory, you can run any command immediately right after connecting to an SSH server as described in this guide. It is not that difficult as you might think. Read on. + +### SSH Into A Particular Directory Of A Remote System + +Before I knew this method, I would usually first SSH to the remote remote system using command: + +``` +$ ssh user@remote-system +``` + +And then cd into a directory like below: + +``` +$ cd +``` + +However, you need not to use two separate commands. You can combine these commands and simplify the task with one command. + +Have a look at the following example. + +``` +$ ssh -t sk@192.168.225.22 'cd /home/sk/ostechnix ; bash' +``` + +The above command will SSH into a remote system (192.168.225.22) and immediately cd into a directory named **‘/home/sk/ostechnix/’** directory and leave yourself at the prompt. + +Here, the **-t** flag is used to force pseudo-terminal allocation, which is necessary or an interactive shell. + +Here is the sample output of the above command: + +![](https://www.ostechnix.com/wp-content/uploads/2019/02/ssh-1.gif) + +You can also use this command as well. + +``` +$ ssh -t sk@192.168.225.22 'cd /home/sk/ostechnix ; exec bash' +``` + +Or, + +``` +$ ssh -t sk@192.168.225.22 'cd /home/sk/ostechnix && exec bash -l' +``` + +Here, the **-l** flag sets the bash as login shell. + +In the above example, I have used **bash** in the last argument. It is the default shell in my remote system. If you don’t know the shell type on the remote system, use the following command: + +``` +$ ssh -t sk@192.168.225.22 'cd /home/sk/ostechnix && exec $SHELL' +``` + +Like I already said, this is not just for cd into directory after connecting to an remote system. You can use this trick to run other commands as well. For example, the following command will land you inside ‘/home/sk/ostechnix/’ directory and then execute ‘uname -a’ command. + +``` +$ ssh -t sk@192.168.225.22 'cd /home/sk/ostechnix && uname -a && exec $SHELL' +``` + +Alternatively, you can add the command(s) you wanted to run after connecting to an SSH server on the remote system’s **.bash_profile** file. + +Edit **.bash_profile** file: + +``` +$ nano ~/.bash_profile +``` + +Add the command(s) one by one. In my case, I am adding the following line: + +``` +cd /home/sk/ostechnix >& /dev/null +``` + +Save and close the file. Finally, run the following command to update the changes. + +``` +$ source ~/.bash_profile +``` + +Please note that you should add this line on the remote system’s **.bash_profile** or **.bashrc** file, not in your local system’s. From now on, whenever you login (whether by SSH or direct), the cd command will execute and you will be automatically landed inside “/home/sk/ostechnix/” directory. + + +And, that’s all for now. Hope this was useful. More good stuffs to come. Stay tuned! + +Cheers! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-ssh-into-a-particular-directory-on-linux/ + +作者:[SK][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 From db0e2d9aee47189b82ce475b5ebabda56e148b5e Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 19:38:02 +0800 Subject: [PATCH 133/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190225=20How=20?= =?UTF-8?q?To=20Identify=20That=20The=20Linux=20Server=20Is=20Integrated?= =?UTF-8?q?=20With=20Active=20Directory=20(AD)=3F=20sources/tech/20190225?= =?UTF-8?q?=20How=20To=20Identify=20That=20The=20Linux=20Server=20Is=20Int?= =?UTF-8?q?egrated=20With=20Active=20Directory=20(AD).md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...s Integrated With Active Directory (AD).md | 177 ++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 sources/tech/20190225 How To Identify That The Linux Server Is Integrated With Active Directory (AD).md diff --git a/sources/tech/20190225 How To Identify That The Linux Server Is Integrated With Active Directory (AD).md b/sources/tech/20190225 How To Identify That The Linux Server Is Integrated With Active Directory (AD).md new file mode 100644 index 0000000000..55d30a7910 --- /dev/null +++ b/sources/tech/20190225 How To Identify That The Linux Server Is Integrated With Active Directory (AD).md @@ -0,0 +1,177 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Identify That The Linux Server Is Integrated With Active Directory (AD)?) +[#]: via: (https://www.2daygeek.com/how-to-identify-that-the-linux-server-is-integrated-with-active-directory-ad/) +[#]: author: (Vinoth Kumar https://www.2daygeek.com/author/vinoth/) + +How To Identify That The Linux Server Is Integrated With Active Directory (AD)? +====== + +Single Sign On (SSO) Authentication is an implemented in most of the organizations due to multiple applications access. + +It allows a user to logs in with a single ID and password to all the applications which is available in the organization. + +It uses a centralized authentication system for all the applications. + +A while ago we had written an article, **[how to integrate Linux system with AD][1]**. + +Today we are going to show you, how to check that the Linux system is integrated with AD using multiple ways. + +It can be done in four ways and we will explain one by one. + + * **`ps Command:`** It report a snapshot of the current processes. + * **`id Command:`** It prints user identity. + * **`/etc/nsswitch.conf file:`** It is Name Service Switch configuration file. + * **`/etc/pam.d/system-auth file:`** It is Common configuration file for PAMified services. + + + +### How To Identify That The Linux Server Is Integrated With AD Using PS Command? + +ps command displays information about a selection of the active processes. + +To integrate the Linux server with AD, we need to use either `winbind` or `sssd` or `ldap` service. + +So, use the ps command to filter these services. + +If you found any of these services is running on system then we can decide that the system is currently integrate with AD using “winbind” or “sssd” or “ldap” service. + +You might get the output similar to below if the system is integrated with AD using `SSSD` service. + +``` +# ps -ef | grep -i "winbind\|sssd" + +root 29912 1 0 2017 ? 00:19:09 /usr/sbin/sssd -f -D +root 29913 29912 0 2017 ? 04:36:59 /usr/libexec/sssd/sssd_be --domain 2daygeek.com --uid 0 --gid 0 --debug-to-files +root 29914 29912 0 2017 ? 00:29:28 /usr/libexec/sssd/sssd_nss --uid 0 --gid 0 --debug-to-files +root 29915 29912 0 2017 ? 00:09:19 /usr/libexec/sssd/sssd_pam --uid 0 --gid 0 --debug-to-files +root 31584 26666 0 13:41 pts/3 00:00:00 grep sssd +``` + +You might get the output similer to below if the system is integrated with AD using `winbind` service. + +``` +# ps -ef | grep -i "winbind\|sssd" + +root 676 21055 0 2017 ? 00:00:22 winbindd +root 958 21055 0 2017 ? 00:00:35 winbindd +root 21055 1 0 2017 ? 00:59:07 winbindd +root 21061 21055 0 2017 ? 11:48:49 winbindd +root 21062 21055 0 2017 ? 00:01:28 winbindd +root 21959 4570 0 13:50 pts/2 00:00:00 grep -i winbind\|sssd +root 27780 21055 0 2017 ? 00:00:21 winbindd +``` + +### How To Identify That The Linux Server Is Integrated With AD Using id Command? + +It Prints information for given user name, or the current user. It displays the UID, GUID, User Name, Primary Group Name and Secondary Group Name, etc., + +If the Linux system is integrated with AD then you might get the output like below. The GID clearly shows that the user is coming from AD “domain users”. + +``` +# id daygeek + +uid=1918901106(daygeek) gid=1918900513(domain users) groups=1918900513(domain users) +``` + +### How To Identify That The Linux Server Is Integrated With AD Using nsswitch.conf file? + +The Name Service Switch (NSS) configuration file, `/etc/nsswitch.conf`, is used by the GNU C Library and certain other applications to determine the sources from which to obtain name-service information in a range of categories, and in what order. Each category of information is identified by a database name. + +You might get the output similar to below if the system is integrated with AD using `SSSD` service. + +``` +# cat /etc/nsswitch.conf | grep -i "sss\|winbind\|ldap" + +passwd: files sss +shadow: files sss +group: files sss +services: files sss +netgroup: files sss +automount: files sss +``` + +You might get the output similar to below if the system is integrated with AD using `winbind` service. + +``` +# cat /etc/nsswitch.conf | grep -i "sss\|winbind\|ldap" + +passwd: files [SUCCESS=return] winbind +shadow: files [SUCCESS=return] winbind +group: files [SUCCESS=return] winbind +``` + +You might get the output similer to below if the system is integrated with AD using `ldap` service. + +``` +# cat /etc/nsswitch.conf | grep -i "sss\|winbind\|ldap" + +passwd: files ldap +shadow: files ldap +group: files ldap +``` + +### How To Identify That The Linux Server Is Integrated With AD Using system-auth file? + +It is Common configuration file for PAMified services. + +PAM stands for Pluggable Authentication Module that provides dynamic authentication support for applications and services in Linux. + +system-auth configuration file is provide a common interface for all applications and service daemons calling into the PAM library. + +The system-auth configuration file is included from nearly all individual service configuration files with the help of the include directive. + +You might get the output similar to below if the system is integrated with AD using `SSSD` service. + +``` +# cat /etc/pam.d/system-auth | grep -i "pam_sss.so\|pam_winbind.so\|pam_ldap.so" +or +# cat /etc/pam.d/system-auth-ac | grep -i "pam_sss.so\|pam_winbind.so\|pam_ldap.so" + +auth sufficient pam_sss.so use_first_pass +account [default=bad success=ok user_unknown=ignore] pam_sss.so +password sufficient pam_sss.so use_authtok +session optional pam_sss.so +``` + +You might get the output similar to below if the system is integrated with AD using `winbind` service. + +``` +# cat /etc/pam.d/system-auth | grep -i "pam_sss.so\|pam_winbind.so\|pam_ldap.so" +or +# cat /etc/pam.d/system-auth-ac | grep -i "pam_sss.so\|pam_winbind.so\|pam_ldap.so" + +auth sufficient pam_winbind.so cached_login use_first_pass +account [default=bad success=ok user_unknown=ignore] pam_winbind.so cached_login +password sufficient pam_winbind.so cached_login use_authtok +``` + +You might get the output similar to below if the system is integrated with AD using `ldap` service. + +``` +# cat /etc/pam.d/system-auth | grep -i "pam_sss.so\|pam_winbind.so\|pam_ldap.so" +or +# cat /etc/pam.d/system-auth-ac | grep -i "pam_sss.so\|pam_winbind.so\|pam_ldap.so" + +auth sufficient pam_ldap.so cached_login use_first_pass +account [default=bad success=ok user_unknown=ignore] pam_ldap.so cached_login +password sufficient pam_ldap.so cached_login use_authtok +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/how-to-identify-that-the-linux-server-is-integrated-with-active-directory-ad/ + +作者:[Vinoth Kumar][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/vinoth/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/join-integrate-rhel-centos-linux-system-to-windows-active-directory-ad-domain/ From f14d756e72062fe367019bc859939788a80c99ee Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 19:39:23 +0800 Subject: [PATCH 134/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190222=20Develo?= =?UTF-8?q?per=20happiness:=20What=20you=20need=20to=20know=20sources/talk?= =?UTF-8?q?/20190222=20Developer=20happiness-=20What=20you=20need=20to=20k?= =?UTF-8?q?now.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...eloper happiness- What you need to know.md | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 sources/talk/20190222 Developer happiness- What you need to know.md diff --git a/sources/talk/20190222 Developer happiness- What you need to know.md b/sources/talk/20190222 Developer happiness- What you need to know.md new file mode 100644 index 0000000000..8ef7772193 --- /dev/null +++ b/sources/talk/20190222 Developer happiness- What you need to know.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Developer happiness: What you need to know) +[#]: via: (https://opensource.com/article/19/2/developer-happiness) +[#]: author: (Bart Copeland https://opensource.com/users/bartcopeland) + +Developer happiness: What you need to know +====== +Developers need the tools and the freedom to code quickly, without getting bogged down by compliance and security. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_happy_sad_developer_programming.png?itok=72nkfSQ_) + +A person needs the right tools for the job. There's nothing as frustrating as getting halfway through a car repair, for instance, only to discover you don't have the specialized tool you need to complete the job. The same concept applies to developers: you need the tools to do what you are best at, without disrupting your workflow with compliance and security needs, so you can produce code faster. + +Over half—51%, to be specific—of developers spend only one to four hours each day programming, according to ActiveState's recent [Developer Survey 2018: Open Source Runtime Pains][1]. In other words, the majority of developers spend less than half of their time coding. According to the survey, 50% of developers say security is one of their biggest concerns, but 67% of developers choose not to add a new language when coding because of the difficulties related to corporate policies. + +The result is developers have to devote time to non-coding activities like retrofitting software for security and compliance criteria checked after software and languages have been built. And they won't choose the best tool or language for the job because of corporate policies. Their satisfaction goes down and risk goes up. + +So, developers aren't able to devote time to high-value work. This creates additional business risk because their time-to-market is slowed, and the organization increases tech debt by not empowering developers to decide on "the best" tech, unencumbered by corporate policy drag. + +### Baking in security and compliance workflows + +How can we solve this issue? One way is to integrate security and compliance workflows into the software development process in four easy steps: + +#### 1\. Gather your forces + +Get support from everyone involved. This is an often-forgotten but critical first step. Make sure to consider a wide range of stakeholders, including: + + * DevOps + * Developers + * InfoSec + * Legal/compliance + * IT security + + + +Stakeholders want to understand the business benefits, so make a solid case for eliminating the security and compliance checkpoints after software builds. You can consider any (or all) of the following in building your business case: time savings, opportunity cost, and developer productivity. By integrating security and compliance workflows into the development process, you also avoid retrofitting of languages. + +#### 2\. Find trustworthy sources + +Next, choose the trusted sources that can be used, along with their license and security requirements. Consider including information such as: + + * Restrictions on usage based on environment or application type and version controls per language + * Which open source components are allowable, e.g., specific packages + * Which licenses can be used in which types of environments (e.g., research vs. production) + * The definition of security levels, acceptable vulnerability risk levels, what risk levels trigger an action, what that action would be, and who would be responsible for its implementation + + + +#### 3\. Incorporate security and compliance from day one + +The upshot of incorporating security and compliance workflows is that it ultimately bakes security and compliance into the first line of code. It eliminates the drag of corporate policy because you're coding to spec versus having to fix things after the fact. But to do this, consider mechanisms for automatically scanning code as it's being built, along with using agentless monitoring of your runtime code. You're freeing up your time, and you'll also be able to programmatically enforce policies to ensure compliance across your entire organization. + +New vulnerabilities arise, and new patches and versions become available. Consequently, security and compliance need to be considered when deploying code into production and also when running code. You need to know what, if any, code is at risk and where that code is running. So, the process for deploying and running code should include monitoring, reporting, and updating code in production. + +By integrating security and compliance into your software development process from the start, you can also benefit by tracking where your code is running once deployed and be alerted of new threats as they arise. You will be able to track when your applications were vulnerable and respond with automatic enforcement of your software policies. + +If your software development process has security and compliance workflows baked in, you will improve your productivity. And you'll be able to measure value through increased time spent coding; gains in security and stability; and cost- and time-savings in maintenance and discovery of security and compliance threats. + +### Happiness through integration + +If you don't develop and update software, your organization can't go forward. Developers are a linchpin in the success of your company, which means they need the tools and the freedom to code quickly. You can't let compliance and security needs—though they are critical—bog you down. Developers clearly worry about security, so the happy medium is to "shift left" and integrate security and compliance workflows from the start. You'll get more done, get it right the first time, and spend far less time retrofitting code. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/developer-happiness + +作者:[Bart Copeland][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/bartcopeland +[b]: https://github.com/lujun9972 +[1]: https://www.activestate.com/company/press/press-releases/activestate-developer-survey-examines-open-source-challenges/ From bf484d4c877535713329ba0b34cdd799fba27584 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 19:40:40 +0800 Subject: [PATCH 135/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190225=20Netboo?= =?UTF-8?q?t=20a=20Fedora=20Live=20CD=20sources/tech/20190225=20Netboot=20?= =?UTF-8?q?a=20Fedora=20Live=20CD.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20190225 Netboot a Fedora Live CD.md | 187 ++++++++++++++++++ 1 file changed, 187 insertions(+) create mode 100644 sources/tech/20190225 Netboot a Fedora Live CD.md diff --git a/sources/tech/20190225 Netboot a Fedora Live CD.md b/sources/tech/20190225 Netboot a Fedora Live CD.md new file mode 100644 index 0000000000..2767719b8c --- /dev/null +++ b/sources/tech/20190225 Netboot a Fedora Live CD.md @@ -0,0 +1,187 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Netboot a Fedora Live CD) +[#]: via: (https://fedoramagazine.org/netboot-a-fedora-live-cd/) +[#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/) + +Netboot a Fedora Live CD +====== + +![](https://fedoramagazine.org/wp-content/uploads/2019/02/netboot-livecd-816x345.jpg) + +[Live CDs][1] are useful for many tasks such as: + + * installing the operating system to a hard drive + * repairing a boot loader or performing other rescue-mode operations + * providing a consistent and minimal environment for web browsing + * …and [much more][2]. + + + +As an alternative to using DVDs and USB drives to store your Live CD images, you can upload them to an [iSCSI][3] server where they will be less likely to get lost or damaged. This guide shows you how to load your Live CD images onto an iSCSI server and access them with the [iPXE][4] boot loader. + +### Download a Live CD Image + +``` +$ MY_RLSE=27 +$ MY_LIVE=$(wget -q -O - https://dl.fedoraproject.org/pub/archive/fedora/linux/releases/$MY_RLSE/Workstation/x86_64/iso | perl -ne '/(Fedora[^ ]*?-Live-[^ ]*?\.iso)(?{print $^N})/;') +$ MY_NAME=fc$MY_RLSE +$ wget -O $MY_NAME.iso https://dl.fedoraproject.org/pub/archive/fedora/linux/releases/$MY_RLSE/Workstation/x86_64/iso/$MY_LIVE +``` + +The above commands download the Fedora-Workstation-Live-x86_64-27-1.6.iso Fedora Live image and save it as fc27.iso. Change the value of MY_RLSE to download other archived versions. Or you can browse to to download the latest Fedora live image. Versions prior to 21 used different naming conventions, and must be [downloaded manually here][5]. If you download a Live CD image manually, set the MY_NAME variable to the basename of the file without the extension. That way the commands in the following sections will reference the correct file. + +### Convert the Live CD Image + +Use the livecd-iso-to-disk tool to convert the ISO file to a disk image and add the netroot parameter to the embedded kernel command line: + +``` +$ sudo dnf install -y livecd-tools +$ MY_SIZE=$(du -ms $MY_NAME.iso | cut -f 1) +$ dd if=/dev/zero of=$MY_NAME.img bs=1MiB count=0 seek=$(($MY_SIZE+512)) +$ MY_SRVR=server-01.example.edu +$ MY_RVRS=$(echo $MY_SRVR | tr '.' "\n" | tac | tr "\n" '.' | cut -b -${#MY_SRVR}) +$ MY_LOOP=$(sudo losetup --show --nooverlap --find $MY_NAME.img) +$ sudo livecd-iso-to-disk --format --extra-kernel-args netroot=iscsi:$MY_SRVR:::1:iqn.$MY_RVRS:$MY_NAME $MY_NAME.iso $MY_LOOP +$ sudo losetup -d $MY_LOOP +``` + +### Upload the Live Image to your Server + +Create a directory on your iSCSI server to store your live images and then upload your modified image to it. + +**For releases 21 and greater:** + +``` +$ MY_FLDR=/images +$ scp $MY_NAME.img $MY_SRVR:$MY_FLDR/ +``` + +**For releases prior to 21:** + +``` +$ MY_FLDR=/images +$ MY_LOOP=$(sudo losetup --show --nooverlap --find --partscan $MY_NAME.img) +$ sudo tune2fs -O ^has_journal ${MY_LOOP}p1 +$ sudo e2fsck ${MY_LOOP}p1 +$ sudo dd status=none if=${MY_LOOP}p1 | ssh $MY_SRVR "dd of=$MY_FLDR/$MY_NAME.img" +$ sudo losetup -d $MY_LOOP +``` + +### Define the iSCSI Target + +Run the following commands on your iSCSI server: + +``` +$ sudo -i +# MY_NAME=fc27 +# MY_FLDR=/images +# MY_SRVR=`hostname` +# MY_RVRS=$(echo $MY_SRVR | tr '.' "\n" | tac | tr "\n" '.' | cut -b -${#MY_SRVR}) +# cat << END > /etc/tgt/conf.d/$MY_NAME.conf + + backing-store $MY_FLDR/$MY_NAME.img + readonly 1 + allow-in-use yes + +END +# tgt-admin --update ALL +``` + +### Create a Bootable USB Drive + +The [iPXE][4] boot loader has a [sanboot][6] command you can use to connect to and start the live images hosted on your iSCSI server. It can be compiled in many different [formats][7]. The format that works best depends on the type of hardware you’re running. As an example, the following instructions show how to [chain load][8] iPXE from [syslinux][9] on a USB drive. + +First, download iPXE and build it in its lkrn format. This should be done as a normal user on a workstation: + +``` +$ sudo dnf install -y git +$ git clone http://git.ipxe.org/ipxe.git $HOME/ipxe +$ sudo dnf groupinstall -y "C Development Tools and Libraries" +$ cd $HOME/ipxe/src +$ make clean +$ make bin/ipxe.lkrn +$ cp bin/ipxe.lkrn /tmp +``` + +Next, prepare a USB drive with a MSDOS partition table and a FAT32 file system. The below commands assume that you have already connected the USB drive to be formatted. **Be careful that you do not format the wrong drive!** + +``` +$ sudo -i +# dnf install -y parted util-linux dosfstools +# echo; find /dev/disk/by-id ! -regex '.*-part.*' -name 'usb-*' -exec readlink -f {} \; | xargs -i bash -c "parted -s {} unit MiB print | perl -0 -ne '/^Model: ([^(]*).*\n.*?([0-9]*MiB)/i && print \"Found: {} = \$2 \$1\n\"'"; echo; read -e -i "$(find /dev/disk/by-id ! -regex '.*-part.*' -name 'usb-*' -exec readlink -f {} \; -quit)" -p "Drive to format: " MY_USB +# umount $MY_USB? +# wipefs -a $MY_USB +# parted -s $MY_USB mklabel msdos mkpart primary fat32 1MiB 100% set 1 boot on +# mkfs -t vfat -F 32 ${MY_USB}1 +``` + +Finally, install syslinux on the USB drive and configure it to chain load iPXE: + +``` +# dnf install -y syslinux-nonlinux +# syslinux -i ${MY_USB}1 +# dd if=/usr/share/syslinux/mbr.bin of=${MY_USB} +# MY_MNT=$(mktemp -d) +# mount ${MY_USB}1 $MY_MNT +# MY_NAME=fc27 +# MY_SRVR=server-01.example.edu +# MY_RVRS=$(echo $MY_SRVR | tr '.' "\n" | tac | tr "\n" '.' | cut -b -${#MY_SRVR}) +# cat << END > $MY_MNT/syslinux.cfg +ui menu.c32 +default $MY_NAME +timeout 100 +menu title SYSLINUX +label $MY_NAME + menu label ${MY_NAME^^} + kernel ipxe.lkrn + append dhcp && sanboot iscsi:$MY_SRVR:::1:iqn.$MY_RVRS:$MY_NAME +END +# cp /usr/share/syslinux/menu.c32 $MY_MNT +# cp /usr/share/syslinux/libutil.c32 $MY_MNT +# cp /tmp/ipxe.lkrn $MY_MNT +# umount ${MY_USB}1 +``` + +You should be able to use this same USB drive to netboot additional iSCSI targets simply by editing the syslinux.cfg file and adding additional menu entries. + +This is just one method of loading iPXE. You could install syslinux directly on your workstation. Another option is to compile iPXE as an EFI executable and place it directly in your [ESP][10]. Yet another is to compile iPXE as a PXE loader and place it on your TFTP server to be referenced by DHCP. The best option depends on your environment. + +### Final Notes + + * You may want to add the –filename \EFI\BOOT\grubx64.efi parameter to the sanboot command if you compile iPXE in its EFI format. + * It is possible to create custom live images. Refer to [Creating and using live CD][11] for more information. + * It is possible to add the –overlay-size-mb and –home-size-mb parameters to the livecd-iso-to-disk command to create live images with persistent storage. However, if you have multiple concurrent users, you’ll need to set up your iSCSI server to manage separate per-user writeable overlays. This is similar to what was shown in the “[How to Build a Netboot Server, Part 4][12]” article. + * The live images support a persistenthome option on their kernel command line (e.g. persistenthome=LABEL=HOME). Used together with CHAP-authenticated iSCSI targets, the persistenthome option provides an interesting alternative to NFS for centralized home directories. + + + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/netboot-a-fedora-live-cd/ + +作者:[Gregory Bartholomew][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/glb/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Live_CD +[2]: https://en.wikipedia.org/wiki/Live_CD#Uses +[3]: https://en.wikipedia.org/wiki/ISCSI +[4]: https://ipxe.org/ +[5]: https://dl.fedoraproject.org/pub/archive/fedora/linux/releases/https://dl.fedoraproject.org/pub/archive/fedora/linux/releases/ +[6]: http://ipxe.org/cmd/sanboot/ +[7]: https://ipxe.org/appnote/buildtargets#boot_type +[8]: https://en.wikipedia.org/wiki/Chain_loading +[9]: https://www.syslinux.org/wiki/index.php?title=SYSLINUX +[10]: https://en.wikipedia.org/wiki/EFI_system_partition +[11]: https://docs.fedoraproject.org/en-US/quick-docs/creating-and-using-a-live-installation-image/#proc_creating-and-using-live-cd +[12]: https://fedoramagazine.org/how-to-build-a-netboot-server-part-4/ From 3abd57f36de62d4c5b2b2a737d1daa45c3ef0b7a Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 19:42:56 +0800 Subject: [PATCH 136/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190225=20How=20?= =?UTF-8?q?to=20Install=20VirtualBox=20on=20Ubuntu=20[Beginner=E2=80=99s?= =?UTF-8?q?=20Tutorial]=20sources/tech/20190225=20How=20to=20Install=20Vir?= =?UTF-8?q?tualBox=20on=20Ubuntu=20-Beginner-s=20Tutorial.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...rtualBox on Ubuntu -Beginner-s Tutorial.md | 156 ++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 sources/tech/20190225 How to Install VirtualBox on Ubuntu -Beginner-s Tutorial.md diff --git a/sources/tech/20190225 How to Install VirtualBox on Ubuntu -Beginner-s Tutorial.md b/sources/tech/20190225 How to Install VirtualBox on Ubuntu -Beginner-s Tutorial.md new file mode 100644 index 0000000000..4ba0580ece --- /dev/null +++ b/sources/tech/20190225 How to Install VirtualBox on Ubuntu -Beginner-s Tutorial.md @@ -0,0 +1,156 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Install VirtualBox on Ubuntu [Beginner’s Tutorial]) +[#]: via: (https://itsfoss.com/install-virtualbox-ubuntu) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +How to Install VirtualBox on Ubuntu [Beginner’s Tutorial] +====== + +**This beginner’s tutorial explains various ways to install VirtualBox on Ubuntu and other Debian-based Linux distributions.** + +Oracle’s free and open source offering [VirtualBox][1] is an excellent virtualization tool, specially for desktop operating systems. I prefer using it over [VMWare Workstation in Linux][2], another virtualization tool. + +You can use virtualization software like VirtualBox for installing and using another operating system within a virtual machine. + +For example, you can [install Linux on VirtualBox inside Windows][3]. Similarly, you can also [install Windows inside Linux using VirtualBox][4]. + +You can also use VirtualBox for installing another Linux distribution in your current Linux system. Actually, this is what I use it for. If I hear about a nice Linux distribution, instead of installing it on a real system, I test it on a virtual machine. It’s more convenient when you just want to try out a distribution before making a decision about installing it on your actual machine. + +![Linux installed inside Linux using VirtualBox][5]Ubuntu 18.10 installed inside Ubuntu 18.04 + +In this beginner’s tutorial, I’ll show you various ways of installing Oracle VirtualBox on Ubuntu and other Debian-based distributions. + +### Installing VirtualBox on Ubuntu and Debian based Linux distributions + +The installation methods mentioned here should also work for other Debian and Ubuntu-based Linux distributions such as Linux Mint, elementary OS etc. + +#### Method 1: Install VirtualBox from Ubuntu Repository + +**Pros** : Easy installation + +**Cons** : Installs older version + +The easiest way to install VirtualBox on Ubuntu would be to search for it in the Software Center and install it from there. + +![VirtualBox in Ubuntu Software Center][6]VirtualBox is available in Ubuntu Software Center + +You can also install it from the command line using the command: + +``` +sudo apt install virtualbox +``` + +However, if you [check the package version before installing it][7], you’ll see that the VirtualBox provided by Ubuntu’s repository is quite old. + +For example, the current VirtualBox version at the time of writing this tutorial is 6.0 but the one in Software Center is 5.2. This means you won’t get the newer features introduced in the [latest version of VirtualBox][8]. + +#### Method 2: Install VirtualBox using Deb file from Oracle’s website + +**Pros** : Easily install the latest version + +**Cons** : Can’t upgrade to newer version + +If you want to use the latest version of VirtualBox on Ubuntu, the easiest way would be to [use the deb file][9]. + +Oracle provides read to use binary files for VirtualBox releases. If you look at its download page, you’ll see the option to download the deb installer files for Ubuntu and other distributions. + +![VirtualBox Linux Download][10] + +You just have to download this deb file and double click on it to install it. It’s as simple as that. + +However, the problem with this method is that you won’t get automatically updated to the newer VirtualBox releases. The only way is to remove the existing version, download the newer version and install it again. That’s not very convenient, is it? + +#### Method 3: Install VirualBox using Oracle’s repository + +**Pros** : Automatically updates with system updates + +**Cons** : Slightly complicated installation + +Now this is the command line method and it may seem complicated to you but it has advantages over the previous two methods. You’ll get the latest version of VirtualBox and it will be automatically updated to the future releases. That’s what you would want, I presume. + +To install VirtualBox using command line, you add the Oracle VirtualBox’s repository in your list of repositories. You add its GPG key so that your system trusts this repository. Now when you install VirtualBox, it will be installed from Oracle’s repository instead of Ubuntu’s repository. If there is a new version released, VirtualBox install will be updated along with the system updates. Let’s see how to do that. + +First, add the key for the repository. You can download and add the key using this single command. + +``` +wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add - +``` + +``` +Important for Mint users + +The next step will work for Ubuntu only. If you are using Linux Mint or some other distribution based on Ubuntu, replace $(lsb_release -cs) in the command with the Ubuntu version your current version is based on. For example, Linux Mint 19 series users should use bionic and Mint 18 series users should use xenial. Something like this + +sudo add-apt-repository “deb [arch=amd64] **bionic** contrib“ +``` + +Now add the Oracle VirtualBox repository in the list of repositories using this command: + +``` +sudo add-apt-repository "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" +``` + +If you have read my article on [checking Ubuntu version][11], you probably know that ‘lsb_release -cs’ will print the codename of your Ubuntu system. + +**Note** : If you see [add-apt-repository command not found][12] error, you’ll have to install software-properties-common package. + +Now that you have the correct repository added, refresh the list of available packages through these repositories and install VirtualBox. + +``` +sudo apt update && sudo apt install virtualbox-6.0 +``` + +**Tip** : A good idea would be to type sudo apt install **virtualbox–** and hit tab to see the various VirtualBox versions available for installation and then select one of them by typing it completely. + +![Install VirtualBox via terminal][13] + +### How to remove VirtualBox from Ubuntu + +Now that you have learned to install VirtualBox, I would also mention the steps to remove it. + +If you installed it from the Software Center, the easiest way to remove the application is from the Software Center itself. You just have to find it in the [list of installed applications][14] and click the Remove button. + +Another ways is to use the command line. + +``` +sudo apt remove virtualbox virtualbox-* +``` + +Note that this will not remove the virtual machines and the files associated with the operating systems you installed using VirtualBox. That’s not entirely a bad thing because you may want to keep them safe to use it later or in some other system. + +**In the end…** + +I hope you were able to pick one of the methods to install VirtualBox. I’ll also write about using it effectively in another article. For the moment, if you have and tips or suggestions or any questions, feel free to leave a comment below. + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-virtualbox-ubuntu + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.virtualbox.org +[2]: https://itsfoss.com/install-vmware-player-ubuntu-1310/ +[3]: https://itsfoss.com/install-linux-in-virtualbox/ +[4]: https://itsfoss.com/install-windows-10-virtualbox-linux/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/linux-inside-linux-virtualbox.png?resize=800%2C450&ssl=1 +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/virtualbox-ubuntu-software-center.jpg?ssl=1 +[7]: https://itsfoss.com/know-program-version-before-install-ubuntu/ +[8]: https://itsfoss.com/oracle-virtualbox-release/ +[9]: https://itsfoss.com/install-deb-files-ubuntu/ +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/virtualbox-download.jpg?resize=800%2C433&ssl=1 +[11]: https://itsfoss.com/how-to-know-ubuntu-unity-version/ +[12]: https://itsfoss.com/add-apt-repository-command-not-found/ +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/install-virtualbox-ubuntu-terminal.png?resize=800%2C165&ssl=1 +[14]: https://itsfoss.com/list-installed-packages-ubuntu/ From 1475813bda920ca419bb42ed0a8f47d892c5f8d6 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 19:48:48 +0800 Subject: [PATCH 137/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190225=20Teachi?= =?UTF-8?q?ng=20scientists=20how=20to=20share=20code=20sources/talk/201902?= =?UTF-8?q?25=20Teaching=20scientists=20how=20to=20share=20code.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...5 Teaching scientists how to share code.md | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 sources/talk/20190225 Teaching scientists how to share code.md diff --git a/sources/talk/20190225 Teaching scientists how to share code.md b/sources/talk/20190225 Teaching scientists how to share code.md new file mode 100644 index 0000000000..074da27476 --- /dev/null +++ b/sources/talk/20190225 Teaching scientists how to share code.md @@ -0,0 +1,72 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Teaching scientists how to share code) +[#]: via: (https://opensource.com/article/19/2/open-science-git) +[#]: author: (Jon Tennant https://opensource.com/users/jon-tennant) + +Teaching scientists how to share code +====== +This course teaches them how to set up a GitHub project, index their project in Zenodo, and integrate Git into an RStudio workflow. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003588_01_rd3os.combacktoschoolserieshe_rh_051x_0.png?itok=gIzbmxuI) + +Would it surprise you to learn that most of the world's scholarly research is not owned by the people who funded it or who created it? Rather it's owned by private corporations and locked up in proprietary systems, leading to [problems][1] around sharing, reuse, and reproducibility. + +The open science movement is challenging this system, aiming to give researchers control, ownership, and freedom over their work. The [Open Science MOOC][2] (massively open online community) is a mission-driven project launched in 2018 to kick-start an open scientific revolution and foster more partnerships between open source software and open science. + +The Open Science MOOC is a peer-to-peer community of practice, based around sharing knowledge and ideas, learning new skills, and using these things to develop as individuals so research communities can grow as part of a wider cultural shift towards openness. + +### The curriculum + +The Open Science MOOC is divided into 10 core modules, from the principles of open science to becoming an open science advocate. + +The first module, [Open Research Software and Open Source][3], was released in late 2018. It includes three main tasks, all designed to help make research workflows more efficient and more open for collaboration: + +#### 1\. Setting up your first GitHub project + +GitHub is a powerful project management tool, both for coders and non-coders. This task teaches how to create a community around the platform, select an appropriate license, and write good documentation (including README files, contributing guidelines, and codes of conduct) to foster open collaboration and a welcoming community. + +#### 2\. Indexing your project in Zenodo + +[Zenodo][4] is an open science platform that seamlessly integrates with GitHub to help make projects more permanent, reusable, and citable. This task explains how webhooks between Zenodo and GitHub allow new versions of projects to become permanently archived as they progress. This is critical for helping researchers get a [DOI][5] for their work so they can receive full credit for all aspects of a project. As citations are still a primary form of "academic capital," this is essential for researchers. + +#### 3\. Integrating Git into an RStudio workflow + +This task is about giving research a mega-boost through greater collaborative efficiency and reproducibility. Git enables version control in all forms of text-based content, including data analysis and writing papers. Each time you save your work during the development process, Git saves time-stamped copies. This saves the hassle of trying to "roll back" projects if you delete a file or text by mistake, and eliminates horrific file-naming conventions. (For example, does FINAL_Revised_2.2_supervisor_edits_ver1.7_scream.txt look familiar?) Getting Git to interface with RStudio is the painful part, but this task goes through it, step by step, to ease the stress. + +The third task also gives students the ability to interact directly with the MOOC by submitting pull requests to demonstrate their skills. This also adds their name to an online list of open source champions (aka "open sourcerers"). + +The MOOC's inherently interactive style is much more valuable than listening to someone talk at you, either on or off screen, like with many traditional online courses or educational programs. Each task is backed up by expert-gathered knowledge, so students get a rigorous, dual-learning experience. + +### Empowering researchers + +The Open Science MOOC strives to be as open as possible—this means we walk the walk and talk the talk. We are built upon a solid values-based foundation of freedom and equitable access to research. We see this route towards widespread adoption of best scientific practices as an essential part of the research process. + +Everything we produce is openly developed and openly licensed for maximum engagement, sharing, and reuse. An open source workflow underpins our development. All of this happens openly around channels such as [Slack][6] and [GitHub][7] and helps to make the community much more coherent. + +If we can instill the value of open source into modern research, this would empower current and future generations of researchers to think more about fundamental freedoms around knowledge production. We think that is something worth working towards as a community. + +The Open Science MOOC combines the best elements of the open education, open science, and open source worlds. If you're ready to join, [sign up for the full course][3], which is, of course, free. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/open-science-git + +作者:[Jon Tennant][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jon-tennant +[b]: https://github.com/lujun9972 +[1]: https://www.theguardian.com/science/political-science/2018/jun/29/elsevier-are-corrupting-open-science-in-europe +[2]: https://opensciencemooc.eu/ +[3]: https://eliademy.com/catalog/oer/module-5-open-research-software-and-open-source.html +[4]: https://zenodo.org/ +[5]: https://en.wikipedia.org/wiki/Digital_object_identifier +[6]: https://osmooc.herokuapp.com/ +[7]: https://open-science-mooc-invite.herokuapp.com/ From 338c29dfa1736eda1680480ef9354c288bf01bd1 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 6 Mar 2019 19:55:50 +0800 Subject: [PATCH 138/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190205=205=20Li?= =?UTF-8?q?nux=20GUI=20Cloud=20Backup=20Tools=20sources/tech/20190205=205?= =?UTF-8?q?=20Linux=20GUI=20Cloud=20Backup=20Tools.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...20190205 5 Linux GUI Cloud Backup Tools.md | 251 ++++++++++++++++++ 1 file changed, 251 insertions(+) create mode 100644 sources/tech/20190205 5 Linux GUI Cloud Backup Tools.md diff --git a/sources/tech/20190205 5 Linux GUI Cloud Backup Tools.md b/sources/tech/20190205 5 Linux GUI Cloud Backup Tools.md new file mode 100644 index 0000000000..45e0bf1342 --- /dev/null +++ b/sources/tech/20190205 5 Linux GUI Cloud Backup Tools.md @@ -0,0 +1,251 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 Linux GUI Cloud Backup Tools) +[#]: via: (https://www.linux.com/blog/learn/2019/2/5-linux-gui-cloud-backup-tools) +[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) + +5 Linux GUI Cloud Backup Tools +====== +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/cloud-m-wong-unsplash.jpg?itok=aW0mpzio) + +We have reached a point in time where most every computer user depends upon the cloud … even if only as a storage solution. What makes the cloud really important to users, is when it’s employed as a backup. Why is that such a game changer? By backing up to the cloud, you have access to those files, from any computer you have associated with your cloud account. And because Linux powers the cloud, many services offer Linux tools. + +Let’s take a look at five such tools. I will focus on GUI tools, because they offer a much lower barrier to entry to many of the CLI tools. I’ll also be focusing on various, consumer-grade cloud services (e.g., [Google Drive][1], [Dropbox][2], [Wasabi][3], and [pCloud][4]). And, I will be demonstrating on the Elementary OS platform, but all of the tools listed will function on most Linux desktop distributions. + +Note: Of the following backup solutions, only Duplicati is licensed as open source. With that said, let’s see what’s available. + +### Insync + +I must confess, [Insync][5] has been my cloud backup of choice for a very long time. Since Google refuses to release a Linux desktop client for Google Drive (and I depend upon Google Drive daily), I had to turn to a third-party solution. Said solution is Insync. This particular take on syncing the desktop to Drive has not only been seamless, but faultless since I began using the tool. + +The cost of Insync is a one-time $29.99 fee (per Google account). Trust me when I say this tool is worth the price of entry. With Insync you not only get an easy-to-use GUI for managing your Google Drive backup and sync, you get a tool (Figure 1) that gives you complete control over what is backed up and how it is backed up. Not only that, but you can also install Nautilus integration (which also allows you to easy add folders outside of the configured Drive sync destination). + +![Insync app][7] + +Figure 1: The Insync app window on Elementary OS. + +[Used with permission][8] + +You can download Insync for Ubuntu (or its derivatives), Linux Mint, Debian, and Fedora from the [Insync download page][9]. Once you’ve installed Insync (and associated it with your account), you can then install Nautilus integration with these steps (demonstrating on Elementary OS): + + 1. Open a terminal window and issue the command sudo nano /etc/apt/sources.list.d/insync.list. + + 2. Paste the following into the new file: deb precise non-free contrib. + + 3. Save and close the file. + + 4. Update apt with the command sudo apt-get update. + + 5. Install the necessary package with the command sudo apt-get install insync-nautilus. + + + + +Allow the installation to complete. Once finished, restart Nautilus with the command nautilus -q (or log out and back into the desktop). You should now see an Insync entry in the Nautilus right-click context menu (Figure 2). + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/insync_2.jpg?itok=-kA0epiH) + +Figure 2: Insync/Nautilus integration in action. + +[Used with permission][8] + +### Dropbox + +Although [Dropbox][2] drew the ire of many in the Linux community (by dropping support for all filesystems but unencrypted ext4), it still supports a great deal of Linux desktop deployments. In other words, if your distribution still uses the ext4 file system (and you do not opt to encrypt your full drive), you’re good to go. + +The good news is the Dropbox Linux desktop client is quite good. The tool offers a system tray icon that allows you to easily interact with your cloud syncing. Dropbox also includes CLI tools and a Nautilus integration (by way of an additional addon found [here][10]). + +The Linux Dropbox desktop sync tool works exactly as you’d expect. From the Dropbox system tray drop-down (Figure 3) you can open the Dropbox folder, launch the Dropbox website, view recently changed files, get more space, pause syncing, open the preferences window, find help, and quite Dropbox. + +![Dropbox][12] + +Figure 3: The Dropbox system tray drop-down on Elementary OS. + +[Used with permission][8] + +The Dropbox/Nautilus integration is an important component, as it makes quickly adding to your cloud backup seamless and fast. From the Nautilus file manager, locate and right-click the folder to bad added, and select Dropbox > Move to Dropbox (Figure 4). + +The only caveat to the Dropbox/Nautilus integration is that the only option is to move a folder to Dropbox. To some this might not be an option. The developers of this package would be wise to instead have the action create a link (instead of actually moving the folder). + +Outside of that one issue, the Dropbox cloud sync/backup solution for Linux is a great route to go. + +### pCloud + +pCloud might well be one of the finest cloud backup solutions you’ve never heard of. This take on cloud storage/backup includes features like: + + * Encryption (subscription service required for this feature); + + * Mobile apps for Android and iOS; + + * Linux, Mac, and Windows desktop clients; + + * Easy file/folder sharing; + + * Built-in audio/video players; + + * No file size limitation; + + * Sync any folder from the desktop; + + * Panel integration for most desktops; and + + * Automatic file manager integration. + + + + +pCloud offers both Linux desktop and CLI tools that function quite well. pCloud offers both a free plan (with 10GB of storage), a Premium Plan (with 500GB of storage for a one-time fee of $175.00), and a Premium Plus Plan (with 2TB of storage for a one-time fee of $350.00). Both non-free plans can also be paid on a yearly basis (instead of the one-time fee). + +The pCloud desktop client is quite user-friendly. Once installed, you have access to your account information (Figure 5), the ability to create sync pairs, create shares, enable crypto (which requires an added subscription), and general settings. + +![pCloud][14] + +Figure 5: The pCloud desktop client is incredibly easy to use. + +[Used with permission][8] + +The one caveat to pCloud is there’s no file manager integration for Linux. That’s overcome by the Sync folder in the pCloud client. + +### CloudBerry + +The primary focus for [CloudBerry][15] is for Managed Service Providers. The business side of CloudBerry does have an associated cost (one that is probably well out of the price range for the average user looking for a simple cloud backup solution). However, for home usage, CloudBerry is free. + +What makes CloudBerry different than the other tools is that it’s not a backup/storage solution in and of itself. Instead, CloudBerry serves as a link between your desktop and the likes of: + + * AWS + + * Microsoft Azure + + * Google Cloud + + * BackBlaze + + * OpenStack + + * Wasabi + + * Local storage + + * External drives + + * Network Attached Storage + + * Network Shares + + * And more + + + + +In other words, you use CloudBerry as the interface between the files/folders you want to share and the destination with which you want send them. This also means you must have an account with one of the many supported solutions. +Once you’ve installed CloudBerry, you create a new Backup plan for the target storage solution. For that configuration, you’ll need such information as: + + * Access Key + + * Secret Key + + * Bucket + + + + +What you’ll need for the configuration will depend on the account you’re connecting to (Figure 6). + +![CloudBerry][17] + +Figure 6: Setting up a CloudBerry backup for Wasabi. + +[Used with permission][8] + +The one caveat to CloudBerry is that it does not integrate with any file manager, nor does it include a system tray icon for interaction with the service. + +### Duplicati + +[Duplicati][18] is another option that allows you to sync your local directories with either locally attached drives, network attached storage, or a number of cloud services. The options supported include: + + * Local folders + + * Attached drives + + * FTP/SFTP + + * OpenStack + + * WebDAV + + * Amazon Cloud Drive + + * Amazon S3 + + * Azure Blob + + * Box.com + + * Dropbox + + * Google Cloud Storage + + * Google Drive + + * Microsoft OneDrive + + * And many more + + + + +Once you install Duplicati (download the installer for Debian, Ubuntu, Fedora, or RedHat from the [Duplicati downloads page][19]), click on the entry in your desktop menu, which will open a web page to the tool (Figure 7), where you can configure the app settings, create a new backup, restore from a backup, and more. + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/duplicati_1.jpg?itok=SVf06tnv) + +To create a backup, click Add backup and walk through the easy-to-use wizard (Figure 8). The backup service you choose will dictate what you need for a successful configuration. + +![Duplicati backup][21] + +Figure 8: Creating a new Duplicati backup for Google Drive. + +[Used with permission][8] + +For example, in order to create a backup to Google Drive, you’ll need an AuthID. For that, click the AuthID link in the Destination section of the setup, where you’ll be directed to select the Google Account to associate with the backup. Once you’ve allowed Duplicati access to the account, the AuthID will fill in and you’re ready to continue. Click Test connection and you’ll be asked to okay the creation of a new folder (if necessary). Click Next to complete the setup of the backup. + +### More Where That Came From + +These five cloud backup tools aren’t the end of this particular rainbow. There are plenty more options where these came from (including CLI-only tools). But any of these backup clients will do a great job of serving your Linux desktop-to-cloud backup needs. + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2019/2/5-linux-gui-cloud-backup-tools + +作者:[Jack Wallen][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/users/jlwallen +[b]: https://github.com/lujun9972 +[1]: https://www.google.com/drive/ +[2]: https://www.dropbox.com/ +[3]: https://wasabi.com/ +[4]: https://www.pcloud.com/ +[5]: https://www.insynchq.com/ +[6]: /files/images/insync1jpg +[7]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/insync_1.jpg?itok=_SDP77uE (Insync app) +[8]: /licenses/category/used-permission +[9]: https://www.insynchq.com/downloads +[10]: https://www.dropbox.com/install-linux +[11]: /files/images/dropbox1jpg +[12]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/dropbox_1.jpg?itok=BYbg-sKB (Dropbox) +[13]: /files/images/pcloud1jpg +[14]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/pcloud_1.jpg?itok=cAUz8pya (pCloud) +[15]: https://www.cloudberrylab.com +[16]: /files/images/cloudberry1jpg +[17]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/cloudberry_1.jpg?itok=s0aP5xuN (CloudBerry) +[18]: https://www.duplicati.com/ +[19]: https://www.duplicati.com/download +[20]: /files/images/duplicati2jpg +[21]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/duplicati_2.jpg?itok=Xkn8s3jg (Duplicati backup) From e04e4a529d6f3417082d7eb98cee0c61b3253d0f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 6 Mar 2019 20:24:08 +0800 Subject: [PATCH 139/796] 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 140/796] 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 141/796] 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 142/796] 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 143/796] 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 144/796] 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 145/796] 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 146/796] =?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 147/796] 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 148/796] 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 149/796] 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 150/796] 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 151/796] 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 152/796] =?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 153/796] 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 154/796] 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 155/796] 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 156/796] 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 157/796] 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 158/796] 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 159/796] 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 160/796] 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 161/796] 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 162/796] 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 163/796] 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 164/796] 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 165/796] 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 166/796] 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 167/796] 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 168/796] 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 169/796] [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 170/796] 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 171/796] =?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 172/796] 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 173/796] 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 174/796] 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 175/796] 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 176/796] 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 177/796] 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 178/796] 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 179/796] 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 180/796] 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 181/796] 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 182/796] 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 183/796] 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 184/796] 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 185/796] 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 186/796] 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 187/796] 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 188/796] 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 189/796] 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 190/796] 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 191/796] 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 192/796] =?UTF-8?q?20180926=20=E7=BF=BB=E8=AF=91=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20180926 HTTP- Brief History of HTTP.md | 286 ------------------ .../20180926 HTTP- Brief History of HTTP.md | 274 +++++++++++++++++ 2 files changed, 274 insertions(+), 286 deletions(-) delete mode 100644 sources/tech/20180926 HTTP- Brief History of HTTP.md create mode 100644 translated/tech/20180926 HTTP- Brief History of HTTP.md diff --git a/sources/tech/20180926 HTTP- Brief History of HTTP.md b/sources/tech/20180926 HTTP- Brief History of HTTP.md deleted file mode 100644 index 64e2abfd6b..0000000000 --- a/sources/tech/20180926 HTTP- Brief History of HTTP.md +++ /dev/null @@ -1,286 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MjSeven) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (HTTP: Brief History of HTTP) -[#]: via: (https://hpbn.co/brief-history-of-http/#http-09-the-one-line-protocol) -[#]: author: (Ilya Grigorik https://www.igvita.com/) - -HTTP: Brief History of HTTP -====== - -### Introduction - -The Hypertext Transfer Protocol (HTTP) is one of the most ubiquitous and widely adopted application protocols on the Internet: it is the common language between clients and servers, enabling the modern web. From its simple beginnings as a single keyword and document path, it has become the protocol of choice not just for browsers, but for virtually every Internet-connected software and hardware application. - -In this chapter, we will take a brief historical tour of the evolution of the HTTP protocol. A full discussion of the varying HTTP semantics is outside the scope of this book, but an understanding of the key design changes of HTTP, and the motivations behind each, will give us the necessary background for our discussions on HTTP performance, especially in the context of the many upcoming improvements in HTTP/2. - -### §HTTP 0.9: The One-Line Protocol - -The original HTTP proposal by Tim Berners-Lee was designed with simplicity in mind as to help with the adoption of his other nascent idea: the World Wide Web. The strategy appears to have worked: aspiring protocol designers, take note. - -In 1991, Berners-Lee outlined the motivation for the new protocol and listed several high-level design goals: file transfer functionality, ability to request an index search of a hypertext archive, format negotiation, and an ability to refer the client to another server. To prove the theory in action, a simple prototype was built, which implemented a small subset of the proposed functionality: - - * Client request is a single ASCII character string. - - * Client request is terminated by a carriage return (CRLF). - - * Server response is an ASCII character stream. - - - - * Server response is a hypertext markup language (HTML). - - * Connection is terminated after the document transfer is complete. - - - - -However, even that sounds a lot more complicated than it really is. What these rules enable is an extremely simple, Telnet-friendly protocol, which some web servers support to this very day: - -``` -$> telnet google.com 80 - -Connected to 74.125.xxx.xxx - -GET /about/ - -(hypertext response) -(connection closed) -``` - -The request consists of a single line: `GET` method and the path of the requested document. The response is a single hypertext document—no headers or any other metadata, just the HTML. It really couldn’t get any simpler. Further, since the previous interaction is a subset of the intended protocol, it unofficially acquired the HTTP 0.9 label. The rest, as they say, is history. - -From these humble beginnings in 1991, HTTP took on a life of its own and evolved rapidly over the coming years. Let us quickly recap the features of HTTP 0.9: - - * Client-server, request-response protocol. - - * ASCII protocol, running over a TCP/IP link. - - * Designed to transfer hypertext documents (HTML). - - * The connection between server and client is closed after every request. - - -``` -Popular web servers, such as Apache and Nginx, still support the HTTP 0.9 protocol—in part, because there is not much to it! If you are curious, open up a Telnet session and try accessing google.com, or your own favorite site, via HTTP 0.9 and inspect the behavior and the limitations of this early protocol. -``` - -### §HTTP/1.0: Rapid Growth and Informational RFC - -The period from 1991 to 1995 is one of rapid coevolution of the HTML specification, a new breed of software known as a "web browser," and the emergence and quick growth of the consumer-oriented public Internet infrastructure. - -``` -##### §The Perfect Storm: Internet Boom of the Early 1990s - -Building on Tim Berner-Lee’s initial browser prototype, a team at the National Center of Supercomputing Applications (NCSA) decided to implement their own version. With that, the first popular browser was born: NCSA Mosaic. One of the programmers on the NCSA team, Marc Andreessen, partnered with Jim Clark to found Mosaic Communications in October 1994. The company was later renamed Netscape, and it shipped Netscape Navigator 1.0 in December 1994. By this point, it was already clear that the World Wide Web was bound to be much more than just an academic curiosity. - -In fact, that same year the first World Wide Web conference was organized in Geneva, Switzerland, which led to the creation of the World Wide Web Consortium (W3C) to help guide the evolution of HTML. Similarly, a parallel HTTP Working Group (HTTP-WG) was established within the IETF to focus on improving the HTTP protocol. Both of these groups continue to be instrumental to the evolution of the Web. - -Finally, to create the perfect storm, CompuServe, AOL, and Prodigy began providing dial-up Internet access to the public within the same 1994–1995 time frame. Riding on this wave of rapid adoption, Netscape made history with a wildly successful IPO on August 9, 1995—the Internet boom had arrived, and everyone wanted a piece of it! -``` - -The growing list of desired capabilities of the nascent Web and their use cases on the public Web quickly exposed many of the fundamental limitations of HTTP 0.9: we needed a protocol that could serve more than just hypertext documents, provide richer metadata about the request and the response, enable content negotiation, and more. In turn, the nascent community of web developers responded by producing a large number of experimental HTTP server and client implementations through an ad hoc process: implement, deploy, and see if other people adopt it. - -From this period of rapid experimentation, a set of best practices and common patterns began to emerge, and in May 1996 the HTTP Working Group (HTTP-WG) published RFC 1945, which documented the "common usage" of the many HTTP/1.0 implementations found in the wild. Note that this was only an informational RFC: HTTP/1.0 as we know it is not a formal specification or an Internet standard! - -Having said that, an example HTTP/1.0 request should look very familiar: - -``` -$> telnet website.org 80 - -Connected to xxx.xxx.xxx.xxx - -GET /rfc/rfc1945.txt HTTP/1.0 -User-Agent: CERN-LineMode/2.15 libwww/2.17b3 -Accept: */* - -HTTP/1.0 200 OK -Content-Type: text/plain -Content-Length: 137582 -Expires: Thu, 01 Dec 1997 16:00:00 GMT -Last-Modified: Wed, 1 May 1996 12:45:26 GMT -Server: Apache 0.84 - -(plain-text response) -(connection closed) -``` - - 1. Request line with HTTP version number, followed by request headers - - 2. Response status, followed by response headers - - - - -The preceding exchange is not an exhaustive list of HTTP/1.0 capabilities, but it does illustrate some of the key protocol changes: - - * Request may consist of multiple newline separated header fields. - - * Response object is prefixed with a response status line. - - * Response object has its own set of newline separated header fields. - - * Response object is not limited to hypertext. - - * The connection between server and client is closed after every request. - - - - -Both the request and response headers were kept as ASCII encoded, but the response object itself could be of any type: an HTML file, a plain text file, an image, or any other content type. Hence, the "hypertext transfer" part of HTTP became a misnomer not long after its introduction. In reality, HTTP has quickly evolved to become a hypermedia transport, but the original name stuck. - -In addition to media type negotiation, the RFC also documented a number of other commonly implemented capabilities: content encoding, character set support, multi-part types, authorization, caching, proxy behaviors, date formats, and more. - -``` -Almost every server on the Web today can and will still speak HTTP/1.0. Except that, by now, you should know better! Requiring a new TCP connection per request imposes a significant performance penalty on HTTP/1.0; see [Three-Way Handshake][1], followed by [Slow-Start][2]. -``` - -### §HTTP/1.1: Internet Standard - -The work on turning HTTP into an official IETF Internet standard proceeded in parallel with the documentation effort around HTTP/1.0 and happened over a period of roughly four years: between 1995 and 1999. In fact, the first official HTTP/1.1 standard is defined in RFC 2068, which was officially released in January 1997, roughly six months after the publication of HTTP/1.0. Then, two and a half years later, in June of 1999, a number of improvements and updates were incorporated into the standard and were released as RFC 2616. - -The HTTP/1.1 standard resolved a lot of the protocol ambiguities found in earlier versions and introduced a number of critical performance optimizations: keepalive connections, chunked encoding transfers, byte-range requests, additional caching mechanisms, transfer encodings, and request pipelining. - -With these capabilities in place, we can now inspect a typical HTTP/1.1 session as performed by any modern HTTP browser and client: - -``` -$> telnet website.org 80 -Connected to xxx.xxx.xxx.xxx - -GET /index.html HTTP/1.1 -Host: website.org -User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4)... (snip) -Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 -Accept-Encoding: gzip,deflate,sdch -Accept-Language: en-US,en;q=0.8 -Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 -Cookie: __qca=P0-800083390... (snip) - -HTTP/1.1 200 OK -Server: nginx/1.0.11 -Connection: keep-alive -Content-Type: text/html; charset=utf-8 -Via: HTTP/1.1 GWA -Date: Wed, 25 Jul 2012 20:23:35 GMT -Expires: Wed, 25 Jul 2012 20:23:35 GMT -Cache-Control: max-age=0, no-cache -Transfer-Encoding: chunked - -100 - -(snip) - -100 -(snip) - -0 - -GET /favicon.ico HTTP/1.1 -Host: www.website.org -User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4)... (snip) -Accept: */* -Referer: http://website.org/ -Connection: close -Accept-Encoding: gzip,deflate,sdch -Accept-Language: en-US,en;q=0.8 -Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 -Cookie: __qca=P0-800083390... (snip) - -HTTP/1.1 200 OK -Server: nginx/1.0.11 -Content-Type: image/x-icon -Content-Length: 3638 -Connection: close -Last-Modified: Thu, 19 Jul 2012 17:51:44 GMT -Cache-Control: max-age=315360000 -Accept-Ranges: bytes -Via: HTTP/1.1 GWA -Date: Sat, 21 Jul 2012 21:35:22 GMT -Expires: Thu, 31 Dec 2037 23:55:55 GMT -Etag: W/PSA-GAu26oXbDi - -(icon data) -(connection closed) -``` - - 1. Request for HTML file, with encoding, charset, and cookie metadata - - 2. Chunked response for original HTML request - - 3. Number of octets in the chunk expressed as an ASCII hexadecimal number (256 bytes) - - 4. End of chunked stream response - - 5. Request for an icon file made on same TCP connection - - 6. Inform server that the connection will not be reused - - 7. Icon response, followed by connection close - - - - -Phew, there is a lot going on in there! The first and most obvious difference is that we have two object requests, one for an HTML page and one for an image, both delivered over a single connection. This is connection keepalive in action, which allows us to reuse the existing TCP connection for multiple requests to the same host and deliver a much faster end-user experience; see [Optimizing for TCP][3]. - -To terminate the persistent connection, notice that the second client request sends an explicit `close` token to the server via the `Connection` header. Similarly, the server can notify the client of the intent to close the current TCP connection once the response is transferred. Technically, either side can terminate the TCP connection without such signal at any point, but clients and servers should provide it whenever possible to enable better connection reuse strategies on both sides. - -``` -HTTP/1.1 changed the semantics of the HTTP protocol to use connection keepalive by default. Meaning, unless told otherwise (via `Connection: close` header), the server should keep the connection open by default. - -However, this same functionality was also backported to HTTP/1.0 and enabled via the `Connection: Keep-Alive` header. Hence, if you are using HTTP/1.1, technically you don’t need the `Connection: Keep-Alive` header, but many clients choose to provide it nonetheless. -``` - -Additionally, the HTTP/1.1 protocol added content, encoding, character set, and even language negotiation, transfer encoding, caching directives, client cookies, plus a dozen other capabilities that can be negotiated on each request. - -We are not going to dwell on the semantics of every HTTP/1.1 feature. This is a subject for a dedicated book, and many great ones have been written already. Instead, the previous example serves as a good illustration of both the quick progress and evolution of HTTP, as well as the intricate and complicated dance of every client-server exchange. There is a lot going on in there! - -``` -For a good reference on all the inner workings of the HTTP protocol, check out O’Reilly’s HTTP: The Definitive Guide by David Gourley and Brian Totty. -``` - -### §HTTP/2: Improving Transport Performance - -Since its publication, RFC 2616 has served as a foundation for the unprecedented growth of the Internet: billions of devices of all shapes and sizes, from desktop computers to the tiny web devices in our pockets, speak HTTP every day to deliver news, video, and millions of other web applications we have all come to depend on in our lives. - -What began as a simple, one-line protocol for retrieving hypertext quickly evolved into a generic hypermedia transport, and now a decade later can be used to power just about any use case you can imagine. Both the ubiquity of servers that can speak the protocol and the wide availability of clients to consume it means that many applications are now designed and deployed exclusively on top of HTTP. - -Need a protocol to control your coffee pot? RFC 2324 has you covered with the Hyper Text Coffee Pot Control Protocol (HTCPCP/1.0)—originally an April Fools’ Day joke by IETF, and increasingly anything but a joke in our new hyper-connected world. - -> The Hypertext Transfer Protocol (HTTP) is an application-level protocol for distributed, collaborative, hypermedia information systems. It is a generic, stateless, protocol that can be used for many tasks beyond its use for hypertext, such as name servers and distributed object management systems, through extension of its request methods, error codes and headers. A feature of HTTP is the typing and negotiation of data representation, allowing systems to be built independently of the data being transferred. -> -> RFC 2616: HTTP/1.1, June 1999 - -The simplicity of the HTTP protocol is what enabled its original adoption and rapid growth. In fact, it is now not unusual to find embedded devices—sensors, actuators, and coffee pots alike—using HTTP as their primary control and data protocols. But under the weight of its own success and as we increasingly continue to migrate our everyday interactions to the Web—social, email, news, and video, and increasingly our entire personal and job workspaces—it has also begun to show signs of stress. Users and web developers alike are now demanding near real-time responsiveness and protocol performance from HTTP/1.1, which it simply cannot meet without some modifications. - -To meet these new challenges, HTTP must continue to evolve, and hence the HTTPbis working group announced a new initiative for HTTP/2 in early 2012: - -> There is emerging implementation experience and interest in a protocol that retains the semantics of HTTP without the legacy of HTTP/1.x message framing and syntax, which have been identified as hampering performance and encouraging misuse of the underlying transport. -> -> The working group will produce a specification of a new expression of HTTP’s current semantics in ordered, bi-directional streams. As with HTTP/1.x, the primary target transport is TCP, but it should be possible to use other transports. -> -> HTTP/2 charter, January 2012 - -The primary focus of HTTP/2 is on improving transport performance and enabling both lower latency and higher throughput. The major version increment sounds like a big step, which it is and will be as far as performance is concerned, but it is important to note that none of the high-level protocol semantics are affected: all HTTP headers, values, and use cases are the same. - -Any existing website or application can and will be delivered over HTTP/2 without modification: you do not need to modify your application markup to take advantage of HTTP/2. The HTTP servers will have to speak HTTP/2, but that should be a transparent upgrade for the majority of users. The only difference if the working group meets its goal, should be that our applications are delivered with lower latency and better utilization of the network link! - -Having said that, let’s not get ahead of ourselves. Before we get to the new HTTP/2 protocol features, it is worth taking a step back and examining our existing deployment and performance best practices for HTTP/1.1. The HTTP/2 working group is making fast progress on the new specification, but even if the final standard was already done and ready, we would still have to support older HTTP/1.1 clients for the foreseeable future—realistically, a decade or more. - --------------------------------------------------------------------------------- - -via: https://hpbn.co/brief-history-of-http/#http-09-the-one-line-protocol - -作者:[Ilya Grigorik][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.igvita.com/ -[b]: https://github.com/lujun9972 -[1]: https://hpbn.co/building-blocks-of-tcp/#three-way-handshake -[2]: https://hpbn.co/building-blocks-of-tcp/#slow-start -[3]: https://hpbn.co/building-blocks-of-tcp/#optimizing-for-tcp diff --git a/translated/tech/20180926 HTTP- Brief History of HTTP.md b/translated/tech/20180926 HTTP- Brief History of HTTP.md new file mode 100644 index 0000000000..46df90e42f --- /dev/null +++ b/translated/tech/20180926 HTTP- Brief History of HTTP.md @@ -0,0 +1,274 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (HTTP: Brief History of HTTP) +[#]: via: (https://hpbn.co/brief-history-of-http/#http-09-the-one-line-protocol) +[#]: author: (Ilya Grigorik https://www.igvita.com/) + +HTTP: HTTP 历史简介 +====== + +### 介绍 + +超文本传输协议(HTTP)是 Internet 上最普遍和广泛采用的应用程序协议之一。它是客户端和服务器之间的通用语言,支持现代 Web。从最初作为一个简单的关键字和文档路径开始,它已成为不仅仅是浏览器的首选协议,而且几乎是所有连接互联网硬件和软件应用程序的首选协议。 + +在本文中,我们将简要回顾 HTTP 协议的发展历史。对 HTTP 不同语义的完整讨论超出了本文的范围,但理解 HTTP 的关键设计变更以及每个变更背后的动机将为我们讨论 HTTP 性能提供必要的背景,特别是在 HTTP/2 中即将进行的许多改进。 + +### §HTTP 0.9: 单向协议 + +Tim Berners-Lee 最初的 HTTP 提案在设计时考虑到了简单性,以帮助他采用他的另一个新想法:万维网(World Wide Web)。这个策略看起来奏效了:注意,他是一个有抱负的协议设计者。 + +1991 年,Berners-Lee 概述了新协议的动机,并列出了几个高级设计目标:文件传输功能,请求超文档存档索引搜索的能力,格式协商以及将客户端引用到另一个服务器的能力。为了证明该理论的实际应用,我们构建了一个简单原型,它实现了所提议功能的一小部分。 + + * 客户端请求是一个 ASCII 字符串。 + + * 客户端请求以回车符(CRLF)终止。 + + * 服务器响应是 ASCII 字符流。 + + * 服务器响应是一种超文本标记语言(HTML)。 + + * 文档传输完成后连接终止。 + +这些听起来就挺复杂,而实际情况比这复杂得多。这些规则支持的是一种非常简单的,对 Telnet 友好的协议,一些 Web 服务器至今仍然支持这种协议: + +``` +$> telnet google.com 80 + +Connected to 74.125.xxx.xxx + +GET /about/ + +(hypertext response) +(connection closed) +``` + +请求包含这样一行:`GET` 方法和请求文档的路径。响应是一个超文本文档-没有标题或任何其他元数据,只有 HTML。真的是再简单不过了。此外,由于之前的交互是预期协议的子集,因此它获得了一个非官方的 HTTP 0.9 标签。其余的,就像他们所说的,都是历史。 + +从 1991 年这些不起眼的开始,HTTP 就有了自己的生命,并在接下来几年里迅速发展。让我们快速回顾一下 HTTP 0.9 的特性: + + * 采用客户端-服务器架构,是一种请求-响应协议。 + + * 采用 ASCII 协议,运行在 TCP/IP 链路上。 + + * 旨在传输超文本文档(HTML)。 + + * 每次请求后,服务器和客户端之间的连接都将关闭。 + +``` +流行的 Web 服务器,如 Apache 和 Nginx,仍然支持 HTTP 0.9 协议,部分原因是因为它没有太多功能!如果你感兴趣,打开 Telnet 会话并尝试通过 HTTP 0.9 访问 google.com 或你最喜欢的网站,并检查早期协议的行为和限制。 + +``` +### §HTTP/1.0: 快速增长和 Informational RFC + +1991 年至 1995 年期间, HTML 规范和一种称为 “web 浏览器”的新型软件快速发展,面向消费者的公共互联网基础设施也开始出现并快速增长。 + +``` +##### §完美风暴: 1990 年代初的互联网热潮 + +基于 Tim Berner-Lee 最初的浏览器原型,美国国家超级计算机应用中心(NCSA)的一个团队决定实现他们自己的版本。就这样,第一个流行的浏览器诞生了:NCSA Mosaic。1994 年 10 月,NCSA 团队的一名程序员 Marc Andreessen 与 Jim Clark 合作创建了 Mosaic Communications,该公司后来改名为 Netscape(网景),并于 1994 年 12 月发布了 Netscape Navigator 1.0。从这一点来说,已经很清楚了,万维网已经不仅仅是学术上的好奇心了。 + +实际上,同年在瑞士日内网组织了第一次万维网会议,这导致万维网联盟(W3C)的成立,以帮助指导 HTML 的发展。同样,在 IETF 内部建立了一个并行的 HTTP 工作组(HTTP-WG),专注于改进 HTTP 协议。后来这两个团体一直对 Web 的发展起着重要作用。 + +最后,完美的风暴来临,CompuServe,AOL 和 Prodigy 在 1994-1995 年的同一时间开始向公众提供拨号上网服务。凭借这股迅速的浪潮,Netscape 在 1995 年 8 月 9 日凭借其成功的 IPO 创造了历史。这预示着互联网热潮已经到来,人人都想分一杯羹! +``` + +不断增长的新 Web 所需功能及其在公共网站上的用例很快暴露了 HTTP 0.9 的许多基础限制:我们需要一种能够提供超文本文档、提供关于请求和响应的更丰富的元数据,支持内容协商等等的协议。相应地,新兴的 Web 开发人员社区通过一个特殊的过程生成了大量实验性的 HTTP 服务器和客户端实现来回应:实现,部署,并查看其他人是否采用它。 + +从这些急速增长的实验开始,一系列最佳实践和常见模式开始出现。1996 年 5 月,HTTP 工作组(HTTP-WG)发布了 RFC 1945,它记录了许多被广泛使用的 HTTP/1.0 实现的“常见用法”。请注意,这只是一个信息 RFC:HTTP/1.0,因为我们知道它不是一个正式规范或 Internet 标准! + +话虽如此,HTTP/1.0 请求看起来应该是: + +``` +$> telnet website.org 80 + +Connected to xxx.xxx.xxx.xxx + +GET /rfc/rfc1945.txt HTTP/1.0 +User-Agent: CERN-LineMode/2.15 libwww/2.17b3 +Accept: */* + +HTTP/1.0 200 OK +Content-Type: text/plain +Content-Length: 137582 +Expires: Thu, 01 Dec 1997 16:00:00 GMT +Last-Modified: Wed, 1 May 1996 12:45:26 GMT +Server: Apache 0.84 + +(plain-text response) +(connection closed) +``` + + 1. 请求行有 HTTP 版本号,后面跟请求头 + + 2. 响应状态,后跟响应头 + + +前面交换的并不是 HTTP/1.0 功能的详尽列表,但它确实说明了一些关键的协议更改: + + * 请求可能多个由换行符分隔的请求头字段组成。 + + * 响应对象的前缀是响应状态行。 + + * 响应对象有自己的一组由换行符分隔的响应头字段。 + + * 响应对象不限于超文本。 + + * 每次请求后,服务器和客户端之间的连接都将关闭。 + +请求头和响应头都保留为 ASCII 编码,但响应对象本身可以是任何类型:一个 HTML 文件,一个纯文本文件,一个图像或任何其他内容类型。因此,HTTP 的“超文本传输”部分在引入后不久就变成了用词不当。实际上,HTTP 已经迅速发展成为一种超媒体传输,但最初的名称没有改变。 + +除了媒体类型协商之外,RFC 还记录了许多其他常用功能:内容编码,字符集支持,多部分类型,授权,缓存,代理行为,日期格式等。 + +``` +今天,几乎所有 Web 上的服务器都可以并且仍将使用 HTTP/1.0。不过,现在你应该更加清楚了!每个请求都需要一个新的 TCP 连接,这会对 HTTP/1.0 造成严重的性能损失。参见[三次握手][1],接着会[慢启动][2]。 +``` + +### §HTTP/1.1: Internet 标准 + +将 HTTP 转变为官方 IETF 互联网标准的工作与围绕 HTTP/1.0 的文档工作并行进行,并计划从 1995 年至 1999 年完成。事实上,第一个正式的 HTTP/1.1 标准定义于 RFC 2068,它在 HTTP/1.0 发布大约六个月后,即 1997 年 1 月正式发布。两年半后,即 1999 年 6 月,一些新的改进和更新被纳入标准,并作为 RFC 2616 发布。 + +HTTP/1.1 标准解决了早期版本中发现的许多协议歧义,并引入了一些关键的性能优化:保持连接,分块编码传输,字节范围请求,附加缓存机制,传输编码和请求管道。 + +有了这些功能,我们现在可以审视一下由任何现代 HTTP 浏览器和客户端执行的典型 HTTP/1.1 会话: + +``` +$> telnet website.org 80 +Connected to xxx.xxx.xxx.xxx + +GET /index.html HTTP/1.1 +Host: website.org +User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4)... (snip) +Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 +Accept-Encoding: gzip,deflate,sdch +Accept-Language: en-US,en;q=0.8 +Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 +Cookie: __qca=P0-800083390... (snip) + +HTTP/1.1 200 OK +Server: nginx/1.0.11 +Connection: keep-alive +Content-Type: text/html; charset=utf-8 +Via: HTTP/1.1 GWA +Date: Wed, 25 Jul 2012 20:23:35 GMT +Expires: Wed, 25 Jul 2012 20:23:35 GMT +Cache-Control: max-age=0, no-cache +Transfer-Encoding: chunked + +100 + +(snip) + +100 +(snip) + +0 + +GET /favicon.ico HTTP/1.1 +Host: www.website.org +User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4)... (snip) +Accept: */* +Referer: http://website.org/ +Connection: close +Accept-Encoding: gzip,deflate,sdch +Accept-Language: en-US,en;q=0.8 +Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3 +Cookie: __qca=P0-800083390... (snip) + +HTTP/1.1 200 OK +Server: nginx/1.0.11 +Content-Type: image/x-icon +Content-Length: 3638 +Connection: close +Last-Modified: Thu, 19 Jul 2012 17:51:44 GMT +Cache-Control: max-age=315360000 +Accept-Ranges: bytes +Via: HTTP/1.1 GWA +Date: Sat, 21 Jul 2012 21:35:22 GMT +Expires: Thu, 31 Dec 2037 23:55:55 GMT +Etag: W/PSA-GAu26oXbDi + +(icon data) +(connection closed) +``` + + 1. 请求的 HTML 文件,包括编码,字符集和 cookie 元数据 + + 2. 原始 HTML 请求的分块响应 + + 3. 以 ASCII 十六进制数字(256 字节)表示块中的八位元数 + + 4. 分块流响应结束 + + 5. 在相同的 TCP 连接上请求一个图标文件 + + 6. 通知服务器不再重用连接 + + 7. 图标响应后,然后关闭连接 + + +哇,这里发生了很多事情!第一个也是最明显的区别是我们有两个对象请求,一个用于 HTML 页面,另一个用于图像,它们都通过一个连接完成。这就是保持连接的实际应用,它允许我们重用现有的 TCP 连接到同一个主机的多个请求,提供一个更快的最终用户体验。参见[TCP 优化][3]。 + +要终止持久连接,注意第二个客户端请求通过 `Connection` 请求头向服务器发送显示的 `close`。类似地,一旦传输响应,服务器就可以通知客户端关闭当前 TCP 连接。从技术上讲,任何一方都可以在没有此类信号的情况下终止 TCP 连接,但客户端和服务器应尽可能提供此类信号,以便双方都启用更好的连接重用策略。 + +``` +HTTP/1.1 改变了 HTTP 协议的语义,默认情况下使用保持连接。这意味着,除非另有说明(通过 `Connection:close` 头),否则服务器应默认保持连接打开。 + +但是,同样的功能也被反向移植到 HTTP/1.0 上,通过 `Connection:keep-Alive` 头启用。因此,如果你使用 HTTP/1.1,从技术上讲,你不需要 `Connection:keep-Alive` 头,但许多客户端仍然选择提供它。 +``` + +此外,HTTP/1.1 协议还添加了内容、编码、字符集,甚至语言协商、传输编码、缓存指令、客户端 cookie,以及可以针对每个请求协商的十几个其他功能。 + +我们不打算详细讨论每个 HTTP/1.1 特性的语义。这个主题可以写一本专门的书了,已经有了很多很棒的书。相反,前面的示例很好地说明了 HTTP 的快速进展和演变,以及每个客户端-服务器交换的错综复杂的过程,里面发生了很多事情! + +``` +要了解 HTTP 协议所有内部工作原理,参考 David Gourley 和 Brian Totty 共同撰写的权威指南: The Definitive Guide。(to 校正:这里翻译的不准确) +``` + +### §HTTP/2: 提高传输性能 + +RFC 2616 自发布以来,已经成为互联网空前增长的基础:数十亿各种形状和大小的设备,从台式电脑到我们口袋里的小型网络设备,每天都在使用 HTTP 来传送新闻,视频,在我们生活中的数百万的其他网络应用程序都在依靠它。 + +一开始是一个简单的,用于检索超文本的简单协议,很快演变成了一种通用的超媒体传输,现在十年过去了,它几乎可以为你所能想象到的任何用例提供支持。可以使用协议的服务器无处不在,客户端也可以使用协议,这意味着现在许多应用程序都是专门在 HTTP 之上设计和部署的。 + +需要一个协议来控制你的咖啡壶?RFC 2324 已经涵盖了超文本咖啡壶控制协议(HTCPCP/1.0)- 它原本是 IETF 在愚人节开的一个玩笑,但在我们这个超链接的新世界中,它不仅仅意味着一个玩笑。 + +> 超文本传输协议(HTTP)是一个应用程序级的协议,用于分布式、协作、超媒体信息系统。它是一种通用的、无状态的协议,可以通过扩展请求方法、错误码和头,用于超出超文本之外的许多任务,比如名称服务器和分布式对象管理系统。HTTP 的一个特性是数据表示的类型和协商,允许独立于传输的数据构建系统。 +> +> RFC 2616: HTTP/1.1, June 1999 + +HTTP 协议的简单性是它最初被采用和快速增长的原因。事实上,现在使用 HTTP 作为主要控制和数据协议的嵌入式设备(传感器,执行器和咖啡壶)并不罕见。但在其自身成功的重压下,随着我们越来越多地继续将日常互动转移到网络-社交、电子邮件、新闻和视频,以及越来越多的个人和工作空间,它也开始显示出压力的迹象。用户和 Web 开发人员现在都要求 HTTP/1.1 提供近乎实时的响应能力和协议 +性能,如果不进行一些修改,就无法满足这些要求。 + +为了应对这些新挑战,HTTP 必须继续发展,因此 HTTPbis 工作组在 2012 年初宣布了一项针对 HTTP/2 的新计划: + +> 已经有一个协议中出现了新的实现经验和兴趣,该协议保留了 HTTP 的语义,但是没有保留 HTTP/1.x 的消息框架和语法,这些问题已经被确定为妨碍性能和鼓励滥用底层传输。 +> +> 工作组将使用有序的双向流中生成 HTTP 当前语义的新表达式的规范。与 HTTP/1.x 一样,主要传输目标是 TCP,但是应该可以使用其他方式传输。 +> +> HTTP/2 charter, January 2012 + +HTTP/2 的主要重点是提高传输性能并支持更低的延迟和更高的吞吐量。主要的版本增量听起来像是一个很大的步骤,但就性能而言,它将是一个重大的步骤,但重要的是要注意,没有任何高级协议语义收到影响:所有的 HTTP 头,值和用例是相同的。 + +任何现有的网站或应用程序都可以并且将通过 HTTP/2 传送而无需修改。你无需修改应用程序标记来利用 HTTP/2。HTTP 服务器必须使用 HTTP/2,但这对大多数用户来说应该是透明的升级。如果工作组实现目标,唯一的区别应该是我们的应用程序以更低的延迟和更好的网络连接利用率来传送数据。 + +话虽如此,但我们不要走的太远了。在讨论新的 HTTP/2 协议功能之前,有必要回顾一下我们现有的 HTTP/1.1 部署和性能最佳实践。HTTP/2 工作组正在新规范上取得快速的进展,但即使最终标准已经完成并准备就绪,在可预见的未来,我们仍然必须支持旧的 HTTP/1.1 客户端,实际上,这得十年或更长时间。 + +-------------------------------------------------------------------------------- + +via: https://hpbn.co/brief-history-of-http/#http-09-the-one-line-protocol + +作者:[Ilya Grigorik][a] +选题:[lujun9972][b] +译者:[MjSeven](https://github.com/MjSeven) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.igvita.com/ +[b]: https://github.com/lujun9972 +[1]: https://hpbn.co/building-blocks-of-tcp/#three-way-handshake +[2]: https://hpbn.co/building-blocks-of-tcp/#slow-start +[3]: https://hpbn.co/building-blocks-of-tcp/#optimizing-for-tcp From aeaa4a456e1b6ee9c1233a7f4c4f52fde9134e02 Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Mon, 11 Mar 2019 22:52:11 +0800 Subject: [PATCH 193/796] 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 194/796] 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 195/796] 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 196/796] 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 197/796] 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 198/796] 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 199/796] 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 200/796] 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 201/796] 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 202/796] 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 203/796] 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 204/796] 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 205/796] 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 206/796] 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 207/796] 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 208/796] 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 209/796] 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 210/796] 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 211/796] 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 212/796] 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 213/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190125=20Get=20?= =?UTF-8?q?started=20with=20Freeplane,=20an=20open=20source=20mind=20mappi?= =?UTF-8?q?ng=20application=20sources/tech/20190125=20Get=20started=20with?= =?UTF-8?q?=20Freeplane,=20an=20open=20source=20mind=20mapping=20applicati?= =?UTF-8?q?on.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...an open source mind mapping application.md | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 sources/tech/20190125 Get started with Freeplane, an open source mind mapping application.md diff --git a/sources/tech/20190125 Get started with Freeplane, an open source mind mapping application.md b/sources/tech/20190125 Get started with Freeplane, an open source mind mapping application.md new file mode 100644 index 0000000000..cefca12303 --- /dev/null +++ b/sources/tech/20190125 Get started with Freeplane, an open source mind mapping application.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with Freeplane, an open source mind mapping application) +[#]: via: (https://opensource.com/article/19/1/productivity-tool-freeplane) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + +Get started with Freeplane, an open source mind mapping application +====== + +Map your brainstorming sessions with Freeplane, the 13th in our series on open source tools that will make you more productive in 2019. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/brain_data.png?itok=RH6NA32X) + +There seems to be a mad rush at the beginning of every year to find ways to be more productive. New Year's resolutions, the itch to start the year off right, and of course, an "out with the old, in with the new" attitude all contribute to this. And the usual round of recommendations is heavily biased towards closed source and proprietary software. It doesn't have to be that way. + +Here's the 13th of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. + +### Freeplane + +[Mind maps][1] are one of the more valuable tools I've used for quickly brainstorming ideas and capturing data. Mind mapping is a versatile process that helps show how things are related and can be used to quickly organize interrelated information. From a planning perspective, mind mapping allows you to quickly perform a brain dump around a single concept, idea, or technology. + +![](https://opensource.com/sites/default/files/uploads/freeplane-1.png) + +[Freeplane][2] is a desktop application that makes it easy to create, view, edit, and share mind maps. It is a redesign of [FreeMind][3], which was the go-to mind-mapping application for quite some time. + +Installing Freeplane is pretty easy. It is a [Java][4] application and distributed as a ZIP file with scripts to start the application on Linux, Windows, and MacOS. At its first startup, its main window includes an example mind map with links to documentation about all the different things you can do with Freeplane. + +![](https://opensource.com/sites/default/files/uploads/freeplane-2.png) + +You have a choice of templates when you create a new mind map. The standard template (likely at the bottom of the list) works for most cases. Just start typing the idea or phrase you want to start with, and your text will replace the center text. Pressing the Insert key will add a branch (or node) off the center with a blank field where you can fill in something associated with the idea. Pressing Insert again will add another node connected to the first one. Pressing Enter on a node will add a node parallel to that one. + +![](https://opensource.com/sites/default/files/uploads/freeplane-3.png) + +As you add nodes, you may come up with another thought or idea related to the main topic. Using either the mouse or the Arrow keys, go back to the center of the map and press Insert. A new node will be created off the main topic. + +If you want to go beyond Freeplane's base functionality, right-click on any of the nodes to bring up a Properties menu for that node. The Tool pane (activated under the View–>Controls menu) contains customization options galore, including line shape and thickness, border shapes, colors, and much, much more. The Calendar tab allows you to insert dates into the nodes and set reminders for when nodes are due. (Note that reminders work only when Freeplane is running.) Mind maps can be exported to several formats, including common images, XML, Microsoft Project, Markdown, and OPML. + +![](https://opensource.com/sites/default/files/uploads/freeplane-4.png) + +Freeplane gives you all the tools you'll need to create vibrant and useful mind maps, getting your ideas out of your head and into a place where you can take action on them. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tool-freeplane + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney (Kevin Sonney) +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Mind_map +[2]: https://www.freeplane.org/wiki/index.php/Home +[3]: https://sourceforge.net/projects/freemind/ +[4]: https://java.com From 5e18ac26c9b5710dc37494a062c49f806ad50376 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 12:58:48 +0800 Subject: [PATCH 214/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190117=20Get=20?= =?UTF-8?q?started=20with=20CryptPad,=20an=20open=20source=20collaborative?= =?UTF-8?q?=20document=20editor=20sources/tech/20190117=20Get=20started=20?= =?UTF-8?q?with=20CryptPad,=20an=20open=20source=20collaborative=20documen?= =?UTF-8?q?t=20editor.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...en source collaborative document editor.md | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 sources/tech/20190117 Get started with CryptPad, an open source collaborative document editor.md diff --git a/sources/tech/20190117 Get started with CryptPad, an open source collaborative document editor.md b/sources/tech/20190117 Get started with CryptPad, an open source collaborative document editor.md new file mode 100644 index 0000000000..2da6274e42 --- /dev/null +++ b/sources/tech/20190117 Get started with CryptPad, an open source collaborative document editor.md @@ -0,0 +1,58 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with CryptPad, an open source collaborative document editor) +[#]: via: (https://opensource.com/article/19/1/productivity-tool-cryptpad) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + +Get started with CryptPad, an open source collaborative document editor +====== +Securely share your notes, documents, kanban boards, and more with CryptPad, the fifth in our series on open source tools that will make you more productive in 2019. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh) + +There seems to be a mad rush at the beginning of every year to find ways to be more productive. New Year's resolutions, the itch to start the year off right, and of course, an "out with the old, in with the new" attitude all contribute to this. And the usual round of recommendations is heavily biased towards closed source and proprietary software. It doesn't have to be that way. + +Here's the fifth of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. + +### CryptPad + +We already talked about [Joplin][1], which is good for keeping your own notes but—as you may have noticed—doesn't have any sharing or collaboration features. + +[CryptPad][2] is a secure, shareable note-taking app and document editor that allows for secure, collaborative editing. Unlike Joplin, it is a NodeJS app, which means you can run it on your desktop or a server elsewhere and access it with any modern web browser. Out of the box, it supports rich text, Markdown, polls, whiteboards, kanban, and presentations. + +![](https://opensource.com/sites/default/files/uploads/cryptpad-1.png) + +The different document types are robust and fully featured. The rich text editor covers all the bases you'd expect from a good editor and allows you to export files to HTML. The Markdown editor is on par with Joplin, and the kanban board, though not as full-featured as [Wekan][3], is really well done. The rest of the supported document types and editors are also very polished and have the features you'd expect from similar apps, although polls feel a little clunky. + +![](https://opensource.com/sites/default/files/uploads/cryptpad-2.png) + +CryptPad's real power, though, comes in its sharing and collaboration features. Sharing a document is as simple as getting the sharable URL from the "share" option, and CryptPad supports embedding documents in iFrame tags on other websites. Documents can be shared in Edit or View mode with a password and with links that expire. The built-in chat allows editors to talk to each other (note that people with View access can also see the chat but can't comment). + +![](https://opensource.com/sites/default/files/pictures/cryptpad-3.png) + +All files are stored encrypted with the user's password. Server administrators can't read the documents, which also means if you forget or lose your password, the files are unrecoverable. So make sure you keep the password in a secure place, like a [password vault][4]. + +![](https://opensource.com/sites/default/files/uploads/cryptpad-4.png) + +When it's run locally, CryptPad is a robust app for creating and editing documents. When run on a server, it becomes an excellent collaboration platform for multi-user document creation and editing. Installation took less than five minutes on my laptop, and it just worked out of the box. The developers also include instructions for running CryptPad in Docker, and there is a community-maintained Ansible role for ease of deployment. CryptPad does not support any third-party authentication methods, so users must create their own accounts. CryptPad also has a community-supported hosted version if you don't want to run your own server. + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tool-cryptpad + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney (Kevin Sonney) +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/19/1/productivity-tool-joplin +[2]: https://cryptpad.fr/index.html +[3]: https://opensource.com/article/19/1/productivity-tool-wekan +[4]: https://opensource.com/article/18/4/3-password-managers-linux-command-line From 2a3cfd6d003e15c320540b104cfb4fd594025dc3 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 13:00:24 +0800 Subject: [PATCH 215/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190116=20Get=20?= =?UTF-8?q?started=20with=20Cypht,=20an=20open=20source=20email=20client?= =?UTF-8?q?=20sources/tech/20190116=20Get=20started=20with=20Cypht,=20an?= =?UTF-8?q?=20open=20source=20email=20client.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...with Cypht, an open source email client.md | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 sources/tech/20190116 Get started with Cypht, an open source email client.md diff --git a/sources/tech/20190116 Get started with Cypht, an open source email client.md b/sources/tech/20190116 Get started with Cypht, an open source email client.md new file mode 100644 index 0000000000..64be2e4a02 --- /dev/null +++ b/sources/tech/20190116 Get started with Cypht, an open source email client.md @@ -0,0 +1,58 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with Cypht, an open source email client) +[#]: via: (https://opensource.com/article/19/1/productivity-tool-cypht-email) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + +Get started with Cypht, an open source email client +====== +Integrate your email and news feeds into one view with Cypht, the fourth in our series on 19 open source tools that will make you more productive in 2019. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_mail_box_envelope_send_blue.jpg?itok=6Epj47H6) + +There seems to be a mad rush at the beginning of every year to find ways to be more productive. New Year's resolutions, the itch to start the year off right, and of course, an "out with the old, in with the new" attitude all contribute to this. And the usual round of recommendations is heavily biased towards closed source and proprietary software. It doesn't have to be that way. + +Here's the fourth of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. + +### Cypht + +We spend a lot of time dealing with email, and effectively [managing your email][1] can make a huge impact on your productivity. Programs like Thunderbird, Kontact/KMail, and Evolution all seem to have one thing in common: they seek to duplicate the functionality of Microsoft Outlook, which hasn't really changed in the last 10 years or so. Even the [console standard-bearers][2] like Mutt and Cone haven't changed much in the last decade. + +![](https://opensource.com/sites/default/files/uploads/cypht-1.png) + +[Cypht][3] is a simple, lightweight, and modern webmail client that aggregates several accounts into a single view. Along with email accounts, it includes Atom/RSS feeds. It makes reading items from these different sources very simple by using an "Everything" screen that shows not just the mail from your inbox, but also the newest articles from your news feeds. + +![](https://opensource.com/sites/default/files/uploads/cypht-2.png) + +It uses a simplified version of HTML messages to display mail or you can set it to view a plain-text version. Since Cypht doesn't load images from remote sources (to help maintain security), HTML rendering can be a little rough, but it does enough to get the job done. You'll get plain-text views with most rich-text mail—meaning lots of links and hard to read. I don't fault Cypht, since this is really the email senders' doing, but it does detract a little from the reading experience. Reading news feeds is about the same, but having them integrated with your email accounts makes it much easier to keep up with them (something I sometimes have issues with). + +![](https://opensource.com/sites/default/files/uploads/cypht-3.png) + +Users can use a preconfigured mail server and add any additional servers they use. Cypht's customization options include plain-text vs. HTML mail display, support for multiple profiles, and the ability to change the theme (and make your own). You have to remember to click the "Save" button on the left navigation bar, though, or your custom settings will disappear after that session. If you log out and back in without saving, all your changes will be lost and you'll end up with the settings you started with. This does make it easy to experiment, and if you need to reset things, simply logging out without saving will bring back the previous setup when you log back in. + +![](https://opensource.com/sites/default/files/pictures/cypht-4.png) + +[Installing Cypht][4] locally is very easy. While it is not in a container or similar technology, the setup instructions were very clear and easy to follow and didn't require any changes on my part. On my laptop, it took about 10 minutes from starting the installation to logging in for the first time. A shared installation on a server uses the same steps, so it should be about the same. + +In the end, Cypht is a fantastic alternative to desktop and web-based email clients with a simple interface to help you handle your email quickly and efficiently. + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tool-cypht-email + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney (Kevin Sonney) +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/17/7/email-alternatives-thunderbird +[2]: https://opensource.com/life/15/8/top-4-open-source-command-line-email-clients +[3]: https://cypht.org/ +[4]: https://cypht.org/install.html From 4655756aa53d68838535c0fa250ff547b3cfca66 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 13:04:03 +0800 Subject: [PATCH 216/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190312=20Do=20a?= =?UTF-8?q?dvanced=20math=20with=20Mathematica=20on=20the=20Raspberry=20Pi?= =?UTF-8?q?=20sources/tech/20190312=20Do=20advanced=20math=20with=20Mathem?= =?UTF-8?q?atica=20on=20the=20Raspberry=20Pi.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...th with Mathematica on the Raspberry Pi.md | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 sources/tech/20190312 Do advanced math with Mathematica on the Raspberry Pi.md diff --git a/sources/tech/20190312 Do advanced math with Mathematica on the Raspberry Pi.md b/sources/tech/20190312 Do advanced math with Mathematica on the Raspberry Pi.md new file mode 100644 index 0000000000..c39b7dc7e5 --- /dev/null +++ b/sources/tech/20190312 Do advanced math with Mathematica on the Raspberry Pi.md @@ -0,0 +1,49 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Do advanced math with Mathematica on the Raspberry Pi) +[#]: via: (https://opensource.com/article/19/3/do-math-raspberry-pi) +[#]: author: (Anderson Silva https://opensource.com/users/ansilva) + +Do advanced math with Mathematica on the Raspberry Pi +====== +Wolfram bundles a version of Mathematica with Raspbian. Learn how to use it in the 12th article in our series on getting started with Raspberry Pi. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/edu_math_formulas.png?itok=B59mYTG3) + +In the mid-'90s, I started college as a math major, and, even though I graduated with a computer science degree, I had taken enough classes to graduate with a minor—and only two classes short of a double-major—in math. At the time, I was introduced to an application called [Mathematica][1] by [Wolfram][2], where we would take many of our algebraic and differential equations from the blackboard into the computer. I spent a few hours a month in the lab learning the Wolfram Language and solving integrals and such on Mathematica. + +Mathematica was closed source and expensive for a college student, so it was a nice surprise to see almost 20 years later Wolfram bundling a version of Mathematica with Raspbian and the Raspberry Pi. If you decide to use another Debian-based distribution, you can [download it][3] on your Pi. Note that this version is free for non-commercial use only. + +The Raspberry Pi Foundation's [introduction to Mathematica][4] covers some basic concepts such as variables and loops, solving some math problems, creating graphs, doing linear algebra, and even interacting with the GPIO pins through the application. + +![](https://opensource.com/sites/default/files/uploads/raspberrypi_12_mathematica_batman-plot.png) + +To dive deeper into Mathematica, check out the [Wolfram Language documentation][5]. If you just want to solve some basic calculus problems, [check out its functions][6]. And read this tutorial if you want to [plot some 2D and 3D graphs][7]. + +Or, if you want to stick with open source tools while doing math, check out the command-line tools **expr** , **factor** , and **bc**. (Remember to use the [**man** command][8] to read up on these utilities.) And if you want to graph something, [Gnuplot][9] is a great option. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/do-math-raspberry-pi + +作者:[Anderson Silva][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ansilva +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Wolfram_Mathematica +[2]: https://wolfram.com/ +[3]: https://www.wolfram.com/raspberry-pi/ +[4]: https://projects.raspberrypi.org/en/projects/getting-started-with-mathematica/ +[5]: https://www.wolfram.com/language/ +[6]: https://reference.wolfram.com/language/guide/Calculus.html +[7]: https://reference.wolfram.com/language/howto/PlotAGraph.html +[8]: https://opensource.com/article/19/3/learn-linux-raspberry-pi +[9]: http://gnuplot.info/ From 4207622368056638b0e6782165dd5435eb2e8c44 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 13:08:53 +0800 Subject: [PATCH 217/796] =?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 218/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190303=20How=20?= =?UTF-8?q?to=20boot=20up=20a=20new=20Raspberry=20Pi=20sources/tech/201903?= =?UTF-8?q?03=20How=20to=20boot=20up=20a=20new=20Raspberry=20Pi.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...90303 How to boot up a new Raspberry Pi.md | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 sources/tech/20190303 How to boot up a new Raspberry Pi.md diff --git a/sources/tech/20190303 How to boot up a new Raspberry Pi.md b/sources/tech/20190303 How to boot up a new Raspberry Pi.md new file mode 100644 index 0000000000..87ab3ea268 --- /dev/null +++ b/sources/tech/20190303 How to boot up a new Raspberry Pi.md @@ -0,0 +1,69 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to boot up a new Raspberry Pi) +[#]: via: (https://opensource.com/article/19/3/how-boot-new-raspberry-pi) +[#]: author: (Anderson Silva https://opensource.com/users/ansilva) + +How to boot up a new Raspberry Pi +====== +Learn how to install a Linux operating system, in the third article in our guide to getting started with Raspberry Pi. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_code_keyboard_orange_hands.png?itok=G6tJ_64Y) + +If you've been following along in this series, you've [chosen][1] and [bought][2] your Raspberry Pi board and peripherals and now you're ready to start using it. Here, in the third article, let's look at what you need to do to boot it up. + +Unlike your laptop, desktop, smartphone, or tablet, the Raspberry Pi doesn't come with built-in storage. Instead, it uses a Micro SD card to store the operating system and your files. The great thing about this is it gives you the flexibility to carry your files (even if you don't have your Raspberry Pi with you). The downside is it may also increase the risk of losing or damaging the card—and thus losing your files. Just protect your Micro SD card, and you should be fine. + +You should also know that SD cards aren't as fast as mechanical or solid state drives, so booting, reading, and writing from your Pi will not be as speedy as you would expect from other devices. + +### How to install Raspbian + +The first thing you need to do when you get a new Raspberry Pi is to install its operating system on a Micro SD card. Even though there are other operating systems (both Linux- and non-Linux-based) available for the Raspberry Pi, this series focuses on [Raspbian][3] , Raspberry Pi's official Linux version. + +![](https://opensource.com/sites/default/files/uploads/raspbian.png) + +The easiest way to install Raspbian is with [NOOBS][4], which stands for "New Out Of Box Software." Raspberry Pi offers great [documentation for NOOBS][5], so I won't repeat the installation instructions here. + +NOOBS gives you the choice of installing the following operating systems: + ++ [Raspbian][6] ++ [LibreELEC][7] ++ [OSMC][8] ++ [Recalbox][9] ++ [Lakka][10] ++ [RISC OS][11] ++ [Screenly OSE][12] ++ [Windows 10 IoT Core][13] ++ [TLXOS][14] + +Again, Raspbian is the operating system we'll use in this series, so go ahead, grab your Micro SD and follow the NOOBS documentation to install it. I'll meet you in the fourth article in this series, where we'll look at how to use Linux, including some of the main commands you'll need to know. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/how-boot-new-raspberry-pi + +作者:[Anderson Silva][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ansilva +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/19/3/which-raspberry-pi-choose +[2]: https://opensource.com/article/19/2/how-buy-raspberry-pi +[3]: https://www.raspbian.org/RaspbianFAQ +[4]: https://www.raspberrypi.org/downloads/noobs/ +[5]: https://www.raspberrypi.org/documentation/installation/noobs.md +[6]: https://www.raspbian.org/RaspbianFAQ +[7]: https://libreelec.tv/ +[8]: https://osmc.tv/ +[9]: https://www.recalbox.com/ +[10]: http://www.lakka.tv/ +[11]: https://www.riscosopen.org/wiki/documentation/show/Welcome%20to%20RISC%20OS%20Pi +[12]: https://www.screenly.io/ose/ +[13]: https://developer.microsoft.com/en-us/windows/iot +[14]: https://thinlinx.com/ From ccbd0dc1208be84a162543bb5546d9df8b78a571 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 14:23:55 +0800 Subject: [PATCH 219/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190306=203=20po?= =?UTF-8?q?pular=20programming=20languages=20you=20can=20learn=20with=20Ra?= =?UTF-8?q?spberry=20Pi=20sources/tech/20190306=203=20popular=20programmin?= =?UTF-8?q?g=20languages=20you=20can=20learn=20with=20Raspberry=20Pi.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nguages you can learn with Raspberry Pi.md | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 sources/tech/20190306 3 popular programming languages you can learn with Raspberry Pi.md diff --git a/sources/tech/20190306 3 popular programming languages you can learn with Raspberry Pi.md b/sources/tech/20190306 3 popular programming languages you can learn with Raspberry Pi.md new file mode 100644 index 0000000000..33670e525a --- /dev/null +++ b/sources/tech/20190306 3 popular programming languages you can learn with Raspberry Pi.md @@ -0,0 +1,65 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 popular programming languages you can learn with Raspberry Pi) +[#]: via: (https://opensource.com/article/19/3/programming-languages-raspberry-pi) +[#]: author: (Anderson Silva https://opensource.com/users/ansilva) + +3 popular programming languages you can learn with Raspberry Pi +====== +Become more valuable on the job market by learning to program with the Raspberry Pi. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_language_c.png?itok=mPwqDAD9) + +In the last article in this series, I shared some ways to [teach kids to program with Raspberry Pi][1]. In theory, there is absolutely nothing stopping an adult from using resources designed for kids, but you might be better served by learning the programming languages that are in demand in the job market. + +Here are three programming languages you can learn with the Raspberry Pi. + +### Python + +[Python][2] has become one of the [most popular programming languages][3] in the open source world. Its interpreter has been packaged and made available in every popular Linux distribution. If you install Raspbian on your Raspberry Pi, you will see an app called [Thonny][4], which is a Python integrated development environment (IDE) for beginners. In a nutshell, an IDE is an application that provides all you need to get your code executed, often including things like debuggers, documentation, auto-completion, and emulators. Here is a [great little tutorial][5] to get you started using Thonny and Python on the Raspberry Pi. + +![](https://opensource.com/sites/default/files/uploads/thonny.png) + +### Java + +Although arguably not as attractive as it once was, [Java][6] remains heavily used in universities around the world and deeply embedded in the enterprise. So, even though some will disagree that I'm recommending it as a beginner's language, I am compelled to do so; for one thing, it still very popular, and for another, there are a lot of books, classes, and other information available for you to learn Java. Get started on the Raspberry Pi by using the [BlueJ][7] Java IDE. + +![](https://opensource.com/sites/default/files/uploads/bluejayide.png) + +### JavaScript + +"Back in my day…" [JavaScript][8] was a client-side language that basically allowed people to streamline and automate user events in a browser and modify HTML elements. Today, JavaScript has escaped the browser and is available for other types of clients like mobile apps and even server-side programming. [Node.js][9] is a popular runtime environment that allows developers to code beyond the client-browser paradigm. To learn more about running Node.js on the Raspberry Pi, check out [W3Schools tutorial][10]. + +### Other languages + +If there's another language you want to learn, don't despair. There's a high likelihood that you can use your Raspberry Pi to compile or interpret any language of choice, including C, C++, PHP, and Ruby. + +Microsoft's [Visual Studio Code][11] also [runs on the Raspberry Pi][12]. It's an open source code editor from Microsoft that supports several markup and programming languages. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/programming-languages-raspberry-pi + +作者:[Anderson Silva][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ansilva +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/19/2/teach-kids-program-raspberry-pi +[2]: https://opensource.com/resources/python +[3]: https://www.economist.com/graphic-detail/2018/07/26/python-is-becoming-the-worlds-most-popular-coding-language +[4]: https://thonny.org/ +[5]: https://raspberrypihq.com/getting-started-with-python-programming-and-the-raspberry-pi/ +[6]: https://opensource.com/resources/java +[7]: https://www.bluej.org/raspberrypi/ +[8]: https://developer.mozilla.org/en-US/docs/Web/JavaScript +[9]: https://nodejs.org/en/ +[10]: https://www.w3schools.com/nodejs/nodejs_raspberrypi.asp +[11]: https://code.visualstudio.com/ +[12]: https://pimylifeup.com/raspberry-pi-visual-studio-code/ From f92832b55402b0a0eb7753c07b9209c79a895fe7 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 14:28:46 +0800 Subject: [PATCH 220/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190311=20Buildi?= =?UTF-8?q?ng=20the=20virtualization=20stack=20of=20the=20future=20with=20?= =?UTF-8?q?rust-vmm=20sources/tech/20190311=20Building=20the=20virtualizat?= =?UTF-8?q?ion=20stack=20of=20the=20future=20with=20rust-vmm.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ation stack of the future with rust-vmm.md | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 sources/tech/20190311 Building the virtualization stack of the future with rust-vmm.md diff --git a/sources/tech/20190311 Building the virtualization stack of the future with rust-vmm.md b/sources/tech/20190311 Building the virtualization stack of the future with rust-vmm.md new file mode 100644 index 0000000000..b1e7fbf046 --- /dev/null +++ b/sources/tech/20190311 Building the virtualization stack of the future with rust-vmm.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Building the virtualization stack of the future with rust-vmm) +[#]: via: (https://opensource.com/article/19/3/rust-virtual-machine) +[#]: author: (Andreea Florescu ) + +Building the virtualization stack of the future with rust-vmm +====== +rust-vmm facilitates sharing core virtualization components between Rust Virtual Machine Monitors. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_stack_blue_disks.png?itok=3hKDtK20) + +More than a year ago we started developing [Firecracker][1], a virtual machine monitor (VMM) that runs on top of KVM (the kernel-based virtual machine). We wanted to create a lightweight VMM that starts virtual machines (VMs) in a fraction of a second, with a low memory footprint, to enable high-density cloud environments. + +We started out developing Firecracker by forking the Chrome OS VMM ([CrosVM][2]), but we diverged shortly after because we targeted different customer use cases. CrosVM provides Linux application isolation in ChromeOS, while Firecracker is used for running multi-tenant workloads at scale. Even though we now walk different paths, we still have common virtualization components, such as wrappers over KVM input/output controls (ioctls), a minimal kernel loader, and use of the [Virtio][3] device models. + +With this in mind, we started thinking about the best approach for sharing the common code. Having a shared codebase raises the security and quality bar for both projects. Currently, fixing security bugs requires duplicated work in terms of porting the changes from one project to the other and going through different review processes for merging the changes. After open sourcing Firecracker, we've received requests for adding features including GPU support and booting [bzImage][4] files. Some of the requests didn't align with Firecracker's goals, but were otherwise valid use cases that just haven't found the right place for an implementation. + +### The rust-vmm project + +The [rust-vmm][5] project came to life in December 2018 when Amazon, Google, Intel, and Red Hat employees started talking about the best way of sharing virtualization packages. More contributors have joined this initiative along the way. We are still at the beginning of this journey, with only one component published to [Crates.io][6] (Rust's package registry) and several others (such as Virtio devices, Linux kernel loaders, and KVM ioctls wrappers) being developed. With two VMMs written in Rust under active development and growing interest in building other specialized VMMs, rust-vmm was born as the host for sharing core virtualization components. + +The goal of rust-vmm is to enable the community to create custom VMMs that import just the required building blocks for their use case. We decided to organize rust-vmm as a multi-repository project, where each repository corresponds to an independent virtualization component. Each individual building block is published on Crates.io. + +### Creating custom VMMs with rust-vmm + +The components discussed below are currently under development. + +![](https://opensource.com/sites/default/files/uploads/custom_vmm.png) + +Each box on the right side of the diagram is a GitHub repository corresponding to one package, which in Rust is called a crate. The functionality of one crate can be further split into modules, for example virtio-devices. Let's have a look at these components and some of their potential use cases. + + * **KVM interface:** Creating our VMM on top of KVM requires an interface that can invoke KVM functionality from Rust. The kvm-bindings crate represents the Rust Foreign Function Interface (FFI) to KVM kernel headers. Because headers only include structures and defines, we also have wrappers over the KVM ioctls (kvm-ioctls) that we use for opening dev/kvm, creating a VM, creating vCPUs, and so on. + + * **Virtio devices and rate limiting:** Virtio has a frontend-backend architecture. Currently in rust-vmm, the frontend is implemented in the virtio-devices crate, and the backend lies in the vhost package. Vhost has support for both user-land and kernel-land drivers, but users can also plug virtio-devices to their custom backend. The virtio-bindings are the bindings for Virtio devices generated using the Virtio Linux headers. All devices in the virtio-devices crate are exported independently as modules using conditional compilation. Some devices, such as block, net, and vsock support rate limiting in terms of I/O per second and bandwidth. This can be achieved by using the functionality provided in the rate-limiter crate. + + * The kernel-loader is responsible for loading the contents of an [ELF][7] kernel image in guest memory. + + + + +For example, let's say we want to build a custom VMM that allows users to create and configure a single VM running on top of KVM. As part of the configuration, users will be able to specify the kernel image file, the root file system, the number of vCPUs, and the memory size. Creating and configuring the resources of the VM can be implemented using the kvm-ioctls crate. The kernel image can be loaded in guest memory with kernel-loader, and specifying a root filesystem can be achieved with the virtio-devices block module. The last thing needed for our VMM is writing VMM Glue, the code that takes care of integrating rust-vmm components with the VMM user interface, which allows users to create and manage VMs. + +### How you can help + +This is the beginning of an exciting journey, and we are looking forward to getting more people interested in VMMs, Rust, and the place where you can find both: [rust-vmm][5]. + +We currently have [sync meetings][8] every two weeks to discuss the future of the rust-vmm organization. The meetings are open to anyone willing to participate. If you have any questions, please open an issue in the [community repository][9] or send an email to the rust-vmm [mailing list][10] (you can also [subscribe][11]). We also have a [Slack channel][12] and encourage you to join, if you are interested. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/rust-virtual-machine + +作者:[Andreea Florescu][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: +[b]: https://github.com/lujun9972 +[1]: https://github.com/firecracker-microvm/firecracker +[2]: https://chromium.googlesource.com/chromiumos/platform/crosvm/ +[3]: https://www.linux-kvm.org/page/Virtio +[4]: https://en.wikipedia.org/wiki/Vmlinux#bzImage +[5]: https://github.com/rust-vmm +[6]: https://crates.io/ +[7]: https://en.wikipedia.org/wiki/Executable_and_Linkable_Format +[8]: http://lists.opendev.org/pipermail/rust-vmm/2019-January/000103.html +[9]: https://github.com/rust-vmm/community +[10]: mailto:rust-vmm@lists.opendev.org +[11]: http://lists.opendev.org/cgi-bin/mailman/listinfo/rust-vmm +[12]: https://join.slack.com/t/rust-vmm/shared_invite/enQtNTI3NDM2NjA5MzMzLTJiZjUxOGEwMTJkZDVkYTcxYjhjMWU3YzVhOGQ0M2Y5NmU5MzExMjg5NGE3NjlmNzNhZDlhMmY4ZjVhYTQ4ZmQ From 23bb900f2d2a858288629f09e303d8c80c3808c4 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 14:30:30 +0800 Subject: [PATCH 221/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190307=20How=20?= =?UTF-8?q?to=20keep=20your=20Raspberry=20Pi=20updated=20sources/tech/2019?= =?UTF-8?q?0307=20How=20to=20keep=20your=20Raspberry=20Pi=20updated.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...7 How to keep your Raspberry Pi updated.md | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 sources/tech/20190307 How to keep your Raspberry Pi updated.md diff --git a/sources/tech/20190307 How to keep your Raspberry Pi updated.md b/sources/tech/20190307 How to keep your Raspberry Pi updated.md new file mode 100644 index 0000000000..65218c64c9 --- /dev/null +++ b/sources/tech/20190307 How to keep your Raspberry Pi updated.md @@ -0,0 +1,51 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to keep your Raspberry Pi updated) +[#]: via: (https://opensource.com/article/19/3/how-raspberry-pi-update) +[#]: author: (Anderson Silva https://opensource.com/users/ansilva) + +How to keep your Raspberry Pi updated +====== +Learn how to keep your Raspberry Pi patched and working well in the seventh article in our guide to getting started with the Raspberry Pi. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_happy_sad_developer_programming.png?itok=72nkfSQ_) + +Just like your tablet, cellphone, and laptop, you need to keep your Raspberry Pi updated. Not only will the latest enhancements keep your Pi running smoothly, they will also keep you safer, especially if you are connected to a network. The seventh article in our guide to getting started with the Raspberry Pi shares two pieces of advice on keeping your Pi working well. + +### Update Raspbian + +Updating your Raspbian installation is a [two-step process][1]: + + 1. In your terminal type: **sudo apt-get update** +The command **sudo** allows you to run **apt-get update** as admin (aka root). Note that **apt-get update** will not install anything new on your system; rather it will update the list of packages and dependencies that need to be updated. + + + 2. Then type: **sudo apt-get dist-upgrade** +From the documentation: "Generally speaking, doing this regularly will keep your installation up to date, in that it will be equivalent to the latest released image available from [raspberrypi.org/downloads][2]." + +![](https://opensource.com/sites/default/files/uploads/update_sudo_rpi.png) + +### Be careful with rpi-update + +Raspbian comes with another little update utility called [rpi-update][3]. This utility can be used to upgrade your Pi to the latest firmware which may or may not be broken/buggy. You may find information explaining how to use it, but as of late it is recommended never to use this application unless you have a really good reason to do so. + +Bottom line: Keep your systems updated! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/how-raspberry-pi-update + +作者:[Anderson Silva][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ansilva +[b]: https://github.com/lujun9972 +[1]: https://www.raspberrypi.org/documentation/raspbian/updating.md +[2]: https://www.raspberrypi.org/downloads/ +[3]: https://github.com/Hexxeh/rpi-update From a2cdb3b2ce09ef418300e9f0e48d2bdfab5d976b Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 14:31:35 +0800 Subject: [PATCH 222/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190308=20How=20?= =?UTF-8?q?to=20use=20your=20Raspberry=20Pi=20for=20entertainment=20source?= =?UTF-8?q?s/tech/20190308=20How=20to=20use=20your=20Raspberry=20Pi=20for?= =?UTF-8?q?=20entertainment.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...use your Raspberry Pi for entertainment.md | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 sources/tech/20190308 How to use your Raspberry Pi for entertainment.md diff --git a/sources/tech/20190308 How to use your Raspberry Pi for entertainment.md b/sources/tech/20190308 How to use your Raspberry Pi for entertainment.md new file mode 100644 index 0000000000..039b0b4598 --- /dev/null +++ b/sources/tech/20190308 How to use your Raspberry Pi for entertainment.md @@ -0,0 +1,57 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to use your Raspberry Pi for entertainment) +[#]: via: (https://opensource.com/article/19/3/raspberry-pi-entertainment) +[#]: author: (Anderson Silva https://opensource.com/users/ansilva) + +How to use your Raspberry Pi for entertainment +====== +Learn how to watch Netflix and listen to music on your Raspberry Pi, in the eighth article in our guide to getting started with Raspberry Pi. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/video_editing_folder_music_wave_play.png?itok=-J9rs-My) + +So far, this series has focused on more serious topics—how to [choose][1], [buy][2], [set up][3], and [update][4] your Raspberry Pi, and different things [kids][5] and [adults][6] can learn with it (including [Linux][7]). But now it's time to change up the subject and have some fun! Today we'll look at ways to use your Raspberry Pi for entertainment, and tomorrow we'll continue the fun with gaming. + +### Watch TV and movies + +You can use your Raspberry Pi and the [Open Source Media Center][8] (OSMC) to [watch Netflix][9]! The OSMC is a system based on the [Kodi][10] project that allows you to play back media from your local network, attached storage, and the internet. It's also known for having the best feature set and community among media center applications. + +NOOBS (which we talked about in the [third article][11] in this series) allows you to [install OSMC][12] on your Raspberry Pi as easily as possible. NOOBS also offers another media center system based on Kodi called [LibreELEC][13]. + +### Listen to music + +![](https://opensource.com/sites/default/files/uploads/raspberrypi_8_pimusicbox.png) + +You can also stream music on your network via attached storage or services like Spotify on your Raspberry Pi with the [Pi Music Box][14] project. I [wrote about it][15] a while ago, but you can find newer instructions, including how to's and DIY projects, on the [Pi Music Box website][16]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/raspberry-pi-entertainment + +作者:[Anderson Silva][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ansilva +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/19/3/which-raspberry-pi-choose +[2]: https://opensource.com/article/19/2/how-buy-raspberry-pi +[3]: https://opensource.com/article/19/2/how-boot-new-raspberry-pi +[4]: https://opensource.com/article/19/2/how-keep-your-raspberry-pi-updated-and-patched +[5]: https://opensource.com/article/19/3/teach-kids-program-raspberry-pi +[6]: https://opensource.com/article/19/2/3-popular-programming-languages-you-can-learn-raspberry-pi +[7]: https://opensource.com/article/19/2/learn-linux-raspberry-pi +[8]: https://osmc.tv/ +[9]: https://www.dailydot.com/upstream/netflix-raspberry-pi/ +[10]: http://kodi.tv/ +[11]: https://opensource.com/article/19/3/how-boot-new-raspberry-pi +[12]: https://www.raspberrypi.org/documentation/usage/kodi/ +[13]: https://libreelec.tv/ +[14]: https://github.com/pimusicbox/pimusicbox/tree/master +[15]: https://opensource.com/life/15/3/pi-musicbox-guide +[16]: https://www.pimusicbox.com/ From 959113109f4cb7715dfca9f9fd56cd062a5d0c97 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 14:33:07 +0800 Subject: [PATCH 223/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190309=20Emulat?= =?UTF-8?q?ors=20and=20Native=20Linux=20games=20on=20the=20Raspberry=20Pi?= =?UTF-8?q?=20sources/tech/20190309=20Emulators=20and=20Native=20Linux=20g?= =?UTF-8?q?ames=20on=20the=20Raspberry=20Pi.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... Native Linux games on the Raspberry Pi.md | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 sources/tech/20190309 Emulators and Native Linux games on the Raspberry Pi.md diff --git a/sources/tech/20190309 Emulators and Native Linux games on the Raspberry Pi.md b/sources/tech/20190309 Emulators and Native Linux games on the Raspberry Pi.md new file mode 100644 index 0000000000..91670b7015 --- /dev/null +++ b/sources/tech/20190309 Emulators and Native Linux games on the Raspberry Pi.md @@ -0,0 +1,48 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Emulators and Native Linux games on the Raspberry Pi) +[#]: via: (https://opensource.com/article/19/3/play-games-raspberry-pi) +[#]: author: (Anderson Silva https://opensource.com/users/ansilva) + +Emulators and Native Linux games on the Raspberry Pi +====== +The Raspberry Pi is a great platform for gaming; learn how in the ninth article in our series on getting started with the Raspberry Pi. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/getting_started_with_minecraft_copy.png?itok=iz4RF7f8) + +Back in the [fifth article][1] in our series on getting started with the Raspberry Pi, I mentioned Minecraft as a way to teach kids to program using a gaming platform. Today we'll talk about other ways you can play games on your Raspberry Pi, as it's a great platform for gaming—with and without emulators. + +### Gaming with emulators + +Emulators are software that allow you to play games from different systems and different decades on your Raspberry Pi. Of the many emulators available today, the most popular for the Raspberry Pi is [RetroPi][2]. You can use it to play games from systems such as Apple II, Amiga, Atari 2600, Commodore 64, Game Boy Advance, and [many others][3]. + +If RetroPi sounds interesting, check out [these instructions][4] on how to get started, and start having fun today! + +### Native Linux games + +There are also plenty of native Linux games available on Raspbian, Raspberry Pi's operating system. Make Use Of has a great article on [how to play 10 old favorites][5] like Doom and Nuke Dukem 3D on the Raspberry Pi. + +You can also use your Raspberry Pi as a [game server][6]. For example, you can set up Terraria, Minecraft, and QuakeWorld servers on the Raspberry Pi. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/play-games-raspberry-pi + +作者:[Anderson Silva][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ansilva +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/19/3/teach-kids-program-raspberry-pi +[2]: https://retropie.org.uk/ +[3]: https://retropie.org.uk/about/systems +[4]: https://opensource.com/article/19/1/retropie +[5]: https://www.makeuseof.com/tag/classic-games-raspberry-pi-without-emulators/ +[6]: https://www.makeuseof.com/tag/raspberry-pi-game-servers/ From 6d1abf6d1749ff63f955b757b5c5845e529ce121 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 14:34:11 +0800 Subject: [PATCH 224/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190310=20Let's?= =?UTF-8?q?=20get=20physical:=20How=20to=20use=20GPIO=20pins=20on=20the=20?= =?UTF-8?q?Raspberry=20Pi=20sources/tech/20190310=20Let-s=20get=20physical?= =?UTF-8?q?-=20How=20to=20use=20GPIO=20pins=20on=20the=20Raspberry=20Pi.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ow to use GPIO pins on the Raspberry Pi.md | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 sources/tech/20190310 Let-s get physical- How to use GPIO pins on the Raspberry Pi.md diff --git a/sources/tech/20190310 Let-s get physical- How to use GPIO pins on the Raspberry Pi.md b/sources/tech/20190310 Let-s get physical- How to use GPIO pins on the Raspberry Pi.md new file mode 100644 index 0000000000..d22887e15f --- /dev/null +++ b/sources/tech/20190310 Let-s get physical- How to use GPIO pins on the Raspberry Pi.md @@ -0,0 +1,48 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Let's get physical: How to use GPIO pins on the Raspberry Pi) +[#]: via: (https://opensource.com/article/19/3/gpio-pins-raspberry-pi) +[#]: author: (Anderson Silva https://opensource.com/users/ansilva) + +Let's get physical: How to use GPIO pins on the Raspberry Pi +====== +The 10th article in our series on getting started with Raspberry Pi explains how the GPIO pins work. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/raspbery_pi_zero_wireless_hardware.jpg?itok=9YFzdxFQ) + +Until now, this series has focused on the Raspberry Pi's software side, but today we'll get into the hardware. The availability of [general-purpose input/output][1] (GPIO) pins was one of the main features that interested me in the Pi when it first came out. GPIO allows you to programmatically interact with the physical world by attaching sensors, relays, and other types of circuitry to the Raspberry Pi. + +![](https://opensource.com/sites/default/files/uploads/raspberrypi_10_gpio-pins-pi2.jpg) + +Each pin on the board either has a predefined function or is designated as general purpose. Also, different Raspberry Pi models have either 26 or 40 pins for you to use at your discretion. Wikipedia has a [good overview of each pin][2] and its functionality. + +You can do many things with the Pi's GPIO pins. I've written some other articles about using the GPIOs, including a trio of articles ([Part I][3], [Part II][4], and [Part III][5]) about controlling holiday lights with the Raspberry Pi while using open source software to pair the lights with music. + +The Raspberry Pi community has done a great job in creating libraries in different programming languages, so you should be able to interact with the pins using [C][6], [Python][7], [Scratch][8], and other languages. + +Also, if you want the ultimate experience to interact with the physical world, pick up a [Raspberry Pi Sense Hat][9]. It is an affordable expansion board for the Pi that plugs into the GPIO pins so you can programmatically interact with LEDs, joysticks, and barometric pressure, temperature, humidity, gyroscope, accelerometer, and magnetometer sensors. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/gpio-pins-raspberry-pi + +作者:[Anderson Silva][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ansilva +[b]: https://github.com/lujun9972 +[1]: https://www.raspberrypi.org/documentation/usage/gpio/ +[2]: https://en.wikipedia.org/wiki/Raspberry_Pi#General_purpose_input-output_(GPIO)_connector +[3]: https://opensource.com/life/15/2/music-light-show-with-raspberry-pi +[4]: https://opensource.com/life/15/12/ssh-your-christmas-tree-raspberry-pi +[5]: https://opensource.com/article/18/12/lightshowpi-raspberry-pi +[6]: https://www.bigmessowires.com/2018/05/26/raspberry-pi-gpio-programming-in-c/ +[7]: https://www.raspberrypi.org/documentation/usage/gpio/python/README.md +[8]: https://www.raspberrypi.org/documentation/usage/gpio/scratch2/README.md +[9]: https://opensource.com/life/16/4/experimenting-raspberry-pi-sense-hat From 56fbee5512f1ef5a4b2c3c7d8605c6c0cb1fa0b0 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 14:34:59 +0800 Subject: [PATCH 225/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190311=20Learn?= =?UTF-8?q?=20about=20computer=20security=20with=20the=20Raspberry=20Pi=20?= =?UTF-8?q?and=20Kali=20Linux=20sources/tech/20190311=20Learn=20about=20co?= =?UTF-8?q?mputer=20security=20with=20the=20Raspberry=20Pi=20and=20Kali=20?= =?UTF-8?q?Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ty with the Raspberry Pi and Kali Linux.md | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 sources/tech/20190311 Learn about computer security with the Raspberry Pi and Kali Linux.md diff --git a/sources/tech/20190311 Learn about computer security with the Raspberry Pi and Kali Linux.md b/sources/tech/20190311 Learn about computer security with the Raspberry Pi and Kali Linux.md new file mode 100644 index 0000000000..bb57fb2857 --- /dev/null +++ b/sources/tech/20190311 Learn about computer security with the Raspberry Pi and Kali Linux.md @@ -0,0 +1,62 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Learn about computer security with the Raspberry Pi and Kali Linux) +[#]: via: (https://opensource.com/article/19/3/computer-security-raspberry-pi) +[#]: author: (Anderson Silva https://opensource.com/users/ansilva) + +Learn about computer security with the Raspberry Pi and Kali Linux +====== +Raspberry Pi is a great way to learn about computer security. Learn how in the 11th article in our getting-started series. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security_privacy_lock.png?itok=ZWjrpFzx) + +Is there a hotter topic in technology than securing your computer? Some experts will tell you that there is no such thing as perfect security. They joke that if you want your server or application to be truly secure, then turn off your server, unplug it from the network, and put it in a safe somewhere. The problem with that should be obvious: What good is an app or server that nobody can use? + +That's the conundrum around security. How can we make something secure enough and still usable and valuable? I am not a security expert by any means, although I hope to be one day. With that in mind, I thought it would make sense to share some ideas about what you can do with a Raspberry Pi to learn more about security. + +I should note that, like the other articles in this series dedicated to Raspberry Pi beginners, my goal is not to dive in deep, rather to light a fire of interest for you to learn more about these topics. + +### Kali Linux + +When it comes to "doing security things," one of the Linux distributions that comes to mind is [Kali Linux][1]. Kali's development is primarily focused on forensics and penetration testing. It has more than 600 preinstalled [penetration-testing programs][2] to test your computer's security, and a [forensics mode][3], which prevents it from touching the internal hard drive or swap space of the system being examined. + +![](https://opensource.com/sites/default/files/uploads/raspberrypi_11_kali.png) + +Like Raspbian, Kali Linux is based on the Debian distribution, and you can find directions on installing it on the Raspberry Pi in its main [documentation portal][4]. If you installed Raspbian or another Linux distribution on your Raspberry Pi, you should have no problem installing Kali. Kali Linux's creators have even put together [training, workshops, and certifications][5] to help boost your career in the security field. + +### Other Linux distros + +Most standard Linux distributions, like Raspbian, Ubuntu, and Fedora, also have [many security tools available][6] in their repositories. Some great tools to explore include [Nmap][7], [Wireshark][8], [auditctl][9], and [SELinux][10]. + +### Projects + +There are many other security-related projects you can run on your Raspberry Pi, such as [Honeypots][11], [Ad blockers][12], and [USB sanitizers][13]. Take some time and learn about them! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/computer-security-raspberry-pi + +作者:[Anderson Silva][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ansilva +[b]: https://github.com/lujun9972 +[1]: https://www.kali.org/ +[2]: https://en.wikipedia.org/wiki/Kali_Linux#Development +[3]: https://docs.kali.org/general-use/kali-linux-forensics-mode +[4]: https://docs.kali.org/kali-on-arm/install-kali-linux-arm-raspberry-pi +[5]: https://www.kali.org/penetration-testing-with-kali-linux/ +[6]: https://linuxblog.darkduck.com/2019/02/9-best-linux-based-security-tools.html +[7]: https://nmap.org/ +[8]: https://www.wireshark.org/ +[9]: https://linux.die.net/man/8/auditctl +[10]: https://opensource.com/article/18/7/sysadmin-guide-selinux +[11]: https://trustfoundry.net/honeypi-easy-honeypot-raspberry-pi/ +[12]: https://pi-hole.net/ +[13]: https://www.circl.lu/projects/CIRCLean/ From f31ba9330fcb3e1262a4724396c7bad3522051c6 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 14:36:58 +0800 Subject: [PATCH 226/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190311=20Discus?= =?UTF-8?q?s=20everything=20Fedora=20sources/talk/20190311=20Discuss=20eve?= =?UTF-8?q?rything=20Fedora.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20190311 Discuss everything Fedora.md | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 sources/talk/20190311 Discuss everything Fedora.md diff --git a/sources/talk/20190311 Discuss everything Fedora.md b/sources/talk/20190311 Discuss everything Fedora.md new file mode 100644 index 0000000000..5795fbf3f7 --- /dev/null +++ b/sources/talk/20190311 Discuss everything Fedora.md @@ -0,0 +1,45 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Discuss everything Fedora) +[#]: via: (https://fedoramagazine.org/discuss-everything-fedora/) +[#]: author: (Ryan Lerch https://fedoramagazine.org/introducing-flatpak/) + +Discuss everything Fedora +====== +![](https://fedoramagazine.org/wp-content/uploads/2019/03/fedora-discussion-816x345.jpg) + +Are you interested in how Fedora is being developed? Do you want to get involved, or see what goes into making a release? You want to check out [Fedora Discussion][1]. It is a relatively new place where members of the Fedora Community meet to discuss, ask questions, and interact. Keep reading for more information. + +Note that the Fedora Discussion system is mainly aimed at contributors. If you have questions on using Fedora, check out [Ask Fedora][2] (which is being migrated in the future). + +![][3] + +Fedora Discussion is a forum and discussion site that uses the [Discourse open source discussion platform][4]. + +There are already several categories useful for Fedora users, including [Desktop][5] (covering Fedora Workstation, Fedora Silverblue, KDE, XFCE, and more) and the [Server, Cloud, and IoT][6] category . Additionally, some of the [Fedora Special Interest Groups (SIGs) have discussions as well][7]. Finally, the [Fedora Friends][8] category helps you connect with other Fedora users and Community members by providing discussions about upcoming meetups and hackfests. + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/discuss-everything-fedora/ + +作者:[Ryan Lerch][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/introducing-flatpak/ +[b]: https://github.com/lujun9972 +[1]: https://discussion.fedoraproject.org/ +[2]: https://ask.fedoraproject.org +[3]: https://fedoramagazine.org/wp-content/uploads/2019/03/discussion-screenshot-1024x663.png +[4]: https://www.discourse.org/about +[5]: https://discussion.fedoraproject.org/c/desktop +[6]: https://discussion.fedoraproject.org/c/server +[7]: https://discussion.fedoraproject.org/c/sigs +[8]: https://discussion.fedoraproject.org/c/friends From 895d96f4ad8ed142468f0fc84f6284b8703fd633 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 14:49:45 +0800 Subject: [PATCH 227/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190718=203=20Em?= =?UTF-8?q?acs=20modes=20for=20taking=20notes=20sources/tech/20190718=203?= =?UTF-8?q?=20Emacs=20modes=20for=20taking=20notes.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...20190718 3 Emacs modes for taking notes.md | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 sources/tech/20190718 3 Emacs modes for taking notes.md diff --git a/sources/tech/20190718 3 Emacs modes for taking notes.md b/sources/tech/20190718 3 Emacs modes for taking notes.md new file mode 100644 index 0000000000..2627357182 --- /dev/null +++ b/sources/tech/20190718 3 Emacs modes for taking notes.md @@ -0,0 +1,74 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 Emacs modes for taking notes) +[#]: via: (https://opensource.com/article/18/7/emacs-modes-note-taking) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) + +3 Emacs modes for taking notes +====== +Keep track of information easily with these Emacs modes. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/notebook-writing-pen.jpg?itok=uA3dCfu_) + +No matter what line of work you're in, it's inevitable you have to take a few notes. Often, more than a few. If you're like many people in this day and age, you take your notes digitally. + +Open source enthusiasts have a variety of options for jotting down their ideas, thoughts, and research in electronic format. You might use a [web-based tool][1]. You might go for a [desktop application][2]. Or, you might [turn to the command line][3]. + +If you use [Emacs][4], that wonderful operating system disguised as a text editor, there are modes that can help you take notes more efficiently. Let's look at three of them. + +### Deft +![](https://opensource.com/sites/default/files/uploads/deft.png) + +On those rare occasions I'm forced to use a Mac, there's one tool I can't do without: the [nvALT][5] note-taking application. [Deft mode][6] brings the nvALT experience to Emacs. + +Deft stores your notes as text files in a single folder on your computer. When you enter Deft mode, it displays a list of your notes along with a short summary. The summary is taken from the first line of the text file. If you add, say, Markdown, LaTeX, or even Emacs Org mode formatting to the first line, Deft ignores the formatting and displays only the text. + +To open a note, just scroll down to it and press Enter. Deft does a bit more, though. According to Deft's developer, Jason Blevins, its _primary operation is searching and filtering_. Deft does that simply but efficiently. Type a keyword and Deft displays only the notes that have that keyword in their title. That's useful if you have a lot of notes and want to find one quickly. + +### Org mode +![](https://opensource.com/sites/default/files/uploads/orgmode.png) + +There would be a couple or three people who would have jumped all over me if I didn't include [Org mode][7] in this article. Why? It's arguably the most flexible and the most widely used Emacs mode for taking notes. Used in the right way, Org mode can supercharge your note-taking. + +Org mode's main strength is how it organizes your notes. In Org mode, a note file is set up as a large outline. Each section is a node in the outline, which you can expand and collapse. Those sections can have subsections, which also expand and collapse. That not only lets you focus on one section at a time, but it also gives you an at-a-glance overview of the information you have. + +You can [link][8] between sections of your notes, quickly move sections without cutting and pasting, and [attach files][9] to your notes. Org mode supports character formatting and tables. If you need to convert your notes to something else, Org mode has a number of [export options][10]. + +### Howm + +![](https://opensource.com/sites/default/files/uploads/howm.png) + +When I started using Emacs regularly, [howm][11] quickly became one of the modes I leaned heavily on. And even though I'm deep into using Org mode, I still have a soft spot for howm. + +Howm acts like a small wiki. You can create notes and task lists and link between them. By typing or clicking a link, you can jump between notes. If you need to, you can also tag your notes with a keyword. On top of that, you can search, sort, and concatenate your notes. + +Howm isn't the prettiest Emacs mode, and it doesn't have the best UX. It takes a bit of getting used to. Once you do, taking and maneuvering around notes is a breeze. + +Do you have a favorite Emacs mode for taking notes? Feel free to share it by leaving a comment. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/7/emacs-modes-note-taking + +作者:[Scott Nesbitt][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/scottnesbitt +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/alternatives/evernote +[2]: https://opensource.com/life/16/9/4-desktop-note-taking-applications +[3]: https://opensource.com/article/18/3/command-line-note-taking-applications +[4]: https://www.gnu.org/software/emacs/ +[5]: http://brettterpstra.com/projects/nvalt/ +[6]: https://jblevins.org/projects/deft/ +[7]: https://orgmode.org/ +[8]: https://orgmode.org/org.html#Hyperlinks +[9]: https://orgmode.org/org.html#Attachments +[10]: https://orgmode.org/org.html#Exporting +[11]: https://howm.osdn.jp/ From 000611dc28117e12303a4f612e25ad2265b8a072 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 14:51:10 +0800 Subject: [PATCH 228/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190311=207=20re?= =?UTF-8?q?sources=20for=20learning=20to=20use=20your=20Raspberry=20Pi=20s?= =?UTF-8?q?ources/tech/20190311=207=20resources=20for=20learning=20to=20us?= =?UTF-8?q?e=20your=20Raspberry=20Pi.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...s for learning to use your Raspberry Pi.md | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 sources/tech/20190311 7 resources for learning to use your Raspberry Pi.md diff --git a/sources/tech/20190311 7 resources for learning to use your Raspberry Pi.md b/sources/tech/20190311 7 resources for learning to use your Raspberry Pi.md new file mode 100644 index 0000000000..4ee4fdf8c8 --- /dev/null +++ b/sources/tech/20190311 7 resources for learning to use your Raspberry Pi.md @@ -0,0 +1,80 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (7 resources for learning to use your Raspberry Pi) +[#]: via: (https://opensource.com/article/19/3/resources-raspberry-pi) +[#]: author: (Manuel Dewald https://opensource.com/users/ntlx) + +7 resources for learning to use your Raspberry Pi +====== +Books, courses, and websites to shorten your Raspberry Pi learning curve. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/reading_book_stars_list.png?itok=Iwa1oBOl) + +The [Raspberry Pi][1] is a small, single-board computer originally intended for teaching and learning programming and computer science. But today it's so much more. It is affordable, low-energy computing power that people can use for all kinds of things—from home entertainment over server applications to Internet of Things (IoT) projects. + +There are so many resources on the topic and so many different projects you can do, it's hard to know where to begin. Following are some resources that will help you get started with the Raspberry Pi. Have fun browsing through it, but don't stop here. By looking left and right you will find a lot to discover and get deeper into the rabbit hole of the Raspberry Pi wonderland. + +### Books + +There are many books available in different languages about the Raspberry Pi. These two will help you start—then dive deep—into Raspberry Pi topics. + +#### Raspberry Pi Cookbook: Software and Hardware Problems and Solutions by Simon Monk + +Simon Monk is a software engineer and was a hobbyist maker for years. He was first attracted to the Arduino as an easy-to-use board for electronics development and later published a [book][2] about it. Later, he moved on to the Raspberry Pi and wrote [Raspberry Pi Cookbook: Software and Hardware Problems and Solutions][3]. In the book, you can find a lot of best practices for Raspberry Pi projects and solutions for all kinds of challenges you may face. + +#### Programming the Raspberry Pi: Getting Started with Python by Simon Monk + +Python has evolved as the go-to programming language for getting started with Raspberry Pi projects, as it is easy to learn and use, even if you don't have any programming experience. Also, a lot of its libraries help you focus on what makes your project special instead of implementing protocols to communicate with your sensors again and again. Monk wrote two chapters about Python programming in the Raspberry Pi Cookbook, but [Programming the Raspberry Pi: Getting Started with Python][4] is a more thorough quickstart. It introduces you to Python and shows you some projects you can create with it on the Raspberry Pi. + +### Online course + +There are many online courses and tutorials new Raspberry Pi users can choose from, including this introductory class. + +#### Raspberry Pi Class + +Instructables' free [Raspberry Pi Class][5] online course offers you an all-around introduction to the Raspberry Pi. It starts with Raspberry Pi and Linux operating basics, then gets into Python programming and GPIO communication. This makes it a good top-to-bottom Raspberry Pi guide if you are new to the topic and want to get started quickly. + +### Websites + +The web is rife with excellent information about Raspberry Pi, but these four sites should be on the top of any new user's list. + +#### RaspberryPi.org + +The official [Raspberry Pi][6] website is one of the best places to get started. Many articles about specific projects link to the site for the basics like installing Raspbian onto the Raspberry Pi. (This is what I tend to do, instead of repeating the instructions in every how-to.) You can also find [sample projects][7] and courses on [teaching][8] tech topics to students. + +#### Opensource.com + +On Opensource.com, you can find a number of different Raspberry Pi project how-to's, getting started guides, success stories, updates, and more. Take a look at the [Raspberry Pi topic page][9] to find out what people are doing with Raspberry Pi. + +#### Instructables and Hackaday + +Do you want to build your own retro arcade gaming console? Or for your mirror to display weather information, the time, and the first event on the day's calendar? Are you looking to create a word clock or maybe a photo booth for a party? Chances are good that you will find instructions on how to do all of this (and more!) with a Raspberry Pi on sites like [Instructables][10] and [Hackaday][11]. If you're not sure if you should get a Raspberry Pi, browse these sites, and you'll find plenty of reasons to buy one. + +What are your favorite Raspberry Pi resources? Please share them in the comments! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/resources-raspberry-pi + +作者:[Manuel Dewald][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ntlx +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/resources/raspberry-pi +[2]: http://simonmonk.org/progardui2ed/ +[3]: http://simonmonk.org/raspberry-pi-cookbook-ed2/ +[4]: http://simonmonk.org/programming-raspberry-pi-ed2/ +[5]: https://www.instructables.com/class/Raspberry-Pi-Class/ +[6]: https://raspberrypi.org +[7]: https://projects.raspberrypi.org/ +[8]: https://www.raspberrypi.org/training/online +[9]: https://opensource.com/tags/raspberry-pi +[10]: https://www.instructables.com/technology/raspberry-pi/ +[11]: https://hackaday.io/projects?tag=raspberry%20pi From 042384c2a92b2895c73d854156bc85278863d0f5 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 15:01:39 +0800 Subject: [PATCH 229/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020181218=20Using?= =?UTF-8?q?=20Pygame=20to=20move=20your=20game=20character=20around=20sour?= =?UTF-8?q?ces/tech/20181218=20Using=20Pygame=20to=20move=20your=20game=20?= =?UTF-8?q?character=20around.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...game to move your game character around.md | 353 ++++++++++++++++++ 1 file changed, 353 insertions(+) create mode 100644 sources/tech/20181218 Using Pygame to move your game character around.md diff --git a/sources/tech/20181218 Using Pygame to move your game character around.md b/sources/tech/20181218 Using Pygame to move your game character around.md new file mode 100644 index 0000000000..96daf8da7d --- /dev/null +++ b/sources/tech/20181218 Using Pygame to move your game character around.md @@ -0,0 +1,353 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using Pygame to move your game character around) +[#]: via: (https://opensource.com/article/17/12/game-python-moving-player) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Using Pygame to move your game character around +====== +In the fourth part of this series, learn how to code the controls needed to move a game character. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python4-game.png?itok=tXFHaLdt) + +In the first article in this series, I explained how to use Python to create a simple, [text-based dice game][1]. In the second part, we began building a game from scratch, starting with [creating the game's environment][2]. And, in the third installment, we [created a player sprite][3] and made it spawn in your (rather empty) game world. As you've probably noticed, a game isn't much fun if you can't move your character around. In this article, we'll use Pygame to add keyboard controls so you can direct your character's movement. + +There are functions in Pygame to add other kinds of controls, but since you certainly have a keyboard if you're typing out Python code, that's what we'll use. Once you understand keyboard controls, you can explore other options on your own. + +You created a key to quit your game in the second article in this series, and the principle is the same for movement. However, getting your character to move is a little more complex. + +Let's start with the easy part: setting up the controller keys. + +### Setting up keys for controlling your player sprite + +Open your Python game script in IDLE, Ninja-IDE, or a text editor. + +Since the game must constantly "listen" for keyboard events, you'll be writing code that needs to run continuously. Can you figure out where to put code that needs to run constantly for the duration of the game? + +If you answered "in the main loop," you're correct! Remember that unless code is in a loop, it will run (at most) only once—and it may not run at all if it's hidden away in a class or function that never gets used. + +To make Python monitor for incoming key presses, add this code to the main loop. There's no code to make anything happen yet, so use `print` statements to signal success. This is a common debugging technique. + +``` +while main == True: +    for event in pygame.event.get(): +        if event.type == pygame.QUIT: +            pygame.quit(); sys.exit() +            main = False + +        if event.type == pygame.KEYDOWN: +            if event.key == pygame.K_LEFT or event.key == ord('a'): +                print('left') +            if event.key == pygame.K_RIGHT or event.key == ord('d'): +                print('right') +            if event.key == pygame.K_UP or event.key == ord('w'): +            print('jump') + +        if event.type == pygame.KEYUP: +            if event.key == pygame.K_LEFT or event.key == ord('a'): +                print('left stop') +            if event.key == pygame.K_RIGHT or event.key == ord('d'): +                print('right stop') +            if event.key == ord('q'): +                pygame.quit() +                sys.exit() +                main = False     +``` + +Some people prefer to control player characters with the keyboard characters W, A, S, and D, and others prefer to use arrow keys. Be sure to include both options. + +**Note: **It's vital that you consider all of your users when programming. If you write code that works only for you, it's very likely that you'll be the only one who uses your application. More importantly, if you seek out a job writing code for money, you are expected to write code that works for everyone. Giving your users choices, such as the option to use either arrow keys or WASD, is a sign of a good programmer. + +Launch your game using Python, and watch the console window for output as you press the right, left, and up arrows, or the A, D, and W keys. + +``` +$ python ./your-name_game.py +  left +  left stop +  right +  right stop +  jump +``` + +This confirms that Pygame detects key presses correctly. Now it's time to do the hard work of making the sprite move. + +### Coding the player movement function + +To make your sprite move, you must create a property for your sprite that represents movement. When your sprite is not moving, this variable is set to `0`. + +If you are animating your sprite, or should you decide to animate it in the future, you also must track frames to enable the walk cycle to stay on track. + +Create the variables in the Player class. The first two lines are for context (you already have them in your code, if you've been following along), so add only the last three: + +``` +    def __init__(self): +        pygame.sprite.Sprite.__init__(self) +        self.movex = 0 # move along X +        self.movey = 0 # move along Y +        self.frame = 0 # count frames +``` + +With those variables set, it's time to code the sprite's movement. + +The player sprite doesn't need to respond to control all the time; sometimes it will not be moving. The code that controls the sprite, therefore, is only one small part of all the things the player sprite will do. When you want to make an object in Python do something independent of the rest of its code, you place your new code in a function. Python functions start with the keyword `def`, which stands for define. + +Make a function in your Player class to add some number of pixels to your sprite's position on screen. Don't worry about how many pixels you add yet; that will be decided in later code. + +``` +    def control(self,x,y): +        ''' +        control player movement +        ''' +        self.movex += x +        self.movey += y +``` + +To move a sprite in Pygame, you have to tell Python to redraw the sprite in its new location—and where that new location is. + +Since the Player sprite isn't always moving, the updates need to be only one function within the Player class. Add this function after the `control` function you created earlier. + +To make it appear that the sprite is walking (or flying, or whatever it is your sprite is supposed to do), you need to change its position on screen when the appropriate key is pressed. To get it to move across the screen, you redefine its position, designated by the `self.rect.x` and `self.rect.y` properties, to its current position plus whatever amount of `movex` or `movey` is applied. (The number of pixels the move requires is set later.) + +``` +    def update(self): +        ''' +        Update sprite position +        ''' +        self.rect.x = self.rect.x + self.movex         +``` + +Do the same thing for the Y position: + +``` +        self.rect.y = self.rect.y + self.movey +``` + +For animation, advance the animation frames whenever your sprite is moving, and use the corresponding animation frame as the player image: + +``` +        # moving left +        if self.movex < 0: +            self.frame += 1 +            if self.frame > 3*ani: +                self.frame = 0 +            self.image = self.images[self.frame//ani] + +        # moving right +        if self.movex > 0: +            self.frame += 1 +            if self.frame > 3*ani: +                self.frame = 0 +            self.image = self.images[(self.frame//ani)+4] +``` + +Tell the code how many pixels to add to your sprite's position by setting a variable, then use that variable when triggering the functions of your Player sprite. + +First, create the variable in your setup section. In this code, the first two lines are for context, so just add the third line to your script: + +``` +player_list = pygame.sprite.Group() +player_list.add(player) +steps = 10  # how many pixels to move +``` + +Now that you have the appropriate function and variable, use your key presses to trigger the function and send the variable to your sprite. + +Do this by replacing the `print` statements in your main loop with the Player sprite's name (player), the function (.control), and how many steps along the X axis and Y axis you want the player sprite to move with each loop. + +``` +        if event.type == pygame.KEYDOWN: +            if event.key == pygame.K_LEFT or event.key == ord('a'): +                player.control(-steps,0) +            if event.key == pygame.K_RIGHT or event.key == ord('d'): +                player.control(steps,0) +            if event.key == pygame.K_UP or event.key == ord('w'): +                print('jump') + +        if event.type == pygame.KEYUP: +            if event.key == pygame.K_LEFT or event.key == ord('a'): +                player.control(steps,0) +            if event.key == pygame.K_RIGHT or event.key == ord('d'): +                player.control(-steps,0) +            if event.key == ord('q'): +                pygame.quit() +                sys.exit() +                main = False +``` + +Remember, `steps` is a variable representing how many pixels your sprite moves when a key is pressed. If you add 10 pixels to the location of your player sprite when you press D or the right arrow, then when you stop pressing that key you must subtract 10 (`-steps`) to return your sprite's momentum back to 0. + +Try your game now. Warning: it won't do what you expect. + +Why doesn't your sprite move yet? Because the main loop doesn't call the `update` function. + +Add code to your main loop to tell Python to update the position of your player sprite. Add the line with the comment: + +``` +    player.update()  # update player position +    player_list.draw(world) +    pygame.display.flip() +    clock.tick(fps) +``` + +Launch your game again to witness your player sprite move across the screen at your bidding. There's no vertical movement yet because those functions will be controlled by gravity, but that's another lesson for another article. + +In the meantime, if you have access to a joystick, try reading Pygame's documentation for its [joystick][4] module and see if you can make your sprite move that way. Alternately, see if you can get the [mouse][5] to interact with your sprite. + +Most importantly, have fun! + +### All the code used in this tutorial + +For your reference, here is all the code used in this series of articles so far. + +``` +#!/usr/bin/env python3 +# draw a world +# add a player and player control +# add player movement + +# GNU All-Permissive License +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. This file is offered as-is, +# without any warranty. + +import pygame +import sys +import os + +''' +Objects +''' + +class Player(pygame.sprite.Sprite): + ''' + Spawn a player + ''' + def __init__(self): + pygame.sprite.Sprite.__init__(self) + self.movex = 0 + self.movey = 0 + self.frame = 0 + self.images = [] + for i in range(1,5): + img = pygame.image.load(os.path.join('images','hero' + str(i) + '.png')).convert() + img.convert_alpha() + img.set_colorkey(ALPHA) + self.images.append(img) + self.image = self.images[0] + self.rect = self.image.get_rect() + + def control(self,x,y): + ''' + control player movement + ''' + self.movex += x + self.movey += y + + def update(self): + ''' + Update sprite position + ''' + + self.rect.x = self.rect.x + self.movex + self.rect.y = self.rect.y + self.movey + + # moving left + if self.movex < 0: + self.frame += 1 + if self.frame > 3*ani: + self.frame = 0 + self.image = self.images[self.frame//ani] + + # moving right + if self.movex > 0: + self.frame += 1 + if self.frame > 3*ani: + self.frame = 0 + self.image = self.images[(self.frame//ani)+4] + + +''' +Setup +''' +worldx = 960 +worldy = 720 + +fps = 40 # frame rate +ani = 4 # animation cycles +clock = pygame.time.Clock() +pygame.init() +main = True + +BLUE = (25,25,200) +BLACK = (23,23,23 ) +WHITE = (254,254,254) +ALPHA = (0,255,0) + +world = pygame.display.set_mode([worldx,worldy]) +backdrop = pygame.image.load(os.path.join('images','stage.png')).convert() +backdropbox = world.get_rect() +player = Player() # spawn player +player.rect.x = 0 +player.rect.y = 0 +player_list = pygame.sprite.Group() +player_list.add(player) +steps = 10 # how fast to move + +''' +Main loop +''' +while main == True: + for event in pygame.event.get(): + if event.type == pygame.QUIT: + pygame.quit(); sys.exit() + main = False + + if event.type == pygame.KEYDOWN: + if event.key == pygame.K_LEFT or event.key == ord('a'): + player.control(-steps,0) + if event.key == pygame.K_RIGHT or event.key == ord('d'): + player.control(steps,0) + if event.key == pygame.K_UP or event.key == ord('w'): + print('jump') + + if event.type == pygame.KEYUP: + if event.key == pygame.K_LEFT or event.key == ord('a'): + player.control(steps,0) + if event.key == pygame.K_RIGHT or event.key == ord('d'): + player.control(-steps,0) + if event.key == ord('q'): + pygame.quit() + sys.exit() + main = False + +# world.fill(BLACK) + world.blit(backdrop, backdropbox) + player.update() + player_list.draw(world) #refresh player position + pygame.display.flip() + clock.tick(fps) +``` + +You've come far and learned much, but there's a lot more to do. In the next few articles, you'll add enemy sprites, emulated gravity, and lots more. In the mean time, practice with Python! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/17/12/game-python-moving-player + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/17/10/python-101 +[2]: https://opensource.com/article/17/12/program-game-python-part-2-creating-game-world +[3]: https://opensource.com/article/17/12/program-game-python-part-3-spawning-player +[4]: http://pygame.org/docs/ref/joystick.html +[5]: http://pygame.org/docs/ref/mouse.html#module-pygame.mouse From 5438586a1c4eea4ce7851a67b00aa982263e8ff9 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 15:03:53 +0800 Subject: [PATCH 230/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190309=20How=20?= =?UTF-8?q?To=20Fix=20=E2=80=9CNetwork=20Protocol=20Error=E2=80=9D=20On=20?= =?UTF-8?q?Mozilla=20Firefox=20sources/tech/20190309=20How=20To=20Fix=20-N?= =?UTF-8?q?etwork=20Protocol=20Error-=20On=20Mozilla=20Firefox.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...work Protocol Error- On Mozilla Firefox.md | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 sources/tech/20190309 How To Fix -Network Protocol Error- On Mozilla Firefox.md diff --git a/sources/tech/20190309 How To Fix -Network Protocol Error- On Mozilla Firefox.md b/sources/tech/20190309 How To Fix -Network Protocol Error- On Mozilla Firefox.md new file mode 100644 index 0000000000..da752b07ee --- /dev/null +++ b/sources/tech/20190309 How To Fix -Network Protocol Error- On Mozilla Firefox.md @@ -0,0 +1,67 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Fix “Network Protocol Error” On Mozilla Firefox) +[#]: via: (https://www.ostechnix.com/how-to-fix-network-protocol-error-on-mozilla-firefox/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +How To Fix “Network Protocol Error” On Mozilla Firefox +====== +![](https://www.ostechnix.com/wp-content/uploads/2019/03/firefox-logo-1-720x340.png) + +Mozilla Firefox is my default web browser for years. I have been using it for my day to day web activities, such as accessing my mails, browsing favorite websites etc. Today, I experienced a strange error while using Firefox. I tried to share one of our guide on Reddit platform and got the following error message. + +``` +Network Protocol Error + +Firefox has experienced a network protocol violation that cannot be repaired. + +The page you are trying to view cannot be shown because an error in the network protocol was detected. + +Please contact the website owners to inform them of this problem. +``` + +![](https://www.ostechnix.com/wp-content/uploads/2019/03/firefox.png) + +To be honest, I panicked a bit and thought my system might be affected with some kind of malware. LOL! I was wrong! I am using latest Firefox version on my Arch Linux desktop. I opened the same link in Chromium browser. It’s working fine! I guessed it is Firefox related error. After Googling a bit, I fixed this issue as described below. + +This kind of problems occurs mostly because of the **browser’s cache**. If you’ve encountered these kind of errors, such as “Network Protocol Error” or “Corrupted Content Error”, follow any one of these methods. + +**Method 1:** + +To fix “Network Protocol Error” or “Corrupted Content Error”, you need to reload the webpage while bypassing the cache. To do so, Press **Ctrl + F5** or **Ctrl + Shift + R** keys. It will reload the webpage fresh from the server, not from the Firefox cache. Now the web page should work just fine. + +**Method 2:** + +If the method1 doesn’t work, please try this method. + +Go to **Edit - > Preferences**. From the Preferences window, navigate to **Privacy & Security** tab on the left pane. Now clear the Firefox cache by clicking on **“Clear Data”** option. +![](https://www.ostechnix.com/wp-content/uploads/2019/03/firefox-1.png) + +Make sure you have checked both “Cookies and Site Data” and “Cached Web Content” options and click **“Clear”**. + +![](https://www.ostechnix.com/wp-content/uploads/2019/03/firefox-2.png) + +Done! Now the cookies and offline content will be removed. Please note that Firefox may sign you out of the logged-in websites. You can re-login to those websites later. Finally, close the Firefox browser and restart your system. Now the webpage will load without any issues. + +Hope this was useful. More good stuffs to come. Stay tuned! + +Cheers! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-fix-network-protocol-error-on-mozilla-firefox/ + +作者:[SK][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 From 50cfb027028254d295c64cc543a05ef29a0abd1f Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 15:07:05 +0800 Subject: [PATCH 231/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020171214=20Build?= =?UTF-8?q?=20a=20game=20framework=20with=20Python=20using=20the=20module?= =?UTF-8?q?=20Pygame=20sources/tech/20171214=20Build=20a=20game=20framewor?= =?UTF-8?q?k=20with=20Python=20using=20the=20module=20Pygame.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ork with Python using the module Pygame.md | 283 ++++++++++++++++++ 1 file changed, 283 insertions(+) create mode 100644 sources/tech/20171214 Build a game framework with Python using the module Pygame.md diff --git a/sources/tech/20171214 Build a game framework with Python using the module Pygame.md b/sources/tech/20171214 Build a game framework with Python using the module Pygame.md new file mode 100644 index 0000000000..704c74e042 --- /dev/null +++ b/sources/tech/20171214 Build a game framework with Python using the module Pygame.md @@ -0,0 +1,283 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Build a game framework with Python using the module Pygame) +[#]: via: (https://opensource.com/article/17/12/game-framework-python) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Build a game framework with Python using the module Pygame +====== +The first part of this series explored Python by creating a simple dice game. Now it's time to make your own game from scratch. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python2-header.png?itok=tEvOVo4A) + +In my [first article in this series][1], I explained how to use Python to create a simple, text-based dice game. This time, I'll demonstrate how to use the Python module Pygame to create a graphical game. It will take several articles to get a game that actually does anything, but by the end of the series, you will have a better understanding of how to find and learn new Python modules and how to build an application from the ground up. + +Before you start, you must install [Pygame][2]. + +### Installing new Python modules + +There are several ways to install Python modules, but the two most common are: + + * From your distribution's software repository + * Using the Python package manager, pip + + + +Both methods work well, and each has its own set of advantages. If you're developing on Linux or BSD, leveraging your distribution's software repository ensures automated and timely updates. + +However, using Python's built-in package manager gives you control over when modules are updated. Also, it is not OS-specific, meaning you can use it even when you're not on your usual development machine. Another advantage of pip is that it allows local installs of modules, which is helpful if you don't have administrative rights to a computer you're using. + +### Using pip + +If you have both Python and Python3 installed on your system, the command you want to use is probably `pip3`, which differentiates it from Python 2.x's `pip` command. If you're unsure, try `pip3` first. + +The `pip` command works a lot like most Linux package managers. You can search for Python modules with `search`, then install them with `install`. If you don't have permission to install software on the computer you're using, you can use the `--user` option to just install the module into your home directory. + +``` +$ pip3 search pygame +[...] +Pygame (1.9.3)                 - Python Game Development +sge-pygame (1.5)               - A 2-D game engine for Python +pygame_camera (0.1.1)          - A Camera lib for PyGame +pygame_cffi (0.2.1)            - A cffi-based SDL wrapper that copies the pygame API. +[...] +$ pip3 install Pygame --user +``` + +Pygame is a Python module, which means that it's just a set of libraries that can be used in your Python programs. In other words, it's not a program that you launch, like [IDLE][3] or [Ninja-IDE][4] are. + +### Getting started with Pygame + +A video game needs a setting; a world in which it takes place. In Python, there are two different ways to create your setting: + + * Set a background color + * Set a background image + + + +Your background is only an image or a color. Your video game characters can't interact with things in the background, so don't put anything too important back there. It's just set dressing. + +### Setting up your Pygame script + +To start a new Pygame project, create a folder on your computer. All your game files go into this directory. It's vitally important that you keep all the files needed to run your game inside of your project folder. + +![](https://opensource.com/sites/default/files/u128651/project.jpg) + +A Python script starts with the file type, your name, and the license you want to use. Use an open source license so your friends can improve your game and share their changes with you: + +``` +#!/usr/bin/env python3 +# by Seth Kenlon + +## GPLv3 +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program.  If not, see . +``` + +Then you tell Python what modules you want to use. Some of the modules are common Python libraries, and of course, you want to include the one you just installed, Pygame. + +``` +import pygame  # load pygame keywords +import sys     # let  python use your file system +import os      # help python identify your OS +``` + +Since you'll be working a lot with this script file, it helps to make sections within the file so you know where to put stuff. You do this with block comments, which are comments that are visible only when looking at your source code. Create three blocks in your code. + +``` +''' +Objects +''' + +# put Python classes and functions here + +''' +Setup +''' + +# put run-once code here + +''' +Main Loop +''' + +# put game loop here +``` + +Next, set the window size for your game. Keep in mind that not everyone has a big computer screen, so it's best to use a screen size that fits on most people's computers. + +There is a way to toggle full-screen mode, the way many modern video games do, but since you're just starting out, keep it simple and just set one size. + +``` +''' +Setup +''' +worldx = 960 +worldy = 720 +``` + +The Pygame engine requires some basic setup before you can use it in a script. You must set the frame rate, start its internal clock, and start (`init`) Pygame. + +``` +fps   = 40  # frame rate +ani   = 4   # animation cycles +clock = pygame.time.Clock() +pygame.init() +``` + +Now you can set your background. + +### Setting the background + +Before you continue, open a graphics application and create a background for your game world. Save it as `stage.png` inside a folder called `images` in your project directory. + +There are several free graphics applications you can use. + + * [Krita][5] is a professional-level paint materials emulator that can be used to create beautiful images. If you're very interested in creating art for video games, you can even purchase a series of online [game art tutorials][6]. + * [Pinta][7] is a basic, easy to learn paint application. + * [Inkscape][8] is a vector graphics application. Use it to draw with shapes, lines, splines, and Bézier curves. + + + +Your graphic doesn't have to be complex, and you can always go back and change it later. Once you have it, add this code in the setup section of your file: + +``` +world    = pygame.display.set_mode([worldx,worldy]) +backdrop = pygame.image.load(os.path.join('images','stage.png').convert()) +backdropbox = world.get_rect() +``` + +If you're just going to fill the background of your game world with a color, all you need is: + +``` +world = pygame.display.set_mode([worldx,worldy]) +``` + +You also must define a color to use. In your setup section, create some color definitions using values for red, green, and blue (RGB). + +``` +''' +Setup +''' + +BLUE  = (25,25,200) +BLACK = (23,23,23 ) +WHITE = (254,254,254) +``` + +At this point, you could theoretically start your game. The problem is, it would only last for a millisecond. + +To prove this, save your file as `your-name_game.py` (replace `your-name` with your actual name). Then launch your game. + +If you are using IDLE, run your game by selecting `Run Module` from the Run menu. + +If you are using Ninja, click the `Run file` button in the left button bar. + +![](https://opensource.com/sites/default/files/u128651/ninja_run_0.png) + +You can also run a Python script straight from a Unix terminal or a Windows command prompt. + +``` +$ python3 ./your-name_game.py +``` + +If you're using Windows, use this command: + +``` +py.exe your-name_game.py +``` + +However you launch it, don't expect much, because your game only lasts a few milliseconds right now. You can fix that in the next section. + +### Looping + +Unless told otherwise, a Python script runs once and only once. Computers are very fast these days, so your Python script runs in less than a second. + +To force your game to stay open and active long enough for someone to see it (let alone play it), use a `while` loop. To make your game remain open, you can set a variable to some value, then tell a `while` loop to keep looping for as long as the variable remains unchanged. + +This is often called a "main loop," and you can use the term `main` as your variable. Add this anywhere in your setup section: + +``` +main = True +``` + +During the main loop, use Pygame keywords to detect if keys on the keyboard have been pressed or released. Add this to your main loop section: + +``` +''' +Main loop +''' +while main == True: +    for event in pygame.event.get(): +        if event.type == pygame.QUIT: +            pygame.quit(); sys.exit() +            main = False + +        if event.type == pygame.KEYDOWN: +            if event.key == ord('q'): +                pygame.quit() +                sys.exit() +                main = False +``` + +Also in your main loop, refresh your world's background. + +If you are using an image for the background: + +``` +world.blit(backdrop, backdropbox) +``` + +If you are using a color for the background: + +``` +world.fill(BLUE) +``` + +Finally, tell Pygame to refresh everything on the screen and advance the game's internal clock. + +``` +    pygame.display.flip() +    clock.tick(fps) +``` + +Save your file, and run it again to see the most boring game ever created. + +To quit the game, press `q` on your keyboard. + +In the [next article][9] of this series, I'll show you how to add to your currently empty game world, so go ahead and start creating some graphics to use! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/17/12/game-framework-python + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/17/10/python-101 +[2]: http://www.pygame.org/wiki/about +[3]: https://en.wikipedia.org/wiki/IDLE +[4]: http://ninja-ide.org/ +[5]: http://krita.org +[6]: https://gumroad.com/l/krita-game-art-tutorial-1 +[7]: https://pinta-project.com/pintaproject/pinta/releases +[8]: http://inkscape.org +[9]: https://opensource.com/article/17/12/program-game-python-part-3-spawning-player From 610d5d8d96df15065646ccb3cfa88f1389a6db4a Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 15:10:15 +0800 Subject: [PATCH 232/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020171215=20How=20?= =?UTF-8?q?to=20add=20a=20player=20to=20your=20Python=20game=20sources/tec?= =?UTF-8?q?h/20171215=20How=20to=20add=20a=20player=20to=20your=20Python?= =?UTF-8?q?=20game.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...How to add a player to your Python game.md | 162 ++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 sources/tech/20171215 How to add a player to your Python game.md diff --git a/sources/tech/20171215 How to add a player to your Python game.md b/sources/tech/20171215 How to add a player to your Python game.md new file mode 100644 index 0000000000..caa1e4754e --- /dev/null +++ b/sources/tech/20171215 How to add a player to your Python game.md @@ -0,0 +1,162 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to add a player to your Python game) +[#]: via: (https://opensource.com/article/17/12/game-python-add-a-player) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +How to add a player to your Python game +====== +Part three of a series on building a game from scratch with Python. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python3-game.png?itok=jG9UdwC3) + +In the [first article of this series][1], I explained how to use Python to create a simple, text-based dice game. In the second part, I showed you how to build a game from scratch, starting with [creating the game's environment][2]. But every game needs a player, and every player needs a playable character, so that's what we'll do next in the third part of the series. + +In Pygame, the icon or avatar that a player controls is called a sprite. If you don't have any graphics to use for a player sprite yet, create something for yourself using [Krita][3] or [Inkscape][4]. If you lack confidence in your artistic skills, you can also search [OpenClipArt.org][5] or [OpenGameArt.org][6] for something pre-generated. Then, if you didn't already do so in the previous article, create a directory called `images` alongside your Python project directory. Put the images you want to use in your game into the `images` folder. + +To make your game truly exciting, you ought to use an animated sprite for your hero. It means you have to draw more assets, but it makes a big difference. The most common animation is a walk cycle, a series of drawings that make it look like your sprite is walking. The quick and dirty version of a walk cycle requires four drawings. + +![](https://opensource.com/sites/default/files/u128651/walk-cycle-poses.jpg) + +Note: The code samples in this article allow for both a static player sprite and an animated one. + +Name your player sprite `hero.png`. If you're creating an animated sprite, append a digit after the name, starting with `hero1.png`. + +### Create a Python class + +In Python, when you create an object that you want to appear on screen, you create a class. + +Near the top of your Python script, add the code to create a player. In the code sample below, the first three lines are already in the Python script that you're working on: + +``` +import pygame +import sys +import os # new code below + +class Player(pygame.sprite.Sprite): +    ''' +    Spawn a player +    ''' +    def __init__(self): +        pygame.sprite.Sprite.__init__(self) +        self.images = [] +    img = pygame.image.load(os.path.join('images','hero.png')).convert() +    self.images.append(img) +    self.image = self.images[0] +    self.rect  = self.image.get_rect() +``` + +If you have a walk cycle for your playable character, save each drawing as an individual file called `hero1.png` to `hero4.png` in the `images` folder. + +Use a loop to tell Python to cycle through each file. + +``` +''' +Objects +''' + +class Player(pygame.sprite.Sprite): +    ''' +    Spawn a player +    ''' +    def __init__(self): +        pygame.sprite.Sprite.__init__(self) +        self.images = [] +        for i in range(1,5): +            img = pygame.image.load(os.path.join('images','hero' + str(i) + '.png')).convert() +            self.images.append(img) +            self.image = self.images[0] +            self.rect  = self.image.get_rect() +``` + +### Bring the player into the game world + +Now that a Player class exists, you must use it to spawn a player sprite in your game world. If you never call on the Player class, it never runs, and there will be no player. You can test this out by running your game now. The game will run just as well as it did at the end of the previous article, with the exact same results: an empty game world. + +To bring a player sprite into your world, you must call the Player class to generate a sprite and then add it to a Pygame sprite group. In this code sample, the first three lines are existing code, so add the lines afterwards: + +``` +world       = pygame.display.set_mode([worldx,worldy]) +backdrop    = pygame.image.load(os.path.join('images','stage.png')).convert() +backdropbox = screen.get_rect() + +# new code below + +player = Player()   # spawn player +player.rect.x = 0   # go to x +player.rect.y = 0   # go to y +player_list = pygame.sprite.Group() +player_list.add(player) +``` + +Try launching your game to see what happens. Warning: it won't do what you expect. When you launch your project, the player sprite doesn't spawn. Actually, it spawns, but only for a millisecond. How do you fix something that only happens for a millisecond? You might recall from the previous article that you need to add something to the main loop. To make the player spawn for longer than a millisecond, tell Python to draw it once per loop. + +Change the bottom clause of your loop to look like this: + +``` +    world.blit(backdrop, backdropbox) +    player_list.draw(screen) # draw player +    pygame.display.flip() +    clock.tick(fps) +``` + +Launch your game now. Your player spawns! + +### Setting the alpha channel + +Depending on how you created your player sprite, it may have a colored block around it. What you are seeing is the space that ought to be occupied by an alpha channel. It's meant to be the "color" of invisibility, but Python doesn't know to make it invisible yet. What you are seeing, then, is the space within the bounding box (or "hit box," in modern gaming terms) around the sprite. + +![](https://opensource.com/sites/default/files/u128651/greenscreen.jpg) + +You can tell Python what color to make invisible by setting an alpha channel and using RGB values. If you don't know the RGB values your drawing uses as alpha, open your drawing in Krita or Inkscape and fill the empty space around your drawing with a unique color, like #00ff00 (more or less a "greenscreen green"). Take note of the color's hex value (#00ff00, for greenscreen green) and use that in your Python script as the alpha channel. + +Using alpha requires the addition of two lines in your Sprite creation code. Some version of the first line is already in your code. Add the other two lines: + +``` +            img = pygame.image.load(os.path.join('images','hero' + str(i) + '.png')).convert() +            img.convert_alpha()     # optimise alpha +            img.set_colorkey(ALPHA) # set alpha +``` + +Python doesn't know what to use as alpha unless you tell it. In the setup area of your code, add some more color definitions. Add this variable definition anywhere in your setup section: + +``` +ALPHA = (0, 255, 0) +``` + +In this example code, **0,255,0** is used, which is the same value in RGB as #00ff00 is in hex. You can get all of these color values from a good graphics application like [GIMP][7], Krita, or Inkscape. Alternately, you can also detect color values with a good system-wide color chooser, like [KColorChooser][8]. + +![](https://opensource.com/sites/default/files/u128651/kcolor.png) + +If your graphics application is rendering your sprite's background as some other value, adjust the values of your alpha variable as needed. No matter what you set your alpha value, it will be made "invisible." RGB values are very strict, so if you need to use 000 for alpha, but you need 000 for the black lines of your drawing, just change the lines of your drawing to 111, which is close enough to black that nobody but a computer can tell the difference. + +Launch your game to see the results. + +![](https://opensource.com/sites/default/files/u128651/alpha.jpg) + +In the [fourth part of this series][9], I'll show you how to make your sprite move. How exciting! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/17/12/game-python-add-a-player + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/17/10/python-101 +[2]: https://opensource.com/article/17/12/program-game-python-part-2-creating-game-world +[3]: http://krita.org +[4]: http://inkscape.org +[5]: http://openclipart.org +[6]: https://opengameart.org/ +[7]: http://gimp.org +[8]: https://github.com/KDE/kcolorchooser +[9]: https://opensource.com/article/17/12/program-game-python-part-4-moving-your-sprite From 0d2a82f4592029f7141490f2c1a72adc4175e9b9 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 15:16:15 +0800 Subject: [PATCH 233/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020180725=20Put=20?= =?UTF-8?q?platforms=20in=20a=20Python=20game=20with=20Pygame=20sources/te?= =?UTF-8?q?ch/20180725=20Put=20platforms=20in=20a=20Python=20game=20with?= =?UTF-8?q?=20Pygame.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... platforms in a Python game with Pygame.md | 590 ++++++++++++++++++ 1 file changed, 590 insertions(+) create mode 100644 sources/tech/20180725 Put platforms in a Python game with Pygame.md diff --git a/sources/tech/20180725 Put platforms in a Python game with Pygame.md b/sources/tech/20180725 Put platforms in a Python game with Pygame.md new file mode 100644 index 0000000000..759bfc01df --- /dev/null +++ b/sources/tech/20180725 Put platforms in a Python game with Pygame.md @@ -0,0 +1,590 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Put platforms in a Python game with Pygame) +[#]: via: (https://opensource.com/article/18/7/put-platforms-python-game) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Put platforms in a Python game with Pygame +====== +In part six of this series on building a Python game from scratch, create some platforms for your characters to travel. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/header.png?itok=iq8HFoEJ) + +This is part 6 in an ongoing series about creating video games in Python 3 using the Pygame module. Previous articles are: + ++ [Learn how to program in Python by building a simple dice game][24] ++ [Build a game framework with Python using the Pygame module][25] ++ [How to add a player to your Python game][26] ++ [Using Pygame to move your game character around][27] ++ [What's a hero without a villain? How to add one to your Python game][28] + + +A platformer game needs platforms. + +In [Pygame][1], the platforms themselves are sprites, just like your playable sprite. That's important because having platforms that are objects makes it a lot easier for your player sprite to interact with them. + +There are two major steps in creating platforms. First, you must code the objects, and then you must map out where you want the objects to appear. + +### Coding platform objects + +To build a platform object, you create a class called `Platform`. It's a sprite, just like your [`Player`][2] [sprite][2], with many of the same properties. + +Your `Platform` class needs to know a lot of information about what kind of platform you want, where it should appear in the game world, and what image it should contain. A lot of that information might not even exist yet, depending on how much you have planned out your game, but that's all right. Just as you didn't tell your Player sprite how fast to move until the end of the [Movement article][3], you don't have to tell `Platform` everything upfront. + +Near the top of the script you've been writing in this series, create a new class. The first three lines in this code sample are for context, so add the code below the comment: + +``` +import pygame +import sys +import os +## new code below: + +class Platform(pygame.sprite.Sprite): +# x location, y location, img width, img height, img file     +def __init__(self,xloc,yloc,imgw,imgh,img): +    pygame.sprite.Sprite.__init__(self) +    self.image = pygame.image.load(os.path.join('images',img)).convert() +    self.image.convert_alpha() +    self.image.set_colorkey(ALPHA) +    self.rect = self.image.get_rect() +    self.rect.y = yloc +    self.rect.x = xloc +``` + +When called, this class creates an object onscreen in some X and Y location, with some width and height, using some image file for texture. It's very similar to how players or enemies are drawn onscreen. + +### Types of platforms + +The next step is to map out where all your platforms need to appear. + +#### The tile method + +There are a few different ways to implement a platform game world. In the original side-scroller games, such as Mario Super Bros. and Sonic the Hedgehog, the technique was to use "tiles," meaning that there were a few blocks to represent the ground and various platforms, and these blocks were used and reused to make a level. You have only eight or 12 different kinds of blocks, and you line them up onscreen to create the ground, floating platforms, and whatever else your game needs. Some people find this the easier way to make a game since you just have to make (or download) a small set of level assets to create many different levels. The code, however, requires a little more math. + +![Supertux, a tile-based video game][5] + +[SuperTux][6], a tile-based video game. + +#### The hand-painted method + +Another method is to make each and every asset as one whole image. If you enjoy creating assets for your game world, this is a great excuse to spend time in a graphics application, building each and every part of your game world. This method requires less math, because all the platforms are whole, complete objects, and you tell [Python][7] where to place them onscreen. + +Each method has advantages and disadvantages, and the code you must use is slightly different depending on the method you choose. I'll cover both so you can use one or the other, or even a mix of both, in your project. + +### Level mapping + +Mapping out your game world is a vital part of level design and game programming in general. It does involve math, but nothing too difficult, and Python is good at math so it can help some. + +You might find it helpful to design on paper first. Get a sheet of paper and draw a box to represent your game window. Draw platforms in the box, labeling each with its X and Y coordinates, as well as its intended width and height. The actual positions in the box don't have to be exact, as long as you keep the numbers realistic. For instance, if your screen is 720 pixels wide, then you can't fit eight platforms at 100 pixels each all on one screen. + +Of course, not all platforms in your game have to fit in one screen-sized box, because your game will scroll as your player walks through it. So keep drawing your game world to the right of the first screen until the end of the level. + +If you prefer a little more precision, you can use graph paper. This is especially helpful when designing a game with tiles because each grid square can represent one tile. + +![Example of a level map][9] + +Example of a level map. + +#### Coordinates + +You may have learned in school about the [Cartesian coordinate system][10]. What you learned applies to Pygame, except that in Pygame, your game world's coordinates place `0,0` in the top-left corner of your screen instead of in the middle, which is probably what you're used to from Geometry class. + +![Example of coordinates in Pygame][12] + +Example of coordinates in Pygame. + +The X axis starts at 0 on the far left and increases infinitely to the right. The Y axis starts at 0 at the top of the screen and extends down. + +#### Image sizes + +Mapping out a game world is meaningless if you don't know how big your players, enemies, and platforms are. You can find the dimensions of your platforms or tiles in a graphics program. In [Krita][13], for example, click on the **Image** menu and select **Properties**. You can find the dimensions at the very top of the **Properties** window. + +Alternately, you can create a simple Python script to tell you the dimensions of an image. Open a new text file and type this code into it: + +``` +#!/usr/bin/env python3 + +from PIL import Image +import os.path +import sys + +if len(sys.argv) > 1: +    print(sys.argv[1]) +else: +    sys.exit('Syntax: identify.py [filename]') + +pic = sys.argv[1] +dim = Image.open(pic) +X   = dim.size[0] +Y   = dim.size[1] + +print(X,Y) +``` + +Save the text file as `identify.py`. + +To set up this script, you must install an extra set of Python modules that contain the new keywords used in the script: + +``` +$ pip3 install Pillow --user +``` + +Once that is installed, run your script from within your game project directory: + +``` +$ python3 ./identify.py images/ground.png +(1080, 97) +``` + +The image size of the ground platform in this example is 1080 pixels wide and 97 high. + +### Platform blocks + +If you choose to draw each asset individually, you must create several platforms and any other elements you want to insert into your game world, each within its own file. In other words, you should have one file per asset, like this: + +![One image file per object][15] + +One image file per object. + +You can reuse each platform as many times as you want, just make sure that each file only contains one platform. You cannot use a file that contains everything, like this: + +![Your level cannot be one image file][17] + +Your level cannot be one image file. + +You might want your game to look like that when you've finished, but if you create your level in one big file, there is no way to distinguish a platform from the background, so either paint your objects in their own file or crop them from a large file and save individual copies. + +**Note:** As with your other assets, you can use [GIMP][18], Krita, [MyPaint][19], or [Inkscape][20] to create your game assets. + +Platforms appear on the screen at the start of each level, so you must add a `platform` function in your `Level` class. The special case here is the ground platform, which is important enough to be treated as its own platform group. By treating the ground as its own special kind of platform, you can choose whether it scrolls or whether it stands still while other platforms float over the top of it. It's up to you. + +Add these two functions to your `Level` class: + +``` +def ground(lvl,x,y,w,h): +    ground_list = pygame.sprite.Group() +    if lvl == 1: +        ground = Platform(x,y,w,h,'block-ground.png') +        ground_list.add(ground) + +    if lvl == 2: +        print("Level " + str(lvl) ) + +    return ground_list + +def platform( lvl ): +    plat_list = pygame.sprite.Group() +    if lvl == 1: +        plat = Platform(200, worldy-97-128, 285,67,'block-big.png') +        plat_list.add(plat) +        plat = Platform(500, worldy-97-320, 197,54,'block-small.png') +        plat_list.add(plat) +    if lvl == 2: +        print("Level " + str(lvl) ) +        +    return plat_list +``` + +The `ground` function requires an X and Y location so Pygame knows where to place the ground platform. It also requires the width and height of the platform so Pygame knows how far the ground extends in each direction. The function uses your `Platform` class to generate an object onscreen, and then adds that object to the `ground_list` group. + +The `platform` function is essentially the same, except that there are more platforms to list. In this example, there are only two, but you can have as many as you like. After entering one platform, you must add it to the `plat_list` before listing another. If you don't add a platform to the group, then it won't appear in your game. + +> **Tip:** It can be difficult to think of your game world with 0 at the top, since the opposite is what happens in the real world; when figuring out how tall you are, you don't measure yourself from the sky down, you measure yourself from your feet to the top of your head. +> +> If it's easier for you to build your game world from the "ground" up, it might help to express Y-axis values as negatives. For instance, you know that the bottom of your game world is the value of `worldy`. So `worldy` minus the height of the ground (97, in this example) is where your player is normally standing. If your character is 64 pixels tall, then the ground minus 128 is exactly twice as tall as your player. Effectively, a platform placed at 128 pixels is about two stories tall, relative to your player. A platform at -320 is three more stories. And so on. + +As you probably know by now, none of your classes and functions are worth much if you don't use them. Add this code to your setup section (the first line is just for context, so add the last two lines): + +``` +enemy_list  = Level.bad( 1, eloc ) +ground_list = Level.ground( 1,0,worldy-97,1080,97 ) +plat_list   = Level.platform( 1 ) +``` + +And add these lines to your main loop (again, the first line is just for context): + +``` +enemy_list.draw(world)  # refresh enemies +ground_list.draw(world)  # refresh ground +plat_list.draw(world)  # refresh platforms +``` + +### Tiled platforms + +Tiled game worlds are considered easier to make because you just have to draw a few blocks upfront and can use them over and over to create every platform in the game. There are even sets of tiles for you to use on sites like [OpenGameArt.org][21]. + +The `Platform` class is the same as the one provided in the previous sections. + +The `ground` and `platform` in the `Level` class, however, must use loops to calculate how many blocks to use to create each platform. + +If you intend to have one solid ground in your game world, the ground is simple. You just "clone" your ground tile across the whole window. For instance, you could create a list of X and Y values to dictate where each tile should be placed, and then use a loop to take each value and draw one tile. This is just an example, so don't add this to your code: + +``` +# Do not add this to your code +gloc = [0,656,64,656,128,656,192,656,256,656,320,656,384,656] +``` + +If you look carefully, though, you can see all the Y values are always the same, and the X values increase steadily in increments of 64, which is the size of the tiles. That kind of repetition is exactly what computers are good at, so you can use a little bit of math logic to have the computer do all the calculations for you: + +Add this to the setup part of your script: + +``` +gloc = [] +tx   = 64 +ty   = 64 + +i=0 +while i <= (worldx/tx)+tx: +    gloc.append(i*tx) +    i=i+1 + +ground_list = Level.ground( 1,gloc,tx,ty ) +``` + +Now, regardless of the size of your window, Python divides the width of the game world by the width of the tile and creates an array listing each X value. This doesn't calculate the Y value, but that never changes on flat ground anyway. + +To use the array in a function, use a `while` loop that looks at each entry and adds a ground tile at the appropriate location: + +``` +def ground(lvl,gloc,tx,ty): +    ground_list = pygame.sprite.Group() +    i=0 +    if lvl == 1: +        while i < len(gloc): +            ground = Platform(gloc[i],worldy-ty,tx,ty,'tile-ground.png') +            ground_list.add(ground) +            i=i+1 + +    if lvl == 2: +        print("Level " + str(lvl) ) + +    return ground_list +``` + +This is nearly the same code as the `ground` function for the block-style platformer, provided in a previous section above, aside from the `while` loop. + +For moving platforms, the principle is similar, but there are some tricks you can use to make your life easier. + +Rather than mapping every platform by pixels, you can define a platform by its starting pixel (its X value), the height from the ground (its Y value), and how many tiles to draw. That way, you don't have to worry about the width and height of every platform. + +The logic for this trick is a little more complex, so copy this code carefully. There is a `while` loop inside of another `while` loop because this function must look at all three values within each array entry to successfully construct a full platform. In this example, there are only three platforms defined as `ploc.append` statements, but your game probably needs more, so define as many as you need. Of course, some won't appear yet because they're far offscreen, but they'll come into view once you implement scrolling. + +``` +def platform(lvl,tx,ty): +    plat_list = pygame.sprite.Group() +    ploc = [] +    i=0 +    if lvl == 1: +        ploc.append((200,worldy-ty-128,3)) +        ploc.append((300,worldy-ty-256,3)) +        ploc.append((500,worldy-ty-128,4)) +        while i < len(ploc): +            j=0 +            while j <= ploc[i][2]: +                plat = Platform((ploc[i][0]+(j*tx)),ploc[i][1],tx,ty,'tile.png') +                plat_list.add(plat) +                j=j+1 +            print('run' + str(i) + str(ploc[i])) +            i=i+1 +            +    if lvl == 2: +        print("Level " + str(lvl) ) + +    return plat_list +``` + +To get the platforms to appear in your game world, they must be in your main loop. If you haven't already done so, add these lines to your main loop (again, the first line is just for context): + +``` +        enemy_list.draw(world)  # refresh enemies +        ground_list.draw(world) # refresh ground +        plat_list.draw(world)   # refresh platforms +``` + +Launch your game, and adjust the placement of your platforms as needed. Don't worry that you can't see the platforms that are spawned offscreen; you'll fix that soon. + +Here is the game so far in a picture and in code: + +![Pygame game][23] + +Our Pygame platformer so far. + +``` +    #!/usr/bin/env python3 +# draw a world +# add a player and player control +# add player movement +# add enemy and basic collision +# add platform + +# GNU All-Permissive License +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved.  This file is offered as-is, +# without any warranty. + +import pygame +import sys +import os + +''' +Objects +''' + +class Platform(pygame.sprite.Sprite): +    # x location, y location, img width, img height, img file     +    def __init__(self,xloc,yloc,imgw,imgh,img): +        pygame.sprite.Sprite.__init__(self) +        self.image = pygame.image.load(os.path.join('images',img)).convert() +        self.image.convert_alpha() +        self.rect = self.image.get_rect() +        self.rect.y = yloc +        self.rect.x = xloc + +class Player(pygame.sprite.Sprite): +    ''' +    Spawn a player +    ''' +    def __init__(self): +        pygame.sprite.Sprite.__init__(self) +        self.movex = 0 +        self.movey = 0 +        self.frame = 0 +        self.health = 10 +        self.score = 1 +        self.images = [] +        for i in range(1,9): +            img = pygame.image.load(os.path.join('images','hero' + str(i) + '.png')).convert() +            img.convert_alpha() +            img.set_colorkey(ALPHA) +            self.images.append(img) +            self.image = self.images[0] +            self.rect  = self.image.get_rect() + +    def control(self,x,y): +        ''' +        control player movement +        ''' +        self.movex += x +        self.movey += y + +    def update(self): +        ''' +        Update sprite position +        ''' + +        self.rect.x = self.rect.x + self.movex +        self.rect.y = self.rect.y + self.movey + +        # moving left +        if self.movex < 0: +            self.frame += 1 +            if self.frame > ani*3: +                self.frame = 0 +            self.image = self.images[self.frame//ani] + +        # moving right +        if self.movex > 0: +            self.frame += 1 +            if self.frame > ani*3: +                self.frame = 0 +            self.image = self.images[(self.frame//ani)+4] + +        # collisions +        enemy_hit_list = pygame.sprite.spritecollide(self, enemy_list, False) +        for enemy in enemy_hit_list: +            self.health -= 1 +            print(self.health) + +        ground_hit_list = pygame.sprite.spritecollide(self, ground_list, False) +        for g in ground_hit_list: +            self.health -= 1 +            print(self.health) + + +class Enemy(pygame.sprite.Sprite): +    ''' +    Spawn an enemy +    ''' +    def __init__(self,x,y,img): +        pygame.sprite.Sprite.__init__(self) +        self.image = pygame.image.load(os.path.join('images',img)) +        #self.image.convert_alpha() +        #self.image.set_colorkey(ALPHA) +        self.rect = self.image.get_rect() +        self.rect.x = x +        self.rect.y = y +        self.counter = 0 + +    def move(self): +        ''' +        enemy movement +        ''' +        distance = 80 +        speed = 8 + +        if self.counter >= 0 and self.counter <= distance: +            self.rect.x += speed +        elif self.counter >= distance and self.counter <= distance*2: +            self.rect.x -= speed +        else: +            self.counter = 0 + +        self.counter += 1 + +class Level(): +    def bad(lvl,eloc): +        if lvl == 1: +            enemy = Enemy(eloc[0],eloc[1],'yeti.png') # spawn enemy +            enemy_list = pygame.sprite.Group() # create enemy group +            enemy_list.add(enemy)              # add enemy to group + +        if lvl == 2: +            print("Level " + str(lvl) ) + +        return enemy_list + +    def loot(lvl,lloc): +        print(lvl) + +    def ground(lvl,gloc,tx,ty): +        ground_list = pygame.sprite.Group() +        i=0 +        if lvl == 1: +            while i < len(gloc): +                print("blockgen:" + str(i)) +                ground = Platform(gloc[i],worldy-ty,tx,ty,'ground.png') +                ground_list.add(ground) +                i=i+1 + +        if lvl == 2: +            print("Level " + str(lvl) ) + +        return ground_list + +''' +Setup +''' +worldx = 960 +worldy = 720 + +fps = 40 # frame rate +ani = 4  # animation cycles +clock = pygame.time.Clock() +pygame.init() +main = True + +BLUE  = (25,25,200) +BLACK = (23,23,23 ) +WHITE = (254,254,254) +ALPHA = (0,255,0) + +world = pygame.display.set_mode([worldx,worldy]) +backdrop = pygame.image.load(os.path.join('images','stage.png')).convert() +backdropbox = world.get_rect() +player = Player() # spawn player +player.rect.x = 0 +player.rect.y = 0 +player_list = pygame.sprite.Group() +player_list.add(player) +steps = 10 # how fast to move + +eloc = [] +eloc = [200,20] +gloc = [] +#gloc = [0,630,64,630,128,630,192,630,256,630,320,630,384,630] +tx = 64 #tile size +ty = 64 #tile size + +i=0 +while i <= (worldx/tx)+tx: +    gloc.append(i*tx) +    i=i+1 +    print("block: " + str(i)) + +enemy_list = Level.bad( 1, eloc ) +ground_list = Level.ground( 1,gloc,tx,ty ) + +''' +Main loop +''' +while main == True: +    for event in pygame.event.get(): +        if event.type == pygame.QUIT: +            pygame.quit(); sys.exit() +            main = False + +        if event.type == pygame.KEYDOWN: +            if event.key == pygame.K_LEFT or event.key == ord('a'): +                player.control(-steps,0) +            if event.key == pygame.K_RIGHT or event.key == ord('d'): +                player.control(steps,0) +            if event.key == pygame.K_UP or event.key == ord('w'): +                print('jump') + +        if event.type == pygame.KEYUP: +            if event.key == pygame.K_LEFT or event.key == ord('a'): +                player.control(steps,0) +            if event.key == pygame.K_RIGHT or event.key == ord('d'): +                player.control(-steps,0) +            if event.key == ord('q'): +                pygame.quit() +                sys.exit() +                main = False + +#    world.fill(BLACK) +    world.blit(backdrop, backdropbox) +    player.update() +    player_list.draw(world) #refresh player position +    enemy_list.draw(world)  # refresh enemies +    ground_list.draw(world)  # refresh enemies +    for e in enemy_list: +        e.move() +    pygame.display.flip() +    clock.tick(fps) +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/7/put-platforms-python-game + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://www.pygame.org/news +[2]: https://opensource.com/article/17/12/game-python-add-a-player +[3]: https://opensource.com/article/17/12/game-python-moving-player +[4]: /file/403841 +[5]: https://opensource.com/sites/default/files/uploads/supertux.png (Supertux, a tile-based video game) +[6]: https://www.supertux.org/ +[7]: https://www.python.org/ +[8]: /file/403861 +[9]: https://opensource.com/sites/default/files/uploads/layout.png (Example of a level map) +[10]: https://en.wikipedia.org/wiki/Cartesian_coordinate_system +[11]: /file/403871 +[12]: https://opensource.com/sites/default/files/uploads/pygame_coordinates.png (Example of coordinates in Pygame) +[13]: https://krita.org/en/ +[14]: /file/403876 +[15]: https://opensource.com/sites/default/files/uploads/pygame_floating.png (One image file per object) +[16]: /file/403881 +[17]: https://opensource.com/sites/default/files/uploads/pygame_flattened.png (Your level cannot be one image file) +[18]: https://www.gimp.org/ +[19]: http://mypaint.org/about/ +[20]: https://inkscape.org/en/ +[21]: https://opengameart.org/content/simplified-platformer-pack +[22]: /file/403886 +[23]: https://opensource.com/sites/default/files/uploads/pygame_platforms.jpg (Pygame game) +[24]: Learn how to program in Python by building a simple dice game +[25]: https://opensource.com/article/17/12/game-framework-python +[26]: https://opensource.com/article/17/12/game-python-add-a-player +[27]: https://opensource.com/article/17/12/game-python-moving-player +[28]: https://opensource.com/article/18/5/pygame-enemy + From 27416f498bc734b31ac8063ee381203e47a25c13 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 15:22:22 +0800 Subject: [PATCH 234/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190306=20Gettin?= =?UTF-8?q?g=20started=20with=20the=20Geany=20text=20editor=20sources/tech?= =?UTF-8?q?/20190306=20Getting=20started=20with=20the=20Geany=20text=20edi?= =?UTF-8?q?tor.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ting started with the Geany text editor.md | 141 ++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 sources/tech/20190306 Getting started with the Geany text editor.md diff --git a/sources/tech/20190306 Getting started with the Geany text editor.md b/sources/tech/20190306 Getting started with the Geany text editor.md new file mode 100644 index 0000000000..7da5f95686 --- /dev/null +++ b/sources/tech/20190306 Getting started with the Geany text editor.md @@ -0,0 +1,141 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with the Geany text editor) +[#]: via: (https://opensource.com/article/19/3/getting-started-geany-text-editor) +[#]: author: (James Mawson https://opensource.com/users/dxmjames) + +Getting started with the Geany text editor +====== +Geany is a light and swift text editor with IDE features. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh) + +I have to admit, it took me a rather embarrassingly long time to really get into Linux as a daily driver. One thing I recall from these years in the wilderness was how strange it was to watch open source types get so worked up about text editors. + +It wasn't just that opinions differed. Disagreements were intense. And you'd see them again and again. + +I mean, I suppose it makes some sense. Doing dev or admin work means you're spending a lot of time with a text editor. And when it gets in the way or won't do quite what you want? In that exact moment, that's the most frustrating thing in the world. + +And I know what it means to really hate a text editor. I learned this many years ago in the computer labs at university trying to figure out Emacs. I was quite shocked that a piece of software could have so many sadomasochistic overtones. People were doing that to each other deliberately! + +So perhaps it's a rite of passage that now I have one I very much like. It's called [Geany][1], it's on GPL, and it's [in the repositories][2] of most popular distributions. + +Here's why it works for me. + +### I'm into simplicity + +The main thing I want from a text editor is just to edit text. I don't think there should be any kind of learning curve in the way. I should be able to open it and use it. + +For that reason, I've generally used whatever is included with an operating system. On Windows 10, I used Notepad far longer than I should have. When I finally replaced it, it was with Notepad++. In the Linux terminal, I like Nano. + +I was perfectly aware I was missing out on a lot of useful functionality. But it was never enough of a pain point to make a change. And it's not that I've never tried anything more elaborate. I did some of my first real programming on Visual Basic and Borland Delphi. + +These development environments gave you a graphical interface to design your windows visually, various windows where you could configure properties and settings, a text interface to write your functions, and various odds and ends for debugging. This was a great way to build desktop applications, so long as you used it the way it was intended. + +But if you wanted to do something the authors didn't anticipate, all these extra moving parts suddenly got in the way. As software became more and more about the web and the internet, this situation started happening all the time. + +In the past, I used HTML editing suites like Macromedia Dreamweaver (as it was back then) and FirstPage for static websites. Again, I found the features could get in the way as much as they helped. These applications had their own ideas about how to organize your project, and if you had a different view, it was an awful bother. + +More recently, after a long break from programming, I started learning the people's language: [Python][3]. I bought a book of introductory tutorials, which said to install [IDLE][4], so I did. I think I got about five minutes into it before ditching it to run the interpreter from the command line. It had way too many moving parts to deal with. Especially for HelloWorld.py. + +But I always went back to Notepad++ and Nano whenever I could get away with it. + +So what changed? Well, a few months ago I [ditched Windows 10][5] completely (hooray!). Sticking with what I knew, I used Nano as my main text editor for a few weeks. + +I learned that Nano is great when you're already on the command line and you need to launch a Navy SEAL mission. You know what I mean. A lightning-fast raid. Get in, complete the objective, and get out. + +It's less ideal for long campaigns—or even moderately short ones. Even just adding a new page to a static website turns out to involve many repetitive keystrokes. As much as anything else, I really missed being able to navigate and select text with the mouse. + +### Introducing Geany + +The Geany project began in 2005 and is still actively developed. + +It has minimal dependencies: just the [GTK Toolkit][6] and the libraries that GTK depends on. If you have any kind of desktop environment installed, you almost certainly have GTK on your machine. + +I'm using it on Xfce, but thanks to these minimal dependencies, Geany is portable across desktop environments. + +Geany is fast and light. Installing Geany from the package manager took mere moments, and it uses only 3.1MB of space on my machine. + +So far, I've used it for HTML, CSS, and Python and to edit configuration files. It also recognizes C, Java, JavaScript, Perl, and [more][7]. + +### No-compromise simplicity + +Geany has a lot of great features that make life easier. Just listing them would miss the best bit, which is this: Geany makes sense right out of the box. As soon as it's installed, you can start editing files straightaway, and it just works. + +For all the IDE functionality, none of it gets in the way. The default settings are set intelligently, and the menus are laid out nicely enough that it's no hassle to change them. + +It doesn't try to organize your project for you, and it doesn't have strong opinions about how you should do anything. + +### Handles whitespace beautifully + +By default, every time you press Enter, Geany preserves the indentation on the new line. In addition to saving a few tedious keystrokes, it avoids the inconsistent use of tabs and spaces, which can sometimes sneak in when your mind's elsewhere and make your code hard to follow for anyone with a different text editor. + +But what if you're editing a file that's already suffered this treatment? For example, I needed to edit an HTML file that was indented with a mix of tabs and spaces, making it a nightmare to figure out how the tags were nested. + +With Geany, it took just seconds to hunt through the menus to change the tab length from four spaces to eight. Even better was the option to convert those tabs to spaces. Problem solved! + +### Clever shortcuts and automation + +How often do you write the correct code on the wrong line? I do it all the time. + +Geany makes it easy to move lines of code up and down using Alt+PgUp and Alt+PgDn. This is a little nicer than just a regular cut and paste—instead of needing four or five key presses, you only need one. + +When coding HTML, Geany automatically closes tags for you. As well as saving time, this avoids a lot of annoying bugs. When you forget to close a tag, you can spend ages scouring the document looking for something far more complex. + +It gets even better in Python, where indentation is crucial. Whenever you end a line with a colon, Geany automatically indents it for you. + +One nice little side effect is that when you forget to include the colon—something I do with embarrassing regularity—you realize it immediately when you don't get the automatic indentation you expected. + +The default indentation is a single tab, while I prefer two spaces. Because Geany's menus are very well laid out, it took me only a few seconds to figure out how to change it. + +You, of course, get syntax highlighting too. In addition, it tracks your [variable scope][8] and offers useful autocompletion. + +### Large plugin library + +Geany has a [big library of plugins][9], but so far I haven't needed to try any. Even so, I still feel like I benefit from them. How? Well, it means that my editor isn't crammed with functionality I don't use. + +I reckon this attitude of adding extra functionality into a big library of plugins is a great ethos—no matter your specific needs, you get to have all the stuff you want and none of what you don't. + +### Remote file editing + +One thing that's really nice about terminal text editors is that it's no problem to use them in a remote shell. + +Geany handles this beautifully, as well. You can open remote files anywhere you have SSH access as easily as you can open files on your own machine. + +One frustration I had at first was I only seemed to be able to authenticate with a username and password, which was annoying, because certificates are so much nicer. It turned out that this was just me being a noob by keeping certificates in my home directory rather than in ~/.ssh. + +When editing Python scripts remotely, autocompletion doesn't work when you use packages installed on the server and not on your local machine. This isn't really that big a deal for me, but it's there. + +### In summary + +Text editors are such a personal preference that the right one will be different for different people. + +Geany is excellent if you already know what you want to write and want to just get on with it while enjoying plenty of useful shortcuts to speed up the menial parts. + +Geany is a great way to have your cake and eat it too. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/getting-started-geany-text-editor + +作者:[James Mawson][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dxmjames +[b]: https://github.com/lujun9972 +[1]: https://www.geany.org/ +[2]: https://www.geany.org/Download/ThirdPartyPackages +[3]: https://opensource.com/resources/python +[4]: https://en.wikipedia.org/wiki/IDLE +[5]: https://blog.dxmtechsupport.com.au/linux-on-the-desktop-are-we-nearly-there-yet/ +[6]: https://www.gtk.org/ +[7]: https://www.geany.org/Main/AllFiletypes +[8]: https://cscircles.cemc.uwaterloo.ca/11b-how-functions-work/ +[9]: https://plugins.geany.org/ From c5bb21412a9aec9885f0f5a3b49983b2be09471d Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 15:26:04 +0800 Subject: [PATCH 235/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190308=20Virtua?= =?UTF-8?q?l=20filesystems=20in=20Linux:=20Why=20we=20need=20them=20and=20?= =?UTF-8?q?how=20they=20work=20sources/tech/20190308=20Virtual=20filesyste?= =?UTF-8?q?ms=20in=20Linux-=20Why=20we=20need=20them=20and=20how=20they=20?= =?UTF-8?q?work.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nux- Why we need them and how they work.md | 196 ++++++++++++++++++ 1 file changed, 196 insertions(+) create mode 100644 sources/tech/20190308 Virtual filesystems in Linux- Why we need them and how they work.md diff --git a/sources/tech/20190308 Virtual filesystems in Linux- Why we need them and how they work.md b/sources/tech/20190308 Virtual filesystems in Linux- Why we need them and how they work.md new file mode 100644 index 0000000000..1114863bf7 --- /dev/null +++ b/sources/tech/20190308 Virtual filesystems in Linux- Why we need them and how they work.md @@ -0,0 +1,196 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Virtual filesystems in Linux: Why we need them and how they work) +[#]: via: (https://opensource.com/article/19/3/virtual-filesystems-linux) +[#]: author: (Alison Chariken ) + +Virtual filesystems in Linux: Why we need them and how they work +====== +Virtual filesystems are the magic abstraction that makes the "everything is a file" philosophy of Linux possible. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/documents_papers_file_storage_work.png?itok=YlXpAqAJ) + +What is a filesystem? According to early Linux contributor and author [Robert Love][1], "A filesystem is a hierarchical storage of data adhering to a specific structure." However, this description applies equally well to VFAT (Virtual File Allocation Table), Git, and [Cassandra][2] (a [NoSQL database][3]). So what distinguishes a filesystem? + +### Filesystem basics + +The Linux kernel requires that for an entity to be a filesystem, it must also implement the **open()** , **read()** , and **write()** methods on persistent objects that have names associated with them. From the point of view of [object-oriented programming][4], the kernel treats the generic filesystem as an abstract interface, and these big-three functions are "virtual," with no default definition. Accordingly, the kernel's default filesystem implementation is called a virtual filesystem (VFS). + + +![][5] +If we can open(), read(), and write(), it is a file as this console session shows. + +VFS underlies the famous observation that in Unix-like systems "everything is a file." Consider how weird it is that the tiny demo above featuring the character device /dev/console actually works. The image shows an interactive Bash session on a virtual teletype (tty). Sending a string into the virtual console device makes it appear on the virtual screen. VFS has other, even odder properties. For example, it's [possible to seek in them][6]. + +The familiar filesystems like ext4, NFS, and /proc all provide definitions of the big-three functions in a C-language data structure called [file_operations][7] . In addition, particular filesystems extend and override the VFS functions in the familiar object-oriented way. As Robert Love points out, the abstraction of VFS enables Linux users to blithely copy files to and from foreign operating systems or abstract entities like pipes without worrying about their internal data format. On behalf of userspace, via a system call, a process can copy from a file into the kernel's data structures with the read() method of one filesystem, then use the write() method of another kind of filesystem to output the data. + +The function definitions that belong to the VFS base type itself are found in the [fs/*.c files][8] in kernel source, while the subdirectories of fs/ contain the specific filesystems. The kernel also contains filesystem-like entities such as cgroups, /dev, and tmpfs, which are needed early in the boot process and are therefore defined in the kernel's init/ subdirectory. Note that cgroups, /dev, and tmpfs do not call the file_operations big-three functions, but directly read from and write to memory instead. + +The diagram below roughly illustrates how userspace accesses various types of filesystems commonly mounted on Linux systems. Not shown are constructs like pipes, dmesg, and POSIX clocks that also implement struct file_operations and whose accesses therefore pass through the VFS layer. + +![How userspace accesses various types of filesystems][9] +VFS are a "shim layer" between system calls and implementors of specific file_operations like ext4 and procfs. The file_operations functions can then communicate either with device-specific drivers or with memory accessors. tmpfs, devtmpfs and cgroups don't make use of file_operations but access memory directly. + +VFS's existence promotes code reuse, as the basic methods associated with filesystems need not be re-implemented by every filesystem type. Code reuse is a widely accepted software engineering best practice! Alas, if the reused code [introduces serious bugs][10], then all the implementations that inherit the common methods suffer from them. + +### /tmp: A simple tip + +An easy way to find out what VFSes are present on a system is to type **mount | grep -v sd | grep -v :/** , which will list all mounted filesystems that are not resident on a disk and not NFS on most computers. One of the listed VFS mounts will assuredly be /tmp, right? + +![Man with shocked expression][11] +Everyone knows that keeping /tmp on a physical storage device is crazy! credit: + +Why is keeping /tmp on storage inadvisable? Because the files in /tmp are temporary(!), and storage devices are slower than memory, where tmpfs are created. Further, physical devices are more subject to wear from frequent writing than memory is. Last, files in /tmp may contain sensitive information, so having them disappear at every reboot is a feature. + +Unfortunately, installation scripts for some Linux distros still create /tmp on a storage device by default. Do not despair should this be the case with your system. Follow simple instructions on the always excellent [Arch Wiki][12] to fix the problem, keeping in mind that memory allocated to tmpfs is not available for other purposes. In other words, a system with a gigantic tmpfs with large files in it can run out of memory and crash. Another tip: when editing the /etc/fstab file, be sure to end it with a newline, as your system will not boot otherwise. (Guess how I know.) + +### /proc and /sys + +Besides /tmp, the VFSes with which most Linux users are most familiar are /proc and /sys. (/dev relies on shared memory and has no file_operations). Why two flavors? Let's have a look in more detail. + +The procfs offers a snapshot into the instantaneous state of the kernel and the processes that it controls for userspace. In /proc, the kernel publishes information about the facilities it provides, like interrupts, virtual memory, and the scheduler. In addition, /proc/sys is where the settings that are configurable via the [sysctl command][13] are accessible to userspace. Status and statistics on individual processes are reported in /proc/ directories. + +![Console][14] +/proc/meminfo is an empty file that nonetheless contains valuable information. + +The behavior of /proc files illustrates how unlike on-disk filesystems VFS can be. On the one hand, /proc/meminfo contains the information presented by the command **free**. On the other hand, it's also empty! How can this be? The situation is reminiscent of a famous article written by Cornell University physicist N. David Mermin in 1985 called "[Is the moon there when nobody looks?][15] Reality and the quantum theory." The truth is that the kernel gathers statistics about memory when a process requests them from /proc, and there actually is nothing in the files in /proc when no one is looking. As [Mermin said][16], "It is a fundamental quantum doctrine that a measurement does not, in general, reveal a preexisting value of the measured property." (The answer to the question about the moon is left as an exercise.) + +![Full moon][17] +The files in /proc are empty when no process accesses them. ([Source][18]) + +The apparent emptiness of procfs makes sense, as the information available there is dynamic. The situation with sysfs is different. Let's compare how many files of at least one byte in size there are in /proc versus /sys. + +![](https://opensource.com/sites/default/files/uploads/virtualfilesystems_6-filesize.png) + +Procfs has precisely one, namely the exported kernel configuration, which is an exception since it needs to be generated only once per boot. On the other hand, /sys has lots of larger files, most of which comprise one page of memory. Typically, sysfs files contain exactly one number or string, in contrast to the tables of information produced by reading files like /proc/meminfo. + +The purpose of sysfs is to expose the readable and writable properties of what the kernel calls "kobjects" to userspace. The only purpose of kobjects is reference-counting: when the last reference to a kobject is deleted, the system will reclaim the resources associated with it. Yet, /sys constitutes most of the kernel's famous "[stable ABI to userspace][19]" which [no one may ever, under any circumstances, "break."][20] That doesn't mean the files in sysfs are static, which would be contrary to reference-counting of volatile objects. + +The kernel's stable ABI instead constrains what can appear in /sys, not what is actually present at any given instant. Listing the permissions on files in sysfs gives an idea of how the configurable, tunable parameters of devices, modules, filesystems, etc. can be set or read. Logic compels the conclusion that procfs is also part of the kernel's stable ABI, although the kernel's [documentation][19] doesn't state so explicitly. + +![Console][21] +Files in sysfs describe exactly one property each for an entity and may be readable, writable or both. The "0" in the file reveals that the SSD is not removable. + +### Snooping on VFS with eBPF and bcc tools + +The easiest way to learn how the kernel manages sysfs files is to watch it in action, and the simplest way to watch on ARM64 or x86_64 is to use eBPF. eBPF (extended Berkeley Packet Filter) consists of a [virtual machine running inside the kernel][22] that privileged users can query from the command line. Kernel source tells the reader what the kernel can do; running eBPF tools on a booted system shows instead what the kernel actually does. + +Happily, getting started with eBPF is pretty easy via the [bcc][23] tools, which are available as [packages from major Linux distros][24] and have been [amply documented][25] by Brendan Gregg. The bcc tools are Python scripts with small embedded snippets of C, meaning anyone who is comfortable with either language can readily modify them. At this count, [there are 80 Python scripts in bcc/tools][26], making it highly likely that a system administrator or developer will find an existing one relevant to her/his needs. + +To get a very crude idea about what work VFSes are performing on a running system, try the simple [vfscount][27] or [vfsstat][28], which show that dozens of calls to vfs_open() and its friends occur every second. + +![Console - vfsstat.py][29] +vfsstat.py is a Python script with an embedded C snippet that simply counts VFS function calls. + +For a less trivial example, let's watch what happens in sysfs when a USB stick is inserted on a running system. + +![Console when USB is inserted][30] +Watch with eBPF what happens in /sys when a USB stick is inserted, with simple and complex examples. + +In the first simple example above, the [trace.py][31] bcc tools script prints out a message whenever the sysfs_create_files() command runs. We see that sysfs_create_files() was started by a kworker thread in response to the USB stick insertion, but what file was created? The second example illustrates the full power of eBPF. Here, trace.py is printing the kernel backtrace (-K option) plus the name of the file created by sysfs_create_files(). The snippet inside the single quotes is some C source code, including an easily recognizable format string, that the provided Python script [induces a LLVM just-in-time compiler][32] to compile and execute inside an in-kernel virtual machine. The full sysfs_create_files() function signature must be reproduced in the second command so that the format string can refer to one of the parameters. Making mistakes in this C snippet results in recognizable C-compiler errors. For example, if the **-I** parameter is omitted, the result is "Failed to compile BPF text." Developers who are conversant with either C or Python will find the bcc tools easy to extend and modify. + +When the USB stick is inserted, the kernel backtrace appears showing that PID 7711 is a kworker thread that created a file called "events" in sysfs. A corresponding invocation with sysfs_remove_files() shows that removal of the USB stick results in removal of the events file, in keeping with the idea of reference counting. Watching sysfs_create_link() with eBPF during USB stick insertion (not shown) reveals that no fewer than 48 symbolic links are created. + +What is the purpose of the events file anyway? Using [cscope][33] to find the function [__device_add_disk()][34] reveals that it calls disk_add_events(), and either "media_change" or "eject_request" may be written to the events file. Here, the kernel's block layer is informing userspace about the appearance and disappearance of the "disk." Consider how quickly informative this method of investigating how USB stick insertion works is compared to trying to figure out the process solely from the source. + +### Read-only root filesystems make embedded devices possible + +Assuredly, no one shuts down a server or desktop system by pulling out the power plug. Why? Because mounted filesystems on the physical storage devices may have pending writes, and the data structures that record their state may become out of sync with what is written on the storage. When that happens, system owners will have to wait at next boot for the [fsck filesystem-recovery tool][35] to run and, in the worst case, will actually lose data. + +Yet, aficionados will have heard that many IoT and embedded devices like routers, thermostats, and automobiles now run Linux. Many of these devices almost entirely lack a user interface, and there's no way to "unboot" them cleanly. Consider jump-starting a car with a dead battery where the power to the [Linux-running head unit][36] goes up and down repeatedly. How is it that the system boots without a long fsck when the engine finally starts running? The answer is that embedded devices rely on [a read-only root fileystem][37] (ro-rootfs for short). + +![Photograph of a console][38] +ro-rootfs are why embedded systems don't frequently need to fsck. Credit (with permission): + +A ro-rootfs offers many advantages that are less obvious than incorruptibility. One is that malware cannot write to /usr or /lib if no Linux process can write there. Another is that a largely immutable filesystem is critical for field support of remote devices, as support personnel possess local systems that are nominally identical to those in the field. Perhaps the most important (but also most subtle) advantage is that ro-rootfs forces developers to decide during a project's design phase which system objects will be immutable. Dealing with ro-rootfs may often be inconvenient or even painful, as [const variables in programming languages][39] often are, but the benefits easily repay the extra overhead. + +Creating a read-only rootfs does require some additional amount of effort for embedded developers, and that's where VFS comes in. Linux needs files in /var to be writable, and in addition, many popular applications that embedded systems run will try to create configuration dot-files in $HOME. One solution for configuration files in the home directory is typically to pregenerate them and build them into the rootfs. For /var, one approach is to mount it on a separate writable partition while / itself is mounted as read-only. Using bind or overlay mounts is another popular alternative. + +### Bind and overlay mounts and their use by containers + +Running **[man mount][40]** is the best place to learn about bind and overlay mounts, which give embedded developers and system administrators the power to create a filesystem in one path location and then provide it to applications at a second one. For embedded systems, the implication is that it's possible to store the files in /var on an unwritable flash device but overlay- or bind-mount a path in a tmpfs onto the /var path at boot so that applications can scrawl there to their heart's delight. At next power-on, the changes in /var will be gone. Overlay mounts provide a union between the tmpfs and the underlying filesystem and allow apparent modification to an existing file in a ro-rootfs, while bind mounts can make new empty tmpfs directories show up as writable at ro-rootfs paths. While overlayfs is a proper filesystem type, bind mounts are implemented by the [VFS namespace facility][41]. + +Based on the description of overlay and bind mounts, no one will be surprised that [Linux containers][42] make heavy use of them. Let's spy on what happens when we employ [systemd-nspawn][43] to start up a container by running bcc's mountsnoop tool: + +![Console - system-nspawn invocation][44] +The system-nspawn invocation fires up the container while mountsnoop.py runs. + +And let's see what happened: + +![Console - Running mountsnoop][45] +Running mountsnoop during the container "boot" reveals that the container runtime relies heavily on bind mounts. (Only the beginning of the lengthy output is displayed) + +Here, systemd-nspawn is providing selected files in the host's procfs and sysfs to the container at paths in its rootfs. Besides the MS_BIND flag that sets bind-mounting, some of the other flags that the "mount" system call invokes determine the relationship between changes in the host namespace and in the container. For example, the bind-mount can either propagate changes in /proc and /sys to the container, or hide them, depending on the invocation. + +### Summary + +Understanding Linux internals can seem an impossible task, as the kernel itself contains a gigantic amount of code, leaving aside Linux userspace applications and the system-call interface in C libraries like glibc. One way to make progress is to read the source code of one kernel subsystem with an emphasis on understanding the userspace-facing system calls and headers plus major kernel internal interfaces, exemplified here by the file_operations table. The file operations are what makes "everything is a file" actually work, so getting a handle on them is particularly satisfying. The kernel C source files in the top-level fs/ directory constitute its implementation of virtual filesystems, which are the shim layer that enables broad and relatively straightforward interoperability of popular filesystems and storage devices. Bind and overlay mounts via Linux namespaces are the VFS magic that makes containers and read-only root filesystems possible. In combination with a study of source code, the eBPF kernel facility and its bcc interface makes probing the kernel simpler than ever before. + +Much thanks to [Akkana Peck][46] and [Michael Eager][47] for comments and corrections. + +Alison Chaiken will present [Virtual filesystems: why we need them and how they work][48] at the 17th annual Southern California Linux Expo ([SCaLE 17x][49]) March 7-10 in Pasadena, Calif. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/virtual-filesystems-linux + +作者:[Alison Chariken][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: +[b]: https://github.com/lujun9972 +[1]: https://www.pearson.com/us/higher-education/program/Love-Linux-Kernel-Development-3rd-Edition/PGM202532.html +[2]: http://cassandra.apache.org/ +[3]: https://en.wikipedia.org/wiki/NoSQL +[4]: http://lwn.net/Articles/444910/ +[5]: https://opensource.com/sites/default/files/uploads/virtualfilesystems_1-console.png (Console) +[6]: https://lwn.net/Articles/22355/ +[7]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/fs.h +[8]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs +[9]: https://opensource.com/sites/default/files/uploads/virtualfilesystems_2-shim-layer.png (How userspace accesses various types of filesystems) +[10]: https://lwn.net/Articles/774114/ +[11]: https://opensource.com/sites/default/files/uploads/virtualfilesystems_3-crazy.jpg (Man with shocked expression) +[12]: https://wiki.archlinux.org/index.php/Tmpfs +[13]: http://man7.org/linux/man-pages/man8/sysctl.8.html +[14]: https://opensource.com/sites/default/files/uploads/virtualfilesystems_4-proc-meminfo.png (Console) +[15]: http://www-f1.ijs.si/~ramsak/km1/mermin.moon.pdf +[16]: https://en.wikiquote.org/wiki/David_Mermin +[17]: https://opensource.com/sites/default/files/uploads/virtualfilesystems_5-moon.jpg (Full moon) +[18]: https://commons.wikimedia.org/wiki/Moon#/media/File:Full_Moon_Luc_Viatour.jpg +[19]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/ABI/stable +[20]: https://lkml.org/lkml/2012/12/23/75 +[21]: https://opensource.com/sites/default/files/uploads/virtualfilesystems_7-sysfs.png (Console) +[22]: https://events.linuxfoundation.org/sites/events/files/slides/bpf_collabsummit_2015feb20.pdf +[23]: https://github.com/iovisor/bcc +[24]: https://github.com/iovisor/bcc/blob/master/INSTALL.md +[25]: http://brendangregg.com/ebpf.html +[26]: https://github.com/iovisor/bcc/tree/master/tools +[27]: https://github.com/iovisor/bcc/blob/master/tools/vfscount_example.txt +[28]: https://github.com/iovisor/bcc/blob/master/tools/vfsstat.py +[29]: https://opensource.com/sites/default/files/uploads/virtualfilesystems_8-vfsstat.png (Console - vfsstat.py) +[30]: https://opensource.com/sites/default/files/uploads/virtualfilesystems_9-ebpf.png (Console when USB is inserted) +[31]: https://github.com/iovisor/bcc/blob/master/tools/trace_example.txt +[32]: https://events.static.linuxfound.org/sites/events/files/slides/bpf_collabsummit_2015feb20.pdf +[33]: http://northstar-www.dartmouth.edu/doc/solaris-forte/manuals/c/user_guide/cscope.html +[34]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/block/genhd.c#n665 +[35]: http://www.man7.org/linux/man-pages/man8/fsck.8.html +[36]: https://wiki.automotivelinux.org/_media/eg-rhsa/agl_referencehardwarespec_v0.1.0_20171018.pdf +[37]: https://elinux.org/images/1/1f/Read-only_rootfs.pdf +[38]: https://opensource.com/sites/default/files/uploads/virtualfilesystems_10-code.jpg (Photograph of a console) +[39]: https://www.meetup.com/ACCU-Bay-Area/events/drpmvfytlbqb/ +[40]: http://man7.org/linux/man-pages/man8/mount.8.html +[41]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/filesystems/sharedsubtree.txt +[42]: https://coreos.com/os/docs/latest/kernel-modules.html +[43]: https://www.freedesktop.org/software/systemd/man/systemd-nspawn.html +[44]: https://opensource.com/sites/default/files/uploads/virtualfilesystems_11-system-nspawn.png (Console - system-nspawn invocation) +[45]: https://opensource.com/sites/default/files/uploads/virtualfilesystems_12-mountsnoop.png (Console - Running mountsnoop) +[46]: http://shallowsky.com/ +[47]: http://eagercon.com/ +[48]: https://www.socallinuxexpo.org/scale/17x/presentations/virtual-filesystems-why-we-need-them-and-how-they-work +[49]: https://www.socallinuxexpo.org/ From 3c4deaf60d256a8cd7fccabc3dbb9a507dc6d34e Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 13 Mar 2019 15:29:03 +0800 Subject: [PATCH 236/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190306=20Cluste?= =?UTF-8?q?rShell=20=E2=80=93=20A=20Nifty=20Tool=20To=20Run=20Commands=20O?= =?UTF-8?q?n=20Cluster=20Nodes=20In=20Parallel=20sources/tech/20190306=20C?= =?UTF-8?q?lusterShell=20-=20A=20Nifty=20Tool=20To=20Run=20Commands=20On?= =?UTF-8?q?=20Cluster=20Nodes=20In=20Parallel.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...n Commands On Cluster Nodes In Parallel.md | 309 ++++++++++++++++++ 1 file changed, 309 insertions(+) create mode 100644 sources/tech/20190306 ClusterShell - A Nifty Tool To Run Commands On Cluster Nodes In Parallel.md diff --git a/sources/tech/20190306 ClusterShell - A Nifty Tool To Run Commands On Cluster Nodes In Parallel.md b/sources/tech/20190306 ClusterShell - A Nifty Tool To Run Commands On Cluster Nodes In Parallel.md new file mode 100644 index 0000000000..8f69143d36 --- /dev/null +++ b/sources/tech/20190306 ClusterShell - A Nifty Tool To Run Commands On Cluster Nodes In Parallel.md @@ -0,0 +1,309 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (ClusterShell – A Nifty Tool To Run Commands On Cluster Nodes In Parallel) +[#]: via: (https://www.2daygeek.com/clustershell-clush-run-commands-on-cluster-nodes-remote-system-in-parallel-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +ClusterShell – A Nifty Tool To Run Commands On Cluster Nodes In Parallel +====== + +We had written two articles in the past to run commands on multiple remote server in parallel. + +These are **[Parallel SSH (PSSH)][1]** or **[Distributed Shell (DSH)][2]**. + +Today also, we are going to discuss about the same kind of topic but it allows us to perform the same on cluster nodes as well. + +You may think, i can write a small shell script to archive this instead of installing these third party packages. + +Of course you are right and if you are going to run some commands in 10-15 remote systems then you don’t need to use this. + +However, the scripts take some time to complete this task as it’s running in a sequential order. + +Think about if you would like to run some commands on 1000+ servers what will be the options? + +In this case your script won’t help you. Also, it would take good amount of time to complete a task. + +So, to overcome this kind of issue and situation. We need to run the command in parallel on remote machines. + +For that, we need use in one of the Parallel applications. I hope this explanation might fulfilled your doubts about parallel utilities. + +### What Is ClusterShell? + +clush stands for [ClusterShell][3]. ClusterShell is an event-driven open source Python library, designed to run local or distant commands in parallel on server farms or on large Linux clusters. + +It will take care of common issues encountered on HPC clusters, such as operating on groups of nodes, running distributed commands using optimized execution algorithms, as well as gathering results and merging identical outputs, or retrieving return codes. + +ClusterShell takes advantage of existing remote shell facilities already installed on your systems, like SSH. + +ClusterShell’s primary goal is to improve the administration of high- performance clusters by providing a lightweight but scalable Python API for developers. It also provides clush, clubak and cluset/nodeset, convenient command-line tools that allow traditional shell scripts to benefit from some of the library features. + +ClusterShell’s written in Python and it requires Python (v2.6+ or v3.4+) to run on your system. + +### How To Install ClusterShell On Linux? + +ClusterShell package is available in most of the distribution official package manager. So, use the distribution package manager tool to install it. + +For **`Fedora`** system, use **[DNF Command][4]** to install clustershell. + +``` +$ sudo dnf install clustershell +``` + +Python 2 module and tools are installed and if it’s default on your system then run the following command to install Python 3 development on Fedora System. + +``` +$ sudo dnf install python3-clustershell +``` + +Make sure you should have enabled the **[EPEL repository][5]** on your system before performing clustershell installation. + +For **`RHEL/CentOS`** systems, use **[YUM Command][6]** to install clustershell. + +``` +$ sudo yum install clustershell +``` + +Python 2 module and tools are installed and if it’s default on your system then run the following command to install Python 3 development on CentOS/RHEL System. + +``` +$ sudo yum install python34-clustershell +``` + +For **`openSUSE Leap`** system, use **[Zypper Command][7]** to install clustershell. + +``` +$ sudo zypper install clustershell +``` + +Python 2 module and tools are installed and if it’s default on your system then run the following command to install Python 3 development on OpenSUSE System. + +``` +$ sudo zypper install python3-clustershell +``` + +For **`Debian/Ubuntu`** systems, use **[APT-GET Command][8]** or **[APT Command][9]** to install clustershell. + +``` +$ sudo apt install clustershell +``` + +### How To Install ClusterShell In Linux Using PIP? + +Use PIP to install ClusterShell because it’s written in Python. + +Make sure you should have enabled the **[Python][10]** and **[PIP][11]** on your system before performing clustershell installation. + +``` +$ sudo pip install ClusterShell +``` + +### How To Use ClusterShell On Linux? + +It’s straight forward and awesome tool compared with other utilities such as pssh and dsh. It has so many options to perform the remote execution in parallel. + +Make sure you should have enabled the **[password less login][12]** on your system before start using clustershell. + +The following configuration file defines system-wide default values. You no need to modify anything here. + +``` +$ cat /etc/clustershell/clush.conf +``` + +If you would like to create a servers group. Here you can go. By default some examples were available so, do the same for your requirements. + +``` +$ cat /etc/clustershell/groups.d/local.cfg +``` + +Just run the clustershell command in the following format to get the information from the given nodes. + +``` +$ clush -w 192.168.1.4,192.168.1.9 cat /proc/version +192.168.1.9: Linux version 4.15.0-45-generic ([email protected]) (gcc version 7.3.0 (Ubuntu 7.3.0-16ubuntu3)) #48-Ubuntu SMP Tue Jan 29 16:28:13 UTC 2019 +192.168.1.4: Linux version 3.10.0-957.el7.x86_64 ([email protected]) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ) #1 SMP Thu Nov 8 23:39:32 UTC 2018 +``` + +**Option:** + + * **`-w:`** nodes where to run the command. + + + +You can use the regular expressions instead of using full hostname and IPs. + +``` +$ clush -w 192.168.1.[4,9] uname -r +192.168.1.9: 4.15.0-45-generic +192.168.1.4: 3.10.0-957.el7.x86_64 +``` + +Alternatively you can use the following format if you have the servers in the same IP series. + +``` +$ clush -w 192.168.1.[4-9] date +192.168.1.6: Mon Mar 4 21:08:29 IST 2019 +192.168.1.7: Mon Mar 4 21:08:29 IST 2019 +192.168.1.8: Mon Mar 4 21:08:29 IST 2019 +192.168.1.5: Mon Mar 4 09:16:30 CST 2019 +192.168.1.9: Mon Mar 4 21:08:29 IST 2019 +192.168.1.4: Mon Mar 4 09:16:30 CST 2019 +``` + +clustershell allow us to run the command in batch mode. Use the following format to achieve this. + +``` +$ clush -w 192.168.1.4,192.168.1.9 -b +Enter 'quit' to leave this interactive mode +Working with nodes: 192.168.1.[4,9] +clush> hostnamectl +--------------- +192.168.1.4 +--------------- + Static hostname: CentOS7.2daygeek.com + Icon name: computer-vm + Chassis: vm + Machine ID: 002f47b82af248f5be1d67b67e03514c + Boot ID: f9b37a073c534dec8b236885e754cb56 + Virtualization: kvm + Operating System: CentOS Linux 7 (Core) + CPE OS Name: cpe:/o:centos:centos:7 + Kernel: Linux 3.10.0-957.el7.x86_64 + Architecture: x86-64 +--------------- +192.168.1.9 +--------------- + Static hostname: Ubuntu18 + Icon name: computer-vm + Chassis: vm + Machine ID: 27f6c2febda84dc881f28fd145077187 + Boot ID: f176f2eb45524d4f906d12e2b5716649 + Virtualization: oracle + Operating System: Ubuntu 18.04.2 LTS + Kernel: Linux 4.15.0-45-generic + Architecture: x86-64 +clush> free -m +--------------- +192.168.1.4 +--------------- + total used free shared buff/cache available +Mem: 1838 641 217 19 978 969 +Swap: 2047 0 2047 +--------------- +192.168.1.9 +--------------- + total used free shared buff/cache available +Mem: 1993 352 1067 1 573 1473 +Swap: 1425 0 1425 +clush> w +--------------- +192.168.1.4 +--------------- + 09:21:14 up 3:21, 3 users, load average: 0.00, 0.01, 0.05 +USER TTY FROM [email protected] IDLE JCPU PCPU WHAT +daygeek :0 :0 06:02 ?xdm? 1:28 0.30s /usr/libexec/gnome-session-binary --session gnome-classic +daygeek pts/0 :0 06:03 3:17m 0.06s 0.06s bash +daygeek pts/1 192.168.1.6 06:03 52:26 0.10s 0.10s -bash +--------------- +192.168.1.9 +--------------- + 21:13:12 up 3:12, 1 user, load average: 0.08, 0.03, 0.00 +USER TTY FROM [email protected] IDLE JCPU PCPU WHAT +daygeek pts/0 192.168.1.6 20:42 29:41 0.05s 0.05s -bash +clush> quit +``` + +If you would like to run the command on a group of nodes then use the following format. + +``` +$ clush -w @dev uptime +or +$ clush -g dev uptime +or +$ clush --group=dev uptime + +192.168.1.9: 21:10:10 up 3:09, 1 user, load average: 0.09, 0.03, 0.01 +192.168.1.4: 09:18:12 up 3:18, 3 users, load average: 0.01, 0.02, 0.05 +``` + +If you would like to run the command on more than one group of nodes then use the following format. + +``` +$ clush -w @dev,@uat uptime +or +$ clush -g dev,uat uptime +or +$ clush --group=dev,uat uptime + +192.168.1.7: 07:57:19 up 59 min, 1 user, load average: 0.08, 0.03, 0.00 +192.168.1.9: 20:27:20 up 1:00, 1 user, load average: 0.00, 0.00, 0.00 +192.168.1.5: 08:57:21 up 59 min, 1 user, load average: 0.00, 0.01, 0.05 +``` + +clustershell allow us to copy a file to remote machines. To copy local file or directory to the remote nodes in the same location. + +``` +$ clush -w 192.168.1.[4,9] --copy /home/daygeek/passwd-up.sh +``` + +We can verify the same by running the following command. + +``` +$ clush -w 192.168.1.[4,9] ls -lh /home/daygeek/passwd-up.sh +192.168.1.4: -rwxr-xr-x. 1 daygeek daygeek 159 Mar 4 09:00 /home/daygeek/passwd-up.sh +192.168.1.9: -rwxr-xr-x 1 daygeek daygeek 159 Mar 4 20:52 /home/daygeek/passwd-up.sh +``` + +To copy local file or directory to the remote nodes in the different location. + +``` +$ clush -g uat --copy /home/daygeek/passwd-up.sh --dest /tmp +``` + +We can verify the same by running the following command. + +``` +$ clush --group=uat ls -lh /tmp/passwd-up.sh +192.168.1.7: -rwxr-xr-x. 1 daygeek daygeek 159 Mar 6 07:44 /tmp/passwd-up.sh +``` + +To copy file or directory from remote nodes to local system. + +``` +$ clush -w 192.168.1.7 --rcopy /home/daygeek/Documents/magi.txt --dest /tmp +``` + +We can verify the same by running the following command. + +``` +$ ls -lh /tmp/magi.txt.192.168.1.7 +-rw-r--r-- 1 daygeek daygeek 35 Mar 6 20:24 /tmp/magi.txt.192.168.1.7 +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/clustershell-clush-run-commands-on-cluster-nodes-remote-system-in-parallel-linux/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/pssh-parallel-ssh-run-execute-commands-on-multiple-linux-servers/ +[2]: https://www.2daygeek.com/dsh-run-execute-shell-commands-on-multiple-linux-servers-at-once/ +[3]: https://cea-hpc.github.io/clustershell/ +[4]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/ +[5]: https://www.2daygeek.com/install-enable-epel-repository-on-rhel-centos-scientific-linux-oracle-linux/ +[6]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ +[7]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ +[8]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[9]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[10]: https://www.2daygeek.com/3-methods-to-install-latest-python3-package-on-centos-6-system/ +[11]: https://www.2daygeek.com/install-pip-manage-python-packages-linux/ +[12]: https://www.2daygeek.com/linux-passwordless-ssh-login-using-ssh-keygen/ From 5e43b6ac4bd7d5d20451b964804cfef3113f5ffa Mon Sep 17 00:00:00 2001 From: GraveAccent Date: Wed, 13 Mar 2019 19:51:47 +0800 Subject: [PATCH 237/796] 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 238/796] 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 239/796] 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 240/796] 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 241/796] 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 242/796] 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 243/796] 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 244/796] 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 245/796] 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 246/796] =?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 247/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190312=20BackBo?= =?UTF-8?q?x=20Linux=20for=20Penetration=20Testing=20sources/tech/20190312?= =?UTF-8?q?=20BackBox=20Linux=20for=20Penetration=20Testing.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...2 BackBox Linux for Penetration Testing.md | 200 ++++++++++++++++++ 1 file changed, 200 insertions(+) create mode 100644 sources/tech/20190312 BackBox Linux for Penetration Testing.md diff --git a/sources/tech/20190312 BackBox Linux for Penetration Testing.md b/sources/tech/20190312 BackBox Linux for Penetration Testing.md new file mode 100644 index 0000000000..b79a4a5cee --- /dev/null +++ b/sources/tech/20190312 BackBox Linux for Penetration Testing.md @@ -0,0 +1,200 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (BackBox Linux for Penetration Testing) +[#]: via: (https://www.linux.com/blog/learn/2019/3/backbox-linux-penetration-testing) +[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) + +BackBox Linux for Penetration Testing +====== +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/security-2688911_1920.jpg?itok=yZ9TjAXu) + +Any given task can succeed or fail depending upon the tools at hand. For security engineers in particular, building just the right toolkit can make life exponentially easier. Luckily, with open source, you have a wide range of applications and environments at your disposal, ranging from simple commands to complicated and integrated tools. + +The problem with the piecemeal approach, however, is that you might wind up missing out on something that can make or break a job… or you waste a lot of time hunting down the right tools for the job. To that end, it’s always good to consider an operating system geared specifically for penetration testing (aka pentesting). + +Within the world of open source, the most popular pentesting distribution is [Kali Linux][1]. It is, however, not the only tool in the shop. In fact, there’s another flavor of Linux, aimed specifically at pentesting, called [BackBox][2]. BackBox is based on Ubuntu Linux, which also means you have easy access to a host of other outstanding applications besides those that are included, out of the box. + +### What Makes BackBox Special? + +BackBox includes a suite of ethical hacking tools, geared specifically toward pentesting. These testing tools include the likes of: + + * Web application analysis + + * Exploitation testing + + * Network analysis + + * Stress testing + + * Privilege escalation + + * Vulnerability assessment + + * Computer forensic analysis and exploitation + + * And much more + + + + +Out of the box, one of the most significant differences between Kali Linux and BackBox is the number of installed tools. Whereas Kali Linux ships with hundreds of tools pre-installed, BackBox significantly limits that number to around 70. Nonetheless, BackBox includes many of the tools necessary to get the job done, such as: + + * Ettercap + + * Msfconsole + + * Wireshark + + * ZAP + + * Zenmap + + * BeEF Browser Exploitation + + * Sqlmap + + * Driftnet + + * Tcpdump + + * Cryptcat + + * Weevely + + * Siege + + * Autopsy + + + + +BackBox is in active development, the latest version (5.3) was released February 18, 2019. But how is BackBox as a usable tool? Let’s install and find out. + +### Installation + +If you’ve installed one Linux distribution, you’ve installed them all … with only slight variation. BackBox is pretty much the same as any other installation. [Download the ISO][3], burn the ISO onto a USB drive, boot from the USB drive, and click the Install icon. + +The installer (Figure 1) will be instantly familiar to anyone who has installed a Ubuntu or Debian derivative. Just because BackBox is a distribution geared specifically toward security administrators, doesn’t mean the operating system is a challenge to get up and running. In fact, BackBox is a point-and-click affair that anyone, regardless of skills, can install. + +![installation][5] + +Figure 1: The installation of BackBox will be immediately familiar to anyone. + +[Used with permission][6] + +The trickiest section of the installation is the Installation Type. As you can see (Figure 2), even this step is quite simple. + +![BackBox][8] + +Figure 2: Selecting the type of installation for BackBox. + +[Used with permission][6] + +Once you’ve installed BackBox, reboot the system, remove the USB drive, and wait for it to land on the login screen. Log into the desktop and you’re ready to go (Figure 3). + +![desktop][10] + +Figure 3: The BackBox Linux desktop, running as a VirtualBox virtual machine. + +[Used with permission][6] + +### Using BackBox + +Thanks to the [Xfce desktop environment][11], BackBox is easy enough for a Linux newbie to navigate. Click on the menu button in the top left corner to reveal the menu (Figure 4). + +![desktop menu][13] + +Figure 4: The BackBox desktop menu in action. + +[Used with permission][6] + +From the desktop menu, click on any one of the favorites (in the left pane) or click on a category to reveal the related tools (Figure 5). + +![Auditing][15] + +Figure 5: The Auditing category in the BackBox menu. + +[Used with permission][6] + +The menu entries you’ll most likely be interested in are: + + * Anonymous - allows you to start an anonymous networking session. + + * Auditing - the majority of the pentesting tools are found in here. + + * Services - allows you to start/stop services such as Apache, Bluetooth, Logkeys, Networking, Polipo, SSH, and Tor. + + + + +Before you run any of the testing tools, I would recommend you first making sure to update and upgrade BackBox. This can be done via a GUI or the command line. If you opt to go the GUI route, click on the desktop menu, click System, and click Software Updater. When the updater completes its check for updates, it will prompt you if any are available, or if (after an upgrade) a reboot is necessary (Figure 6). + +![reboot][17] + +Figure 6: Time to reboot after an upgrade. + +[Used with permission][6] + +Should you opt to go the manual route, open a terminal window and issue the following two commands: + +``` +sudo apt-get update + +sudo apt-get upgrade -y +``` + +Many of the BackBox pentesting tools do require a solid understanding of how each tool works, so before you attempt to use any given tool, make sure you know how to use said tool. Some tools (such as Metasploit) are made a bit easier to work with, thanks to BackBox. To run Metasploit, click on the desktop menu button and click msfconsole from the favorites (left pane). When the tool opens for the first time, you’ll be asked to configure a few options. Simply select each default given by clicking your keyboard Enter key when prompted. Once you see the Metasploit prompt, you can run commands like: + +``` +db_nmap 192.168.0/24 +``` + +The above command will list out all discovered ports on a 192.168.1.x network scheme (Figure 7). + +![Metasploit][19] + +Figure 7: Open port discovery made simple with Metasploit on BackBox. + +[Used with permission][6] + +Even often-challenging tools like Metasploit are made far easier than they are with other distributions (partially because you don’t have to bother with installing the tools). That alone is worth the price of entry for BackBox (which is, of course, free). + +### The Conclusion + +Although BackBox usage may not be as widespread as Kali Linux, it still deserves your attention. For anyone looking to do pentesting on their various environments, BackBox makes the task far easier than so many other operating systems. Give this Linux distribution a go and see if it doesn’t aid you in your journey to security nirvana. + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2019/3/backbox-linux-penetration-testing + +作者:[Jack Wallen][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/users/jlwallen +[b]: https://github.com/lujun9972 +[1]: https://www.kali.org/ +[2]: https://linux.backbox.org/ +[3]: https://www.backbox.org/download/ +[4]: /files/images/backbox1jpg +[5]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/backbox_1.jpg?itok=pn4fQVp7 (installation) +[6]: /licenses/category/used-permission +[7]: /files/images/backbox2jpg +[8]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/backbox_2.jpg?itok=tf-1zo8Z (BackBox) +[9]: /files/images/backbox3jpg +[10]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/backbox_3.jpg?itok=GLowoAUb (desktop) +[11]: https://www.xfce.org/ +[12]: /files/images/backbox4jpg +[13]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/backbox_4.jpg?itok=VmQXtuZL (desktop menu) +[14]: /files/images/backbox5jpg +[15]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/backbox_5.jpg?itok=UnfM_OxG (Auditing) +[16]: /files/images/backbox6jpg +[17]: https://www.linux.com/sites/lcom/files/styles/floated_images/public/backbox_6.jpg?itok=2t1BiKPn (reboot) +[18]: /files/images/backbox7jpg +[19]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/backbox_7.jpg?itok=Vw_GEub3 (Metasploit) From 65afaf82a9694f63297c7a6cc6a6de4aadfabfd8 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 14 Mar 2019 12:05:38 +0800 Subject: [PATCH 248/796] =?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 249/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020160301=20How=20?= =?UTF-8?q?To=20Set=20Password=20Policies=20In=20Linux=20sources/tech/2016?= =?UTF-8?q?0301=20How=20To=20Set=20Password=20Policies=20In=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...1 How To Set Password Policies In Linux.md | 356 ++++++++++++++++++ 1 file changed, 356 insertions(+) create mode 100644 sources/tech/20160301 How To Set Password Policies In Linux.md diff --git a/sources/tech/20160301 How To Set Password Policies In Linux.md b/sources/tech/20160301 How To Set Password Policies In Linux.md new file mode 100644 index 0000000000..bad7c279bc --- /dev/null +++ b/sources/tech/20160301 How To Set Password Policies In Linux.md @@ -0,0 +1,356 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Set Password Policies In Linux) +[#]: via: (https://www.ostechnix.com/how-to-set-password-policies-in-linux/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +How To Set Password Policies In Linux +====== +![](https://www.ostechnix.com/wp-content/uploads/2016/03/How-To-Set-Password-Policies-In-Linux-720x340.jpg) + +Even though Linux is secure by design, there are many chances for the security breach. One of them is weak passwords. As a System administrator, you must provide a strong password for the users. Because, mostly system breaches are happening due to weak passwords. This tutorial describes how to set password policies such as **password length** , **password complexity** , **password** **expiration period** etc., in DEB based systems like Debian, Ubuntu, Linux Mint, and RPM based systems like RHEL, CentOS, Scientific Linux. + +### Set password length in DEB based systems + +By default, all Linux operating systems requires **password length of minimum 6 characters** for the users. I strongly advice you not to go below this limit. Also, don’t use your real name, parents/spouse/kids name, or your date of birth as a password. Even a novice hacker can easily break such kind of passwords in minutes. The good password must always contains more than 6 characters including a number, a capital letter, and a special character. + +Usually, the password and authentication-related configuration files will be stored in **/etc/pam.d/** location in DEB based operating systems. + +To set minimum password length, edit**/etc/pam.d/common-password** file; + +``` +$ sudo nano /etc/pam.d/common-password +``` + +Find the following line: + +``` +password [success=2 default=ignore] pam_unix.so obscure sha512 +``` + +![][2] + +And add an extra word: **minlen=8** at the end. Here I set the minimum password length as **8**. + +``` +password [success=2 default=ignore] pam_unix.so obscure sha512 minlen=8 +``` + +![](https://www.ostechnix.com/wp-content/uploads/2016/03/sk@sk-_002-3-1.jpg) + +Save and close the file. So, now the users can’t use less than 8 characters for their password. + +### Set password length in RPM based systems + +**In RHEL, CentOS, Scientific Linux 7.x** systems, run the following command as root user to set password length. + +``` +# authconfig --passminlen=8 --update +``` + +To view the minimum password length, run: + +``` +# grep "^minlen" /etc/security/pwquality.conf +``` + +**Sample output:** + +``` +minlen = 8 +``` + +**In RHEL, CentOS, Scientific Linux 6.x** systems, edit **/etc/pam.d/system-auth** file: + +``` +# nano /etc/pam.d/system-auth +``` + +Find the following line and add the following at the end of the line: + +``` +password requisite pam_cracklib.so try_first_pass retry=3 type= minlen=8 +``` + +![](https://www.ostechnix.com/wp-content/uploads/2016/03/root@server_003-3.jpg) + +As per the above setting, the minimum password length is **8** characters. + +### Set password complexity in DEB based systems + +This setting enforces how many classes, i.e upper-case, lower-case, and other characters, should be in a password. + +First install password quality checking library using command: + +``` +$ sudo apt-get install libpam-pwquality +``` + +Then, edit **/etc/pam.d/common-password** file: + +``` +$ sudo nano /etc/pam.d/common-password +``` + +To set at least one **upper-case** letters in the password, add a word **‘ucredit=-1’** at the end of the following line. + +``` +password requisite pam_pwquality.so retry=3 ucredit=-1 +``` + +![](https://www.ostechnix.com/wp-content/uploads/2016/03/sk@sk-_001-7.jpg) + +Set at least one **lower-case** letters in the password as shown below. + +``` +password requisite pam_pwquality.so retry=3 dcredit=-1 +``` + +Set at least **other** letters in the password as shown below. + +``` +password requisite pam_pwquality.so retry=3 ocredit=-1 +``` + +As you see in the above examples, we have set at least (minimum) one upper-case, lower-case, and a special character in the password. You can set any number of maximum allowed upper-case, lower-case, and other letters in your password. + +You can also set the minimum/maximum number of allowed classes in the password. + +The following example shows the minimum number of required classes of characters for the new password: + +``` +password requisite pam_pwquality.so retry=3 minclass=2 +``` + +### Set password complexity in RPM based systems + +**In RHEL 7.x / CentOS 7.x / Scientific Linux 7.x:** + +To set at least one lower-case letter in the password, run: + +``` +# authconfig --enablereqlower --update +``` + +To view the settings, run: + +``` +# grep "^lcredit" /etc/security/pwquality.conf +``` + +**Sample output:** + +``` +lcredit = -1 +``` + +Similarly, set at least one upper-case letter in the password using command: + +``` +# authconfig --enablerequpper --update +``` + +To view the settings: + +``` +# grep "^ucredit" /etc/security/pwquality.conf +``` + +**Sample output:** + +``` +ucredit = -1 +``` + +To set at least one digit in the password, run: + +``` +# authconfig --enablereqdigit --update +``` + +To view the setting, run: + +``` +# grep "^dcredit" /etc/security/pwquality.conf +``` + +**Sample output:** + +``` +dcredit = -1 +``` + +To set at least one other character in the password, run: + +``` +# authconfig --enablereqother --update +``` + +To view the setting, run: + +``` +# grep "^ocredit" /etc/security/pwquality.conf +``` + +**Sample output:** + +``` +ocredit = -1 +``` + +In **RHEL 6.x / CentOS 6.x / Scientific Linux 6.x systems** , edit **/etc/pam.d/system-auth** file as root user: + +``` +# nano /etc/pam.d/system-auth +``` + +Find the following line and add the following at the end of the line: + +``` +password requisite pam_cracklib.so try_first_pass retry=3 type= minlen=8 dcredit=-1 ucredit=-1 lcredit=-1 ocredit=-1 +``` + +As per the above setting, the password must have at least 8 characters. In addtion, the password should also have at least one upper-case letter, one lower-case letter, one digit, and one other characters. + +### Set password expiration period in DEB based systems + +Now, We are going to set the following policies. + + 1. Maximum number of days a password may be used. + 2. Minimum number of days allowed between password changes. + 3. Number of days warning given before a password expires. + + + +To set this policy, edit: + +``` +$ sudo nano /etc/login.defs +``` + +Set the values as per your requirement. + +``` +PASS_MAX_DAYS 100 +PASS_MIN_DAYS 0 +PASS_WARN_AGE 7 +``` + +![](https://www.ostechnix.com/wp-content/uploads/2016/03/sk@sk-_002-8.jpg) + +As you see in the above example, the user should change the password once in every **100** days and the warning message will appear **7** days before password expiration. + +Be mindful that these settings will impact the newly created users. + +To set maximum number of days between password change to existing users, you must run the following command: + +``` +$ sudo chage -M +``` + +To set minimum number of days between password change, run: + +``` +$ sudo chage -m +``` + +To set warning before password expires, run: + +``` +$ sudo chage -W +``` + +To display the password for the existing users, run: + +``` +$ sudo chage -l sk +``` + +Here, **sk** is my username. + +**Sample output:** + +``` +Last password change : Feb 24, 2017 +Password expires : never +Password inactive : never +Account expires : never +Minimum number of days between password change : 0 +Maximum number of days between password change : 99999 +Number of days of warning before password expires : 7 +``` + +As you see in the above output, the password never expires. + +To change the password expiration period of an existing user, + +``` +$ sudo chage -E 24/06/2018 -m 5 -M 90 -I 10 -W 10 sk +``` + +The above command will set password of the user **‘sk’** to expire on **24/06/2018**. Also the the minimum number days between password change is set 5 days and the maximum number of days between password changes is set to **90** days. The user account will be locked automatically after **10 days** and It will display a warning message for **10 days** before password expiration. + +### Set password expiration period in RPM based systems + +This is same as DEB based systems. + +### Forbid previously used passwords in DEB based systems + +You can limit the users to set a password which is already used in the past. To put this in layman terms, the users can’t use the same password again. + +To do so, edit**/etc/pam.d/common-password** file: + +``` +$ sudo nano /etc/pam.d/common-password +``` + +Find the following line and add the word **‘remember=5’** at the end: + +``` +password        [success=2 default=ignore]      pam_unix.so obscure use_authtok try_first_pass sha512 remember=5 +``` + +The above policy will prevent the users to use the last 5 used passwords. + +### Forbid previously used passwords in RPM based systems + +This is same for both RHEL 6.x and RHEL 7.x and it’s clone systems like CentOS, Scientific Linux. + +Edit **/etc/pam.d/system-auth** file as root user, + +``` +# vi /etc/pam.d/system-auth +``` + +Find the following line, and add **remember=5** at the end. + +``` +password     sufficient     pam_unix.so sha512 shadow nullok try_first_pass use_authtok remember=5 +``` + +You know now what is password policies in Linux, and how to set different password policies in DEB and RPM based systems. + +That’s all for now. I will be here soon with another interesting and useful article. Until then stay tuned with OSTechNix. If you find this tutorial helpful, share it on your social, professional networks and support us. + +Cheers! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-set-password-policies-in-linux/ + +作者:[SK][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: http://www.ostechnix.com/wp-content/uploads/2016/03/sk@sk-_003-2-1.jpg From a7a717f3d00e5bfdfa8365cba2f79df76b65caab Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 14 Mar 2019 12:15:21 +0800 Subject: [PATCH 250/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190307=20Small?= =?UTF-8?q?=20Scale=20Scrum=20vs.=20Large=20Scale=20Scrum=20sources/talk/2?= =?UTF-8?q?0190307=20Small=20Scale=20Scrum=20vs.=20Large=20Scale=20Scrum.m?= =?UTF-8?q?d?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Small Scale Scrum vs. Large Scale Scrum.md | 106 ++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 sources/talk/20190307 Small Scale Scrum vs. Large Scale Scrum.md diff --git a/sources/talk/20190307 Small Scale Scrum vs. Large Scale Scrum.md b/sources/talk/20190307 Small Scale Scrum vs. Large Scale Scrum.md new file mode 100644 index 0000000000..7da83306a5 --- /dev/null +++ b/sources/talk/20190307 Small Scale Scrum vs. Large Scale Scrum.md @@ -0,0 +1,106 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Small Scale Scrum vs. Large Scale Scrum) +[#]: via: (https://opensource.com/article/19/3/small-scale-scrum-vs-large-scale-scrum) +[#]: author: (Agnieszka Gancarczyk https://opensource.com/users/agagancarczyk) + +Small Scale Scrum vs. Large Scale Scrum +====== +We surveyed individual members of small and large scrum teams. Here are some key findings. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_crowdvsopen.png?itok=AFjno_8v) + +Following the publication of the [Small Scale Scrum framework][1], we wanted to collect feedback on how teams in our target demographic (consultants, open source developers, and students) work and what they value. With this first opportunity to inspect, adapt, and help shape the next stage of Small Scale Scrum, we decided to create a survey to capture some data points and begin to validate some of our assumptions and hypotheses. + +**[[Download the Introduction to Small Scale Scrum guide]][2]** + +Our reasons for using the survey were multifold, but chief among them were the global distribution of teams, the small local data sample available in our office, access to customers, and the industry’s utilization of surveys (e.g., the [Stack Overflow Developer Survey 2018][3], [HackerRank 2018 Developer Skills Report][4], and [GitLab 2018 Global Developer Report][5]). + +The scrum’s iterative process was used to facilitate the creation of the survey shown below: + +![](https://opensource.com/sites/default/files/uploads/survey_process.png) + +[The survey][6], which we invite you to complete, consisted of 59 questions and was distributed at a local college ([Waterford Institute of Technology][7]) and to Red Hat's consultancy and engineering teams. Our initial data was gathered from the responses of 54 individuals spread across small and large scrum teams, who were asked about their experiences with agile within their teams. + +Here are the main results and initial findings of the survey: + + * A full 96% of survey participants practice a form of agile, work in distributed teams, think scrum principles help them reduce development complexity, and believe agile contributes to the success of their projects. + + * Only 8% of survey participants belong to small (one- to three-person) teams, and 10 out of 51 describe their typical project as short-lived (three months or less). + + * The majority of survey participants were software engineers, but quality engineers (QE), project managers (PM), product owners (PO), and scrum masters were also represented. + + * Scrum master, PO, and team member are typical roles in projects. + + * Nearly half of survey respondents work on, or are assigned to, more than one project at the same time. + + * Almost half of projects are customer/value-generating vs. improvement/not directly value-generating or unclassified. + + * Almost half of survey participants said that their work is clarified sometimes or most of the time and estimated before development with extensions available sometimes or most of the time. They said asking for clarification of work items is the team’s responsibility. + + * Almost half of survey respondents said they write tests for their code, and they adhere to best coding practices, document their code, and get their code reviewed before merging. + + * Almost all survey participants introduce bugs to the codebase, which are prioritized by them, the team, PM, PO, team lead, or the scrum master. + + * Participants ask for help and mentoring when a task is complex. They also take on additional roles on their projects when needed, including business analyst, PM, QE, and architect, and they sometimes find changing roles difficult. + + * When changing roles on a daily basis, individuals feel they lose one to two hours on average, but they still complete their work on time most of the time. + + * Most survey participants use scrum (65%), followed by hybrid (18%) and Kanban (12%). This is consistent with results of [VersionOne’s State of Agile Report][8]. + + * The daily standup, sprint, sprint planning and estimating, backlog grooming, and sprint retrospective are among the top scrum ceremonies and principles followed, and team members do preparation work before meetings. + + * The majority of sprints (62%) are three weeks long, followed by two-week sprints (26%), one-week sprints (6%), and four-week sprints (4%). Two percent of participants are not using sprints due to strict release and update timings, with all activities organized and planned around those dates. + + * Teams use [planning poker][9] to estimate (storypoint) user stories. User stories contain acceptance criteria. + + * Teams create and use a [Definition of Done][10] mainly in respect to features and determining completion of user stories. + + * The majority of teams don’t have or use a [Definition of Ready][11] to ensure that user stories are actionable, testable, and clear. + + * Unit, integration, functional, automated, performance/load, and acceptance tests are commonly used. + + * Overall collaboration between team members is considered high, and team members use various communication channels. + + * The majority of survey participants spend more than four hours weekly in meetings, including face-to-face meetings, web conferences, and email communication. + + * The majority of customers are considered large, and half of them understand and follow scrum principles. + + * Customers respect “no deadlines” most of the time and sometimes help create user stories and participate in sprint planning, sprint review and demonstration, sprint retrospective, and backlog review and refinement. + + * Only 27% of survey participants know their customers have a high level of satisfaction with the adoption of agile, while the majority (58%) don’t know this information at all. + + + + +These survey results will inform the next stage of our data-gathering exercise. We will apply Small Scale Scrum to real-world projects, and the guidance obtained from the survey will help us gather key data points as we move toward version 2.0 of Small Scale Scrum. If you want to help, take our [survey][6]. If you have a project to which you'd like to apply Small Scale Scrum, please get in touch. + +[Download the Introduction to Small Scale Scrum guide][2] + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/small-scale-scrum-vs-large-scale-scrum + +作者:[Agnieszka Gancarczyk][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/agagancarczyk +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/19/2/small-scale-scrum-framework +[2]: https://opensource.com/downloads/small-scale-scrum +[3]: https://insights.stackoverflow.com/survey/2018/ +[4]: https://research.hackerrank.com/developer-skills/2018/ +[5]: https://about.gitlab.com/developer-survey/2018/ +[6]: https://docs.google.com/forms/d/e/1FAIpQLScAXf52KMEiEzS68OOIsjLtwZJto_XT7A3b9aB0RhasnE_dEw/viewform?c=0&w=1 +[7]: https://www.wit.ie/ +[8]: https://explore.versionone.com/state-of-agile/versionone-12th-annual-state-of-agile-report +[9]: https://en.wikipedia.org/wiki/Planning_poker +[10]: https://www.scruminc.com/definition-of-done/ +[11]: https://www.scruminc.com/definition-of-ready/ From b4d37cb2cc442f0eeb94878ffb2273129e09fb85 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 14 Mar 2019 12:17:48 +0800 Subject: [PATCH 251/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190307=2013=20o?= =?UTF-8?q?pen=20source=20backup=20solutions=20sources/tech/20190307=2013?= =?UTF-8?q?=20open=20source=20backup=20solutions.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0190307 13 open source backup solutions.md | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 sources/tech/20190307 13 open source backup solutions.md diff --git a/sources/tech/20190307 13 open source backup solutions.md b/sources/tech/20190307 13 open source backup solutions.md new file mode 100644 index 0000000000..86c5547e8b --- /dev/null +++ b/sources/tech/20190307 13 open source backup solutions.md @@ -0,0 +1,72 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (13 open source backup solutions) +[#]: via: (https://opensource.com/article/19/3/backup-solutions) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +13 open source backup solutions +====== +Readers suggest more than a dozen of their favorite solutions for protecting data. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/server_data_system_admin.png?itok=q6HCfNQ8) + +Recently, we published a [poll][1] that asked readers to vote on their favorite open source backup solution. We offered six solutions recommended by our [moderator community][2]—Cronopete, Deja Dup, Rclone, Rdiff-backup, Restic, and Rsync—and invited readers to share other options in the comments. And you came through, offering 13 other solutions (so far) that we either hadn't considered or hadn't even heard of. + +By far the most popular suggestion was [BorgBackup][3]. It is a deduplicating backup solution that features compression and encryption. It is supported on Linux, MacOS, and BSD and has a BSD License. + +Second was [UrBackup][4], which does full and incremental image and file backups; you can save whole partitions or single directories. It has clients for Windows, Linux, and MacOS and has a GNU Affero Public License. + +Third was [LuckyBackup][5]; according to its website, "it is simple to use, fast (transfers over only changes made and not all data), safe (keeps your data safe by checking all declared directories before proceeding in any data manipulation), reliable, and fully customizable." It carries a GNU Public License. + +[Casync][6] is content-addressable synchronization—it's designed for backup and synchronizing and stores and retrieves multiple related versions of large file systems. It is licensed with the GNU Lesser Public License. + +[Syncthing][7] synchronizes files between two computers. It is licensed with the Mozilla Public License and, according to its website, is secure and private. It works on MacOS, Windows, Linux, FreeBSD, Solaris, and OpenBSD. + +[Duplicati][8] is a free backup solution that works on Windows, MacOS, and Linux and a variety of standard protocols, such as FTP, SSH, and WebDAV, and cloud services. It features strong encryption and is licensed with the GPL. + +[Dirvish][9] is a disk-based virtual image backup system licensed under OSL-3.0. It also requires Rsync, Perl5, and SSH to be installed. + +[Bacula][10]'s website says it "is a set of computer programs that permits the system administrator to manage backup, recovery, and verification of computer data across a network of computers of different kinds." It is supported on Linux, FreeBSD, Windows, MacOS, OpenBSD, and Solaris and the bulk of its source code is licensed under AGPLv3. + +[BackupPC][11] "is a high-performance, enterprise-grade system for backing up Linux, Windows, and MacOS PCs and laptops to a server's disk," according to its website. It is licensed under the GPLv3. + +[Amanda][12] is a backup system written in C and Perl that allows a system administrator to back up an entire network of client machines to a single server using tape, disk, or cloud-based systems. It was developed and copyrighted in 1991 at the University of Maryland and has a BSD-style license. + +[Back in Time][13] is a simple backup utility designed for Linux. It provides a command line client and a GUI, both written in Python. To do a backup, just specify where to store snapshots, what folders to back up, and the frequency of the backups. BackInTime is licensed with GPLv2. + +[Timeshift][14] is a backup utility for Linux that is similar to System Restore for Windows and Time Capsule for MacOS. According to its GitHub repository, "Timeshift protects your system by taking incremental snapshots of the file system at regular intervals. These snapshots can be restored at a later date to undo all changes to the system." + +[Kup][15] is a backup solution that was created to help users back up their files to a USB drive, but it can also be used to perform network backups. According to its GitHub repository, "When you plug in your external hard drive, Kup will automatically start copying your latest changes." + +Thanks for sharing your favorite open source backup solutions in our poll! If there are still others that haven't been mentioned yet, please share them in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/backup-solutions + +作者:[Don Watkins][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/don-watkins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/19/2/linux-backup-solutions +[2]: https://opensource.com/opensourcecom-team +[3]: https://www.borgbackup.org/ +[4]: https://www.urbackup.org/ +[5]: http://luckybackup.sourceforge.net/ +[6]: http://0pointer.net/blog/casync-a-tool-for-distributing-file-system-images.html +[7]: https://syncthing.net/ +[8]: https://www.duplicati.com/ +[9]: http://dirvish.org/ +[10]: https://www.bacula.org/ +[11]: https://backuppc.github.io/backuppc/ +[12]: http://www.amanda.org/ +[13]: https://github.com/bit-team/backintime +[14]: https://github.com/teejee2008/timeshift +[15]: https://github.com/spersson/Kup From 6194ac3348dbdf653226b22ab3ff794702dc8e32 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 14 Mar 2019 12:48:16 +0800 Subject: [PATCH 252/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190307=20How=20?= =?UTF-8?q?to=20Restart=20a=20Network=20in=20Ubuntu=20[Beginner=E2=80=99s?= =?UTF-8?q?=20Tip]=20sources/tech/20190307=20How=20to=20Restart=20a=20Netw?= =?UTF-8?q?ork=20in=20Ubuntu=20-Beginner-s=20Tip.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...art a Network in Ubuntu -Beginner-s Tip.md | 208 ++++++++++++++++++ 1 file changed, 208 insertions(+) create mode 100644 sources/tech/20190307 How to Restart a Network in Ubuntu -Beginner-s Tip.md diff --git a/sources/tech/20190307 How to Restart a Network in Ubuntu -Beginner-s Tip.md b/sources/tech/20190307 How to Restart a Network in Ubuntu -Beginner-s Tip.md new file mode 100644 index 0000000000..44d5531d83 --- /dev/null +++ b/sources/tech/20190307 How to Restart a Network in Ubuntu -Beginner-s Tip.md @@ -0,0 +1,208 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Restart a Network in Ubuntu [Beginner’s Tip]) +[#]: via: (https://itsfoss.com/restart-network-ubuntu) +[#]: author: (Sergiu https://itsfoss.com/author/sergiu/) + +How to Restart a Network in Ubuntu [Beginner’s Tip] +====== + +You’re [using an Ubuntu-based system and you just can’t seem to connect to your network][1]? You’d be surprised how many problems can a simple restart fix. + +In this article, I’ll go over multiple ways you can restart network in Ubuntu and other Linux distributions, so you can use whatever suits your needs. The methods are basically divided into two parts: + +![Ubuntu Restart Network][2] + +### Restart network in Ubuntu using command line + +If you are using Ubuntu server edition, you are already in the terminal. If you are using the desktop edition, you can access the terminal using Ctrl+Alt+T [keyboard shortcut in Ubuntu][3]. + +Now you have several commands at your disposal to restart network in Ubuntu. Some (or perhaps most) commands mentioned here should be applicable for restarting network in Debian and other Linux distributions as well. + +#### 1\. network manager service + +This is the easiest way to restart your network using the command line. It’s equivalent to the graphical way of doing it (restarts the Network-Manager service). + +``` +sudo service network-manager restart +``` + +The network icon should disappear for a moment and then reappear. + +#### 2\. systemd + +The **service** command is just a wrapper for this method (and also for init.d scripts and Upstart commands). The **systemctl** command is much more versatile than **service**. This is what I usually prefer. + +``` +sudo systemctl restart NetworkManager.service +``` + +The network icon (again) should disappear for a moment. To check out other **systemctl** options, you can refer to its man page. + +#### 3\. nmcli + +This is yet another tool for handling networks on a Linux machine. It is a pretty powerful tool that I find very practical. Many sysadmins prefer it since it is easy to use. + +There are two steps to this method: turning the network off, and then turning it back on. + +``` +sudo nmcli networking off +``` + +The network will shut down and the icon will disappear. To turn it back on: + +``` +sudo nmcli networking on +``` + +You can check out the man page of nmcli for more options. + +#### 4\. ifup & ifdown + +This commands handle a network interface directly, changing it’s state to one in which it either can or can not transmit and receive data. It’s one of the [must know networking commands in Linux][4]. + +To shut down all network interfaces, use ifdown and then use ifup to turn all network interfaces back on. + +A good practice would be to combine both of these commands: + +``` +sudo ifdown -a && sudo ifup -a +``` + +**Note:** This method will not make the network icon in your systray disappear, and yet you won’t be able to have a connection of any sort. + +**Bonus tool: nmtui (click to expand)** + +This is another method often used by system administrators. It is a text menu for managing networks right in your terminal. + +``` +nmtui +``` + +This should open up the following menu: + +![nmtui Menu][5] + +**Note** that in **nmtui** , you can select another option by using the **up** and **down arrow keys**. + +Select **Activate a connection** : + +![nmtui Menu Select "Activate a connection"][6] + +Press **Enter**. This should now open the **connections** menu. + +![nmtui Connections Menu][7] + +Here, go ahead and select the network with a **star (*)** next to it. In my case, it’s MGEO72. + +![Select your connection in the nmtui connections menu.][8] + +Press **Enter**. This should **deactivate** your connection. + +![nmtui Connections Menu with no active connection][9] + +Select the connection you want to activate: + +![Select the connection you want in the nmtui connections menu.][10] + +Press **Enter**. This should reactivate the selected connection. + +![nmtui Connections Menu][11] + +Press **Tab** twice to select **Back** : + +![Select "Back" in the nmtui connections menu.][12] + +Press **Enter**. This should bring you back to the **nmtui** main menu. + +![nmtui Main Menu][13] + +Select **Quit** : + +![nmtui Quit Main Menu][14] + +This should exit the application and bring you back to your terminal. + +That’s it! You have successfully restarted your network + +### Restart network in Ubuntu graphically + +This is, of course, the easiest way of restarting the network for Ubuntu desktop users. If this one doesn’t work, you can of course check the command line options mentioned in the previous section. + +NM-applet is the system tray applet indicator for [NetworkManager][15]. That’s what we’re going to use to restart our network. + +First of all, check out your top panel. You should find a network icon in your system tray (in my case, it is a Wi-Fi icon, since that’s what I use). + +Go ahead and click on that icon (or the sound or battery icon). This will open up the menu. Select “Turn Off” here. + +![Restart network in Ubuntu][16]Turn off your network + +The network icon should now disappear from the top panel. This means the network has been successfully turned off. + +Click again on your systray to reopen the menu. Select “Turn On”. + +![Restarting network in Ubuntu][17]Turn the network back on + +Congratulations! You have now restarted your network. + +#### Bonus Tip: Refresh available network list + +Suppose you are connected to a network already but you want to connect to another network. How do you refresh the WiFi to see what other networks are available? Let me show you that. + +Ubuntu doesn’t have a ‘refresh wifi networks’ option directly. It’s sort of hidden. + +You’ll have to open the setting menu again and this time, click on “Select Network”. + +![Refresh wifi network list in Ubuntu][18]Select Network to change your WiFi connection + +Now, you won’t see the list of available wireless networks immediately. When you open the networks list, it takes around 5 seconds to refresh and show up other available wireless networks. + +![Select another wifi network in Ubuntu][19]Wait for around 5- seconds to see other available networks + +And here, you can select the network of your choice and click connect. That’s it. + +**Wrapping Up** + +Restarting your network or connection is something that every Linux user has to go through at some point in their experience. + +We hope that we helped you with plenty of methods for handling such issues! + +What do you use to restart/handle your network? Is there something we missed? Leave us a comment below. + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/restart-network-ubuntu + +作者:[Sergiu][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/sergiu/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/fix-no-wireless-network-ubuntu/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/ubuntu-restart-network.png?resize=800%2C450&ssl=1 +[3]: https://itsfoss.com/ubuntu-shortcuts/ +[4]: https://itsfoss.com/basic-linux-networking-commands/ +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/nmtui_menu.png?fit=800%2C602&ssl=1 +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/nmtui_menu_select_option.png?fit=800%2C579&ssl=1 +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/nmui_connection_menu_on.png?fit=800%2C585&ssl=1 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/nmui_select_connection_on.png?fit=800%2C576&ssl=1 +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/nmui_connection_menu_off.png?fit=800%2C572&ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/nmui_select_connection_off.png?fit=800%2C566&ssl=1 +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/nmui_connection_menu_on-1.png?fit=800%2C585&ssl=1 +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/nmui_connection_menu_back.png?fit=800%2C585&ssl=1 +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/nmtui_menu_select_option-1.png?fit=800%2C579&ssl=1 +[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/nmui_menu_quit.png?fit=800%2C580&ssl=1 +[15]: https://wiki.gnome.org/Projects/NetworkManager +[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/restart-network-ubuntu-1.jpg?resize=800%2C400&ssl=1 +[17]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/restart-network-ubuntu-2.jpg?resize=800%2C400&ssl=1 +[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/select-wifi-network-ubuntu.jpg?resize=800%2C400&ssl=1 +[19]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/select-wifi-network-ubuntu-1.jpg?resize=800%2C400&ssl=1 +[20]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/ubuntu-restart-network.png?fit=800%2C450&ssl=1 From b60368e283b1f88cf46675893ee4ed477f0951ee Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 14 Mar 2019 12:49:19 +0800 Subject: [PATCH 253/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190306=20How=20?= =?UTF-8?q?to=20pack=20an=20IT=20travel=20kit=20sources/talk/20190306=20Ho?= =?UTF-8?q?w=20to=20pack=20an=20IT=20travel=20kit.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20190306 How to pack an IT travel kit.md | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 sources/talk/20190306 How to pack an IT travel kit.md diff --git a/sources/talk/20190306 How to pack an IT travel kit.md b/sources/talk/20190306 How to pack an IT travel kit.md new file mode 100644 index 0000000000..b05ee460b7 --- /dev/null +++ b/sources/talk/20190306 How to pack an IT travel kit.md @@ -0,0 +1,100 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to pack an IT travel kit) +[#]: via: (https://opensource.com/article/19/3/it-toolkit-remote) +[#]: author: (Peter Cheer https://opensource.com/users/petercheer) + +How to pack an IT travel kit +====== +Before you travel, make sure you're ready for challenges in hardware, infrastructure, and software. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tools_sysadmin_cloud.png?itok=sUciG0Cn) + +I've had several opportunities to do IT work in less-developed and remote areas, where internet coverage and technology access aren't at the high level we have in our first-world cities. Many people heading off to undeveloped areas ask me for advice on preparing for the local technology landscape. Since conditions vary greatly around this big world, it's impossible to give specific advice for most areas, but I do have some general suggestions based on my experience that may help you. + +Also, before you leave home, do as much research as you can about the general IT and telecom environment where you are traveling so you're a little better prepared for what you may encounter there. + +### Planning for the local hardware and infrastructure + + * Even in many cities, internet connections tend to be expensive, slow, and not reliable for large downloads. Don't forget that internet coverage, speeds, and cost in cities are unlikely to be matched in more remote areas. + + + * The electricity supply may be unreliable with inconsistent voltage. If you are taking your computer, bring some surge protection—although in my experience, the electricity voltage is more likely to drop than to spike. + + + * It is always useful to have a small selection of hand tools, such as screwdrivers and needle-nose pliers, for repairing computer hardware. A lack of spare parts can limit opportunities for much beyond basic troubleshooting, although stripping usable components from dead computers can be worthwhile. + + + +### Planning for the software you'll find + + * You can assume that most of the computer systems you'll find will be some incarnation of Microsoft Windows. You can expect that many will not be officially licensed, not be getting updates nor security patches, and are infected by multiple viruses and other malware. + + + * You can also expect that most application software will be proprietary and much of it will be unlicensed and lag behind the latest release versions. These conditions are depressing for open source enthusiasts, but this is the world as it is, rather than the world we would like it to be. + + + * It is wise to view any Windows system you do not control as potentially infected with viruses and malware. It's good practice to reserve a USB thumb drive for files you'll use with these Windows systems; this means that if (or more likely when) that thumb drive becomes infected, you can just reformat it at no cost. + + + * Bring copies of free antivirus software such as [AVG][1] and [Avast][2], including recent virus definition files for them, as well as virus removal and repair tools such as [Sophos][3] and [Hirens Boot CD][4]. + + + * Trying to keep software current on machines that have no or infrequent access to the internet is a challenge. This is particularly true with web browsers, which tend to go through rapid release cycles. My preferred web browser is Mozilla Firefox and having a copy of the latest release is useful. + + + * Bring repair discs for a selection of recent Microsoft operating systems, and make sure that includes service packs for Windows and Microsoft Office. + + + +### Planning for the software you'll bring + +There's no better way to convey the advantages of open source software than by showing it to people. Here are some recommendations along that line. + + * When gathering software to take with you, make sure you get the full offline installation option. Often, the most prominently displayed download links on websites are stubs that require internet access to download the components. They won't work if you're in an area with poor (or no) internet service. + + + * Also, make sure to get the 32-bit and 64-bit versions of the software. While 32-bit machines are becoming less common, you may encounter them and it's best to be prepared. + + + * Having a [bootable version of Linux][5] is vital for two reasons. First, it can be used to rescue data from a seriously damaged Windows machine. Second, it's an easy way to show off Linux without installing it on someone's machine. [Linux Mint][6] is my favorite distro for this purpose, because the graphical interface (GUI) is similar enough to Windows to appear non-threatening and it includes a good range of application software. + + + * Bring the widest selection of open source applications you can—you can't count on being able to download something from the internet. + + + * When possible, bring your open source software library as portable applications that will run without installing them. One of the many ways to mess up those Windows machines is to install and uninstall a lot of software, and using portable apps gets around this problem. Many open source applications, including Libre Office, GIMP, Blender, and Inkscape, have portable app versions for Windows. + + + * It's smart to bring a supply of blank disks so you can give away copies of your open source software stash on media that is a bit more secure than a USB thumb drive. + + + * Don't forget to bring programs and resources related to projects you will be working on. (For example, most of my overseas work involves tuition, mentoring, and skills transfer, so I usually add a selection of open source software tools for creating learning resources.) + + + +### Your turn + +There are many variables and surprises when doing IT work in undeveloped areas. If you have suggestions—for programs I've missed or tips that I didn't cover—please share them in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/it-toolkit-remote + +作者:[Peter Cheer][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/petercheer +[b]: https://github.com/lujun9972 +[1]: https://www.avg.com/en-gb/free-antivirus-download +[2]: https://www.avast.com/en-gb/free-antivirus-download +[3]: https://www.sophos.com/en-us/products/free-tools/virus-removal-tool.aspx +[4]: https://www.hiren.info/ +[5]: https://opensource.com/article/18/7/getting-started-etcherio +[6]: https://linuxmint.com/ From 2e8694207d205c6fb6a81f1e0c0a9563136dabc0 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 14 Mar 2019 12:54:20 +0800 Subject: [PATCH 254/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190306=20Get=20?= =?UTF-8?q?cooking=20with=20GNOME=20Recipes=20on=20Fedora=20sources/tech/2?= =?UTF-8?q?0190306=20Get=20cooking=20with=20GNOME=20Recipes=20on=20Fedora.?= =?UTF-8?q?md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...et cooking with GNOME Recipes on Fedora.md | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 sources/tech/20190306 Get cooking with GNOME Recipes on Fedora.md diff --git a/sources/tech/20190306 Get cooking with GNOME Recipes on Fedora.md b/sources/tech/20190306 Get cooking with GNOME Recipes on Fedora.md new file mode 100644 index 0000000000..0c2eabdcdf --- /dev/null +++ b/sources/tech/20190306 Get cooking with GNOME Recipes on Fedora.md @@ -0,0 +1,64 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get cooking with GNOME Recipes on Fedora) +[#]: via: (https://fedoramagazine.org/get-cooking-with-gnome-recipes-on-fedora/) +[#]: author: (Ryan Lerch https://fedoramagazine.org/introducing-flatpak/) + +Get cooking with GNOME Recipes on Fedora +====== +![](https://fedoramagazine.org/wp-content/uploads/2019/03/gnome-recipes-816x345.jpg) + +Do you love to cook? Looking for a better way to manage your recipes using Fedora? GNOME Recipes is an awesome application available to install in Fedora to store and organize your recipe collection. + +![][1] + +GNOME Recipes is an recipe management tool from the GNOME project. It has the visual style of a modern GNOME style application, and feels similar to GNOME Software, but for food. + +### Installing GNOME Recipes + +Recipes is available to install from the 3rd party Flathub repositories. If you have never installed an application from Flathub before, set it up using the following guide: + +[Install Flathub apps on Fedora](https://fedoramagazine.org/install-flathub-apps-fedora/) + +After correctly setting up Flathub as a software source, you will be able to search for and install Recipes via GNOME Software. + +### Recipe management + +Recipes allows you to manually add your own collection of recipes, including photos, ingredients, directions, as well as extra metadata like preparation time, cuisine style, and spiciness. + +![][2] + +When entering in a new item, GNOME Recipes there are a range of different measurement units to choose from, as well as special tags for items like temperature, allowing you to easily switch units. + +### Community recipes + +In addition to manually entering in your favourite dishes for your own use, it also allows you to find, use, and contribute recipes to the community. Additionally, you can mark your favourites, and search the collection by the myriad of metadata available for each recipe. + +![][3] + +### Step by step guidance + +One of the awesome little features in GNOME Recipes is the step by step fullscreen mode. When you are ready to cook, simply activate this mode, move you laptop to the kitchen, and you will have a full screen display of the current step in the cooking method. Futhermore, you can set up the recipes to have timers displayed on this mode when something is in the oven. + +![][4] + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/get-cooking-with-gnome-recipes-on-fedora/ + +作者:[Ryan Lerch][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/introducing-flatpak/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/03/Screenshot-from-2019-03-06-19-45-06-1024x727.png +[2]: https://fedoramagazine.org/wp-content/uploads/2019/03/gnome-recipes1-1024x727.png +[3]: https://fedoramagazine.org/wp-content/uploads/2019/03/Screenshot-from-2019-03-06-20-08-45-1024x725.png +[4]: https://fedoramagazine.org/wp-content/uploads/2019/03/Screenshot-from-2019-03-06-20-39-44-1024x640.png From 1139a896112a166e247a2c5fb6c04de6bd4d5c74 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 14 Mar 2019 12:55:37 +0800 Subject: [PATCH 255/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190301=20Blockc?= =?UTF-8?q?hain=202.0:=20An=20Introduction=20[Part=201]=20sources/tech/201?= =?UTF-8?q?90301=20Blockchain=202.0-=20An=20Introduction=20-Part=201.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Blockchain 2.0- An Introduction -Part 1.md | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 sources/tech/20190301 Blockchain 2.0- An Introduction -Part 1.md diff --git a/sources/tech/20190301 Blockchain 2.0- An Introduction -Part 1.md b/sources/tech/20190301 Blockchain 2.0- An Introduction -Part 1.md new file mode 100644 index 0000000000..e8922aa789 --- /dev/null +++ b/sources/tech/20190301 Blockchain 2.0- An Introduction -Part 1.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Blockchain 2.0: An Introduction [Part 1]) +[#]: via: (https://www.ostechnix.com/blockchain-2-0-an-introduction/) +[#]: author: (EDITOR https://www.ostechnix.com/author/editor/) + +Blockchain 2.0: An Introduction [Part 1] +====== + +![](https://www.ostechnix.com/wp-content/uploads/2019/03/blockchain-introduction-720x340.png) + +### Blockchain 2.0 – The next paradigm of computing + +The **Blockchain** is now easily distinguishable as a transformational technology poised to bring in revolutionary changes in the way people use the internet. The present series of posts will explore the upcoming wave of Blockchain 2.0 based technologies and applications. The Blockchain is here to stay as evidenced by the tremendous interest in it shown by different stakeholders. + +Staying on top of what it is and how it works is paramount to anyone who plans on using the internet for literally anything. Even if all you do is just stare at your friends’ morning breakfast pics on Instagram or looking for the next best clip to watch, you need to know what this technology can do to all of that. + +Even though the basic concept behind the Blockchain was first talked about in academia in the **1990s** , its prominence to being a trending buzzword among netizens is owed to the rise of payment platforms such as **Bitcoins** and **Ethers**. + +Bitcoin started off as a decentralized digital currency. Its advent meant that you could basically pay people over the internet being totally anonymous, safe and secure. What lay beneath the simple financial token system that was bitcoin though was the BLOCKCHAIN. You can think of Bitcoin technology or any cryptocurrency for that matter as being built up from 3 layers. There’s the foundational Blockchain tech that verifies, records and confirms transactions, on top of the foundation rests the protocol, basically, a rule or an online etiquette to honor, record and confirm transactions and of course, on top of it all is the cryptocurrency token commonly called Bitcoin. A token is generated by the Blockchain once a transaction respecting the protocol is recorded on it. + +While most people only saw the top layer, the coins or tokens being representative of what bitcoin really was, few ventured deep enough to understand that financial transactions were just one of many such possibilities that could be accomplished with the help of the Blockchain foundation. These possibilities are now being explored to generate and develop new standards for decentralizing all manners of transactions. + +At its very basic level, the Blockchain can be thought of as an all-encompassing ledger of records and transactions. This in effect means that all kinds of records can theoretically be handled by the Blockchain. Developments in this area will possibly in the future result in all kinds of hard (Such as real estate deeds, physical keys, etc.) and soft intangible assets (Such as identity records, patents, trademarks, reservations etc.) can be encoded as digital assets to be protected and transferred via the blockchain. + +For the uninitiated, transactions on the Blockchain are inherently thought of and designed to be unbiased, permanent records. This is possible because of a **“consensus system”** that is built into the protocol. All transactions are confirmed, vetted and recorded by the participants of the system, in the case of the Bitcoin cryptocurrency platform, this role is taken care of by **miners** and exchanges. This can vary from platform to platform or from blockchain to blockchain. The protocol stack on which the platform is built is by definition supposed to be open-source and free for anyone with the technical know-how to verify. Transparency is woven into the system unlike much of the other platforms that the internet currently runs on. + +Once transactions are recorded and coded into the Blockchain, they will be seen through. Participants are bound to honor their transactions and contracts the way they were originally intended to be executed. The execution itself will be automatically taken care of by the platform since it’s hardcoded into it, unless of course if the original terms forbid it. This resilience of the Blockchain platform toward attempts of tampering with records, permanency of the records etc., are hitherto unheard of for something working over the internet. This is the added layer of trust that is often talked about while supporters of the technology claim its rising significance. + +These features are not recently discovered hidden potentials of the platform, these were envisioned from the start. In a communique, **Satoshi Nakamoto** , the fabled creator(s) of Bitcoin mentioned, **“the design supports a tremendous variety of possible transaction types that I designed years ago… If Bitcoin catches on in a big way, these are things we’ll want to explore in the future… but they all had to be designed at the beginning to make sure they would be possible later.”**. Cementing the fact that these features are designed and baked into the already existing protocols. The key idea being that the decentralized transaction ledger like the functionality of the Blockchain could be used to transfer, deploy and execute all manner of contracts. + +Leading institutions are currently exploring the possibility of re-inventing financial instruments such as stocks, pensions, and derivatives, while governments all over the world are concerned more with the tamper-proof permanent record keeping potential of the Blockchain. Supporters of the platform claim that once development reaches a critical threshold, everything from your hotel key cards to copyrights and patents will from then on be recorded and implemented via the use of Blockchains. + +An almost full list of items and particulars that could theoretically be implemented via a Blockchain model is compiled and maintained on [**this**][1] page by **Ledra Capital**. A thought experiment to actually realize how much of our lives the Blockchain might effect is a daunting task, but a look at that list will reiterate the importance of doing so. + +Now, all of the bureaucratic and commercial uses mentioned above might lead you to believe that a technology such as this will be solely in the domain of Governments and Large private corporations. However, the truth is far from that. Given the fact that the vast potentials of the system make it attractive for such uses, there are other possibilities and features harbored by Blockchains. There are other more intricate concepts related to the technology such as **DApps** , **DAOs** , **DACs** , **DASs** etc., more of which will be covered in depth in this series of articles. + +Basically, development is going on in full swing and its early for anyone to comment on definitions, standards, and capabilities of such Blockchain based systems for a wider roll-out, but the possibilities and its imminent effects are doubtless. There are even talks about Blockchain based smartphones and polling during elections. + +This was just a brief birds-eye view of what the platform is capable of. We’ll look at the distinct possibilities through a series of such detailed posts and articles. Keep an eye out for the [**next post of the series**][2], which will explore how the Blockchain is revolutionizing transactions and contracts. + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/blockchain-2-0-an-introduction/ + +作者:[EDITOR][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/editor/ +[b]: https://github.com/lujun9972 +[1]: http://ledracapital.com/blog/2014/3/11/bitcoin-series-24-the-mega-master-blockchain-list +[2]: https://www.ostechnix.com/blockchain-2-0-revolutionizing-the-financial-system/ From 640b5249da7b407ca64ecc902e57f2125b1733c6 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 14 Mar 2019 12:56:41 +0800 Subject: [PATCH 256/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190306=20Blockc?= =?UTF-8?q?hain=202.0:=20Revolutionizing=20The=20Financial=20System=20[Par?= =?UTF-8?q?t=202]=20sources/tech/20190306=20Blockchain=202.0-=20Revolution?= =?UTF-8?q?izing=20The=20Financial=20System=20-Part=202.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...utionizing The Financial System -Part 2.md | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 sources/tech/20190306 Blockchain 2.0- Revolutionizing The Financial System -Part 2.md diff --git a/sources/tech/20190306 Blockchain 2.0- Revolutionizing The Financial System -Part 2.md b/sources/tech/20190306 Blockchain 2.0- Revolutionizing The Financial System -Part 2.md new file mode 100644 index 0000000000..59389e2ca3 --- /dev/null +++ b/sources/tech/20190306 Blockchain 2.0- Revolutionizing The Financial System -Part 2.md @@ -0,0 +1,52 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Blockchain 2.0: Revolutionizing The Financial System [Part 2]) +[#]: via: (https://www.ostechnix.com/blockchain-2-0-revolutionizing-the-financial-system/) +[#]: author: (EDITOR https://www.ostechnix.com/author/editor/) + +Blockchain 2.0: Revolutionizing The Financial System [Part 2] +====== + +This is the second part of our [**Blockchain 2.0**][1] series. The blockchain can transform how individuals and institutions deal with their finances. This post looks at how the existing monetary system evolved and how new blockchain systems are bringing in change as the next crucial step in the evolution of money. + +Two key ideas will lay the foundation for this article. **PayPal** , when it was launched, was revolutionary in terms of its operation. The company would gather, process and confirm massive amounts of consumer data to facilitate online transactions of all kinds, virtually allowing platforms such as eBay to grow into trustful sources for commerce, and laying the benchmark for digital payment systems worldwide. The second, albeit much more important key idea to be highlighted here, is a somewhat existential question. We all use money or rather currency for our day-to-day needs. A ten-dollar bill will get you a cup or two from your favorite coffee shop and get you a head start on your day for instance. We depend on our respective national currencies for virtually everything. + +Sure, mankind has come a long way since the **barter system** ruled what you ate for breakfast, but still, what exactly is currency? Who or what gives it it’s a value? And as the popular rumor suggests, does going to a bank and giving them a dollar bill actually get you the true value of whatever that currency “token” stands for? + +The answer to most of those questions doesn’t exist. If they do, they’ll to be undependably vague and subjective at best. Back in the day when civilization started off establishing small cities and towns, the local currency deemed legal by the guy who ruled over them, was almost always made of something precious to that community. Indians are thought to have transacted in peppercorns while ancient Greeks and Romans in **salt** [1]. Gradually most of these little prehistoric civilizations adopted precious metals and stones as their tokens to transact. Gold coins, silver heirlooms, and rubies became eponymous with “value”. With the industrial revolution, people started printing these tokens of transaction and we finally seemed to have found our calling in paper currencies. They were dependable and cheap to produce and as long as a nation-state guaranteed its users that the piece of paper, they were holding was just a token for an amount of “value” they had and as long as they were able to show them that this value when demanded could be supported with precious substances such as gold or hard assets, people were happy to use them. However, if you still believe that the currency note you hold in your hand right now has the same guarantee, you’re wrong. We currently live in an age where almost all the major currencies in circulation around the globe are what economists would call a **fiat currency** [2]. Value-less pieces of paper that are only backed by the guarantees of the nation-state you’re residing in. The exact nature of fiat currencies and why they may possibly be a flawed system falls into the domain of economics and we won’t get into that now. + +In fact, the only takeaway from all of this history that is relevant to this post is that civilizations started using tokens that hinted or represented value for trading goods and services rather than the non-practical barter system. Tokens. Naturally, this is the crucial concept behind cryptocurrencies as well. They don’t have any inherent value attached to them. Their value is tied to the number of people adopting that particular platform, the trust the adopters have on the system, and of course if released by a supervising entity, the background of the entity itself. The high price and market cap of **Bitcoin (BTC)** isn’t a coincidence, they were among the first in business and had a lot of early adopters. This ultimate truth behind cryptocurrencies is what makes it so important yet so unforgivingly complex to understand. It’s the natural next step in the evolution of “money”. Some understand this and some still like to think of the solid currency concept where “real” money is always backed by something of inherent value.[3] Though there have been countless debates and studies on this dilemma, there is no looking back from a blockchain powered future. + +For instance, the country of **Ecuador** made headlines in 2015 for its purported plans to develop and release **its own national cryptocurrency** [4]. Albeit the attempt officially was to aid and support their existing currency system. Since then other countries and their regulatory bodies have or are drafting up papers to control the “epidemic” that is cryptocurrency with some already having published frameworks to the extent of creating a roadmap for blockchain and crypto development. **Germany** is thought to be investing in a long term blockchain project to streamline its taxation and financial systems[5]. Banks in developing countries are joining in on something called a Bank chain, cooperating in creating a **private blockchain** to increase efficiency in and optimize their operations + +Now is when we tie both the ends of the stories together, remember the first mention of PayPal before the casual history lesson? Experts have compared Bitcoin’s (BTC) adoption rate with that of PayPal when it was launched. Initial consumer hesitation, where only a few early adopters are ready to jump into using the said product and then all a wider adoption gradually becoming a benchmark for similar platforms. Bitcoin (BTC) is already a benchmark for similar cryptocurrency platforms with major coins such as **Ethereum (ETH)** and **Ripple (XRP)** [6]. Adoption is steadily increasing, legal and regulatory frameworks being made to support it, and active research and development being done on the front as well. And not unlike PayPal, experts believe that cryptocurrencies and platforms utilizing blockchain tech for their digital infrastructure will soon become the standard norm rather than the exception. + +Although the rise in cryptocurrency prices in 2018 can be termed as an economic bubble, companies and governments have continued to invest as much or more into the development of their own blockchain platforms and financial tokens. To counteract and prevent such an incident in the future while still looking forward to investing in the area, an alternative to traditional cryptocurrencies called **stablecoins** have made the rounds recently. + +Financial behemoth **JP Morgan** came out with their own enterprise ready blockchain solution called **Quorum** handling their stablecoin called **JPM Coin** [7]. Each such JPM coin is tied to 1 USD and their value is guaranteed by the parent organization under supporting legal frameworks, in this case, JP Morgan. Platforms such as this one make it easier for large financial transactions to the tunes of millions or billions of dollars to be transferred instantaneously over the internet without having to rely on conventional banking systems such as SWIFT which involve lengthy procedures and are themselves decades old. + +In the same spirit of making the niceties of the blockchain available for everyone, The Ethereum platform allows 3rd parties to utilize their blockchain or derive from it to create and administer their own takes on the triad of the **Blockchain-protocol-token** system thereby leading to wider adoption of the standard with lesser work on its foundations. + +The blockchain allows for digital versions of existing financial instruments to be created, recorded, and traded quickly over a network without the need for third-party monitoring. The inherent safety and security features of the system makes the entire process totally safe and immune to fraud and tampering, basically the only reason why third-party monitoring was required in the sector. Another area where governmental and regulatory bodies presided over when it came to financial services and instruments were in regards to transparency and auditing. With blockchain banks and other financial institutes will be able to maintain a fully transparent, layered, almost permanent and tamper-proof record of all their transactions rendering auditing tasks near useless. Much needed developments and changes to the current financial system and services industry can be made possible by exploiting blockchains. The platform being distributed, tamper-proof, near permanent, and quick to execute is highly valuable to bankers and government regulators alike and their investments in this regard seem to be well placed[8]. + +In the next article of the series, we see how companies are using blockchains to deliver the next generation of financial services. Looking at individual firms creating ripples in the industry, we explore how the future of a blockchain backed economy would look like. + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/blockchain-2-0-revolutionizing-the-financial-system/ + +作者:[EDITOR][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/editor/ +[b]: https://github.com/lujun9972 +[1]: https://www.ostechnix.com/blockchain-2-0-an-introduction/ From 7d200791d418f4aca71b412f9ea62f66c599be8d Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 14 Mar 2019 13:00:48 +0800 Subject: [PATCH 257/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190305=20How=20?= =?UTF-8?q?rootless=20Buildah=20works:=20Building=20containers=20in=20unpr?= =?UTF-8?q?ivileged=20environments=20sources/tech/20190305=20How=20rootles?= =?UTF-8?q?s=20Buildah=20works-=20Building=20containers=20in=20unprivilege?= =?UTF-8?q?d=20environments.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...containers in unprivileged environments.md | 133 ++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 sources/tech/20190305 How rootless Buildah works- Building containers in unprivileged environments.md diff --git a/sources/tech/20190305 How rootless Buildah works- Building containers in unprivileged environments.md b/sources/tech/20190305 How rootless Buildah works- Building containers in unprivileged environments.md new file mode 100644 index 0000000000..cf046ec1b3 --- /dev/null +++ b/sources/tech/20190305 How rootless Buildah works- Building containers in unprivileged environments.md @@ -0,0 +1,133 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How rootless Buildah works: Building containers in unprivileged environments) +[#]: via: (https://opensource.com/article/19/3/tips-tricks-rootless-buildah) +[#]: author: (Daniel J Walsh https://opensource.com/users/rhatdan) + +How rootless Buildah works: Building containers in unprivileged environments +====== +Buildah is a tool and library for building Open Container Initiative (OCI) container images. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/containers_2015-1-osdc-lead.png?itok=VEB4zwza) + +In previous articles, including [How does rootless Podman work?][1], I talked about [Podman][2], a tool that enables users to manage pods, containers, and container images. + +[Buildah][3] is a tool and library for building Open Container Initiative ([OCI][4]) container images that is complementary to Podman. (Both projects are maintained by the [containers][5] organization, of which I'm a member.) In this article, I will talk about rootless Buildah, including the differences between it and Podman. + +Our goal with Buildah was to build a low-level tool that could be used either directly or vendored into other tools to build container images. + +### Why Buildah? + +Here is how I describe a container image: It is basically a rootfs directory that contains the code needed to run your container. This directory is called a rootfs because it usually looks like **/ (root)** on a Linux machine, meaning you are likely to find directories in a rootfs like **/etc** , **/usr** , **/bin** , etc. + +The second part of a container image is a JSON file that describes the contents of the rootfs. It contains fields like the command to run the container, the entrypoint, the environment variables required to run the container, the working directory of the container, etc. Basically this JSON file allows the developer of the container image to describe how the container image is expected to be used. The fields in this JSON file have been standardized in the [OCI Image Format specification][6] + +The rootfs and the JSON file then get tar'd together to create an image bundle that is stored in a container registry. To create a layered image, you install more software into the rootfs and modify the JSON file. Then you tar up the differences of the new and the old rootfs and store that in another image tarball. The second JSON file refers back to the first JSON file via a checksum. + +Many years ago, Docker introduced Dockerfile, a simplified scripting language for building container images. Dockerfile was great and really took off, but it has many shortcomings that users have complained about. For example: + + * Dockerfile encourages the inclusion of tools used to build containers inside the container image. Container images do not need to include yum/dnf/apt, but most contain one of them and all their dependencies. + + * Each line causes a layer to be created. Because of this, secrets can mistakenly get added to container images. If you create a secret in one line of the Dockerfile and delete it in the next, the secret is still in the image. + + + + +One of my biggest complaints about the "container revolution" is that six years since it started, the only way to build a container image was still with Dockerfiles. Lots of tools other than **docker build** have appeared besides Buildah, but most still deal only with Dockerfile. So users continue hacking around the problems with Dockerfile. + +Note that [umoci][7] is an alternative to **docker build** that allows you to build container images without Dockerfile. + +Our goal with Buildah was to build a simple tool that could just create a rootfs directory on disk and allow other tools to populate the directory, then create the JSON file. Finally, Buildah would create the OCI image and push it to a container registry where it could be used by any container engine, like [Docker][8], Podman, [CRI-O][9], or another Buildah. + +Buildah also supports Dockerfile, since we know the bulk of people building containers have created Dockerfiles. + +### Using Buildah directly + +Lots of people use Buildah directly. A cool feature of Buildah is that you can script up the container build directly in Bash. + +The example below creates a Bash script called **myapp.sh** , which uses Buildah to pull down the Fedora image, and then uses **dnf** and **make** on a machine to install software into the container image rootfs, **$mnt**. It then adds some fields to the JSON file using **buildah config** and commits the container to a container image **myapp**. Finally, it pushes the container image to a container registry, **quay.io**. (It could push it to any container registry.) Now this OCI image can be used by any container engine or Kubernetes. + +``` +cat myapp.sh +#!/bin/sh +ctr=$(buildah from fedora) +mnt=($buildah mount $ctr) +dnf -y install --installroot $mnt httpd +make install DESTDIR=$mnt myapp +rm -rf $mnt/var/cache $mnt/var/log/* +buildah config --command /usr/bin/myapp -env foo=bar --working-dir=/root $ctr +buildah commit $ctr myapp +buildah push myapp http://quay.io/username/myapp +``` + +To create really small images, you could replace **fedora** in the script above with **scratch** , and Buildah will build a container image that only has the requirements for the **httpd** package inside the container image. No need for Python or DNF. + +### Podman's relationship to Buildah + +With Buildah, we have a low-level tool for building container images. Buildah also provides a library for other tools to build container images. Podman was designed to replace the Docker command line interface (CLI). One of the Docker CLI commands is **docker build**. We needed to have **podman build** to support building container images with Dockerfiles. Podman vendored in the Buildah library to allow it to do **podman build**. Any time you do a **podman build** , you are executing Buildah code to build your container images. If you are only going to use Dockerfiles to build container images, we recommend you only use Podman; there's no need for Buildah at all. + +### Other tools using the Buildah library + +Podman is not the only tool to take advantage of the Buildah library. [OpenShift 4 Source-to-Image][10] (S2I) will also use Buildah to build container images. OpenShift S2I allows developers using OpenShift to use Git commands to modify source code; when they push the changes for their source code to the Git repository, OpenShift kicks off a job to compile the source changes and create a container image. It also uses Buildah under the covers to build this image. + +[Ansible-Bender][11] is a new project to build container images via an Ansible playbook. For those familiar with Ansible, Ansible-Bender makes it easy to describe the contents of the container image and then uses Buildah to package up the container image and send it to a container registry. + +We would love to see other tools and languages for describing and building a container image and would welcome others use Buildah to do the conversion. + +### Problems with rootless + +Buildah works fine in rootless mode. It uses user namespace the same way Podman does. If you execute + +``` +$ buildah bud --tag myapp -f Dockerfile . +$ buildah push myapp http://quay.io/username/myapp +``` + +in your home directory, everything works great. + +However, if you execute the script described above, it will fail! + +The problem is that, when running the **buildah mount** command in rootless mode, the **buildah** command must put itself inside the user namespace and create a new mount namespace. Rootless users are not allowed to mount filesystems when not running in a user namespace. + +When the Buildah executable exits, the user namespace and mount namespace disappear, so the mount point no longer exists. This means the commands after **buildah mount** that attempt to write to **$mnt** will fail since **$mnt** is no longer mounted. + +How can we make the script work in rootless mode? + +#### Buildah unshare + +Buildah has a special command, **buildah unshare** , that allows you to enter the user namespace. If you execute it with no commands, it will launch a shell in the user namespace, and your shell will seem like it is running as root and all the contents of the home directory will seem like they are owned by root. If you look at the owner or files in **/usr** , it will list them as owned by **nfsnobody** (or nobody). This is because your user ID (UID) is now root inside the user namespace and real root (UID=0) is not mapped into the user namespace. The kernel represents all files owned by UIDs not mapped into the user namespace as the NFSNOBODY user. When you exit the shell, you will exit the user namespace, you will be back to your normal UID, and the home directory will be owned by your UID again. + +If you want to execute the **myapp.sh** command defined above, you can execute **buildah unshare myapp.sh** and the script will now run correctly. + +#### Conclusion + +Building and running containers in unprivileged environments is now possible and quite useable. There is little reason for developers to develop containers as root. + +If you want to use a traditional container engine, and use Dockerfile's for builds, then you should probably just use Podman. But if you want to experiment with building container images in new ways without using Dockerfile, then you should really take a look at Buildah. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/tips-tricks-rootless-buildah + +作者:[Daniel J Walsh][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/rhatdan +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/19/2/how-does-rootless-podman-work +[2]: https://podman.io/ +[3]: https://github.com/containers/buildah +[4]: https://www.opencontainers.org/ +[5]: https://github.com/containers +[6]: https://github.com/opencontainers/image-spec +[7]: https://github.com/openSUSE/umoci +[8]: https://github.com/docker +[9]: https://cri-o.io/ +[10]: https://github.com/openshift/source-to-image +[11]: https://github.com/TomasTomecek/ansible-bender From 8feacc1a005301df2f1b1390961fe3dbca5989d6 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 14 Mar 2019 13:02:04 +0800 Subject: [PATCH 258/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190311=20Blockc?= =?UTF-8?q?hain=202.0:=20Redefining=20Financial=20Services=20[Part=203]=20?= =?UTF-8?q?sources/tech/20190311=20Blockchain=202.0-=20Redefining=20Financ?= =?UTF-8?q?ial=20Services=20-Part=203.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...- Redefining Financial Services -Part 3.md | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 sources/tech/20190311 Blockchain 2.0- Redefining Financial Services -Part 3.md diff --git a/sources/tech/20190311 Blockchain 2.0- Redefining Financial Services -Part 3.md b/sources/tech/20190311 Blockchain 2.0- Redefining Financial Services -Part 3.md new file mode 100644 index 0000000000..5f82bc87ff --- /dev/null +++ b/sources/tech/20190311 Blockchain 2.0- Redefining Financial Services -Part 3.md @@ -0,0 +1,63 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Blockchain 2.0: Redefining Financial Services [Part 3]) +[#]: via: (https://www.ostechnix.com/blockchain-2-0-redefining-financial-services/) +[#]: author: (EDITOR https://www.ostechnix.com/author/editor/) + +Blockchain 2.0: Redefining Financial Services [Part 3] +====== + +![](https://www.ostechnix.com/wp-content/uploads/2019/03/Financial-Services-1-720x340.png) + +The [**previous article of this series**][1] focused on building context to bring forth why moving our existing monetary system to a futuristic [**blockchain**][2] system is the next natural step in the evolution of “money”. We looked at the features of a blockchain platform which would aid in such a move. However, the financial markets are far more complex and composed of numerous other instruments that people trade rather than just a currency. + +This part will explore the features of blockchain which will enable institutions to transform and interlace traditional banking and financing systems with it. As previously discussed, and proved, if enough people participate in a given blockchain n­­etwork and support the protocols for transactions, the nominal value that can be attributed to the “token” increases and becomes more stable. Take, for instance, Bitcoin (BTC). Like the simple paper currency, we’re all used to, cryptocurrencies such as Bitcoin and Ether can be utilized for all the former’s purposes from buying food to ships and from loaning money to insurance. + +Chances are you are already involved with a bank or any other financial institution that makes use of blockchain ledger technology. The most significant uses of blockchain tech in the finance industry will be in setting up payments infrastructure, fund transfer technologies, and digital identity management. The latter two have traditionally been handled by legacy systems in the financial services industry. These systems are slowly being migrated to blockchain systems owing to their efficiency in handling work like this. The blockchain also offers high-quality data analytics solutions to these firms, an aspect that is quickly gaining prominence because of recent developments in data sciences.[1] + +Considering the start-ups and projects at the cutting edge of innovation in this space first seems warranted due to their products or services already doing the rounds in the market today. + +Starting with PayPal, an online payments company started in 1998, and now among the largest of such platforms, it is considered to be a benchmark in terms of operations and technical prowess. PayPal derives largely from the existing monetary system. Its contribution to innovation came by how it collected and leveraged consumer data to provide services online at instantaneous speeds. Online transactions are taken for granted today with minimal innovation in the industry in terms of the tech that it’s based on. Having a solid foundation is a good thing, but that won’t give anyone an edge over their competition in this fast-paced IT world with new standards and technology being pioneered every other day. In 2014 PayPal subsidiary, **Braintree** announced partnerships with popular cryptocurrency payment solutions including **Coinbase** and **GoCoin** , in a bid to gradually integrate Bitcoin and other popular cryptocurrencies into its service platform. This basically gave its consumers a chance to explore and experience the side of what’s to come under the familiar umbrella cover and reliability of PayPal. In fact, ride-hailing company **Uber** had an exclusive partnership with Braintree to allow customers to pay for rides using Bitcoin.[2][3] + +**Ripple** is making it easier for people to operate between multiple blockchains. Ripple has been in the headlines for moving ahead with regional banks in the US, for instance, to facilitate transferring money bilaterally to other regional banks without the need for a 3rd party intermediary resulting in reduced cost and time overheads. Ripple’s **Codius platform** allows for interoperability between blockchains and opens the doors to smart contracts programmed into the system for minimal tampering and confusion. Built on technology that is highly advanced, secure and scalable to suit needs, Ripple’s platform currently has names such as UBS and Standard Chartered on their client’s list. Many more are expected to join in.[4][5] + +**Kraken** , a US-based cryptocurrency exchange operating in locations around the globe is known for their reliable **crypto quant** estimates even providing Bitcoin pricing data real time to the Bloomberg terminal. In 2015, they partnered with **Fidor Bank** to form what was then the world’s first Cryptocurrency Bank offering customers banking services and products which dealt with cryptocurrencies.[6] + +**Circle** , another FinTech company is currently among the largest of its sorts involved with allowing users to invest and trade in cryptocurrency derived assets, similar to traditional money market assets.[7] + +Companies such as **Wyre** and **Stellar** today have managed to bring down the lead time involved in international wire transfers from an average of 3 days to under 6 hours. Claims have been made saying that once a proper regulatory system is in place the same 6 hours can be brought down to a matter of seconds.[8] + +Now while all of the above have focused on the start-up projects involved, it has to be remembered that the reach and capabilities of the older more respectable financial institutions should not be ignored. Institutions that have existed for decades if not centuries moving billions of dollars worldwide are equally interested in leveraging the blockchain and its potential. + +As we already mentioned in the previous article, **JP Morgan** recently unveiled their plans to exploit cryptocurrencies and the underlying ledger like the functionality of the blockchain for enterprises. The project, called **Quorum** , is defined as an **“Enterprise-ready distributed ledger and smart contract platform”**. The main goal being that gradually the bulk of the bank’s operations would one day be migrated to Quorum thus cutting significant investments that firms such as JP Morgan need to make in order to guarantee privacy, security, and transparency. They’re claimed to be the only player in the industry now to have complete ownership over the whole stack of the blockchain, protocol, and token system. They also released a cryptocurrency called **JPM Coin** meant to be used in transacting high volume settlements instantaneously. JPM coin is among the first “stable coins” to be backed by a major bank such as JP Morgan. A stable coin is a cryptocurrency whose price is linked to an existing major monetary system. Quorum is also touted for its capabilities to process almost 100 transactions a second which is leaps and bounds ahead of its contemporaries.[9] + +**Barclay’s** , a British multinational financial giant is reported to have registered two blockchain-based patents supposedly with the aim of streamlining fund transfers and KYC procedures. Barclay’s proposals though are more aimed toward improving their banking operations’ efficiency. One of the application deals with creating a private blockchain network for storing KYC details of consumers. Once verified, stored and confirmed, these details are immutable and nullifies the need for further verifications down the line. If implemented the protocol will do away with the need for multiple verifications of KYC details. Developing and densely populated countries such as India where a bulk of the population is yet to be inducted into a formal banking system will find the innovative KYC system useful in reducing random errors and lead times involved in the process[10]. Barclay’s is also rumored to be exploring the capabilities of a blockchain system to address credit status ratings and insurance claims. + +Such blockchain backed systems are designed to eliminate needless maintenance costs and leverage the power of smart contracts for enterprises which operate in industries where discretion, security, and speed determine competitive advantage. Being enterprise products, they’re built on protocols that ensure complete transaction and contract privacy along with a consensus mechanism which essentially nullifies corruption and bribery. + +**PwC’s Global Fintech Report** from 2017 states that by 2020, an estimated 77% of all Fintech companies are estimated to switch to blockchain based technologies and processes concerning their operations. A whopping 90 percent of their respondents said that they were planning to adopt blockchain technology as part of an in-production system by 2020. Their judgments are not misplaced as significant cost savings and transparency gains from a regulatory point of view are guaranteed by moving to a blockchain based system.[11] + +Since regulatory capabilities are built into the blockchain platform by default the migration of firms from legacy systems to modern networks running blockchain ledgers is a welcome move for industry regulators as well. Transactions and trade movements can be verified and tracked on the fly once and for all rather than after. This, in the long run, will likely result in better regulation and risk management. Not to mention improved accountability from the part of firms and individuals alike.[11] + +While considerable investments in the space and leaping innovations are courtesy of large investments by established corporates it is misleading to think that such measures wouldn’t permeate the benefits to the end user. As banks and financial institutions start to adopt the blockchain, it will result in increased cost savings and efficiency for them which will ultimately mean good for the end consumer too. The added benefits of transparency and fraud protection will improve customer sentiments and more importantly improve the trust that people place on the banking and financial system. A much-needed revolution in the financial services industry is possible with blockchains and their integration into traditional services. + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/blockchain-2-0-redefining-financial-services/ + +作者:[EDITOR][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/editor/ +[b]: https://github.com/lujun9972 +[1]: https://www.ostechnix.com/blockchain-2-0-revolutionizing-the-financial-system/ +[2]: https://www.ostechnix.com/blockchain-2-0-an-introduction/ From e64f96232b101edb92f1a6506943cdd11b29e4a1 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 15 Mar 2019 08:49:25 +0800 Subject: [PATCH 259/796] 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 260/796] 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 261/796] 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 262/796] 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 263/796] 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 264/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190314=20A=20Lo?= =?UTF-8?q?ok=20Back=20at=20the=20History=20of=20Firefox=20sources/talk/20?= =?UTF-8?q?190314=20A=20Look=20Back=20at=20the=20History=20of=20Firefox.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4 A Look Back at the History of Firefox.md | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 sources/talk/20190314 A Look Back at the History of Firefox.md diff --git a/sources/talk/20190314 A Look Back at the History of Firefox.md b/sources/talk/20190314 A Look Back at the History of Firefox.md new file mode 100644 index 0000000000..f4118412b4 --- /dev/null +++ b/sources/talk/20190314 A Look Back at the History of Firefox.md @@ -0,0 +1,115 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A Look Back at the History of Firefox) +[#]: via: (https://itsfoss.com/history-of-firefox) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +A Look Back at the History of Firefox +====== + +The Firefox browser has been a mainstay of the open-source community for a long time. For many years it was the default web browser on (almost) all Linux distros and the lone obstacle to Microsoft’s total dominance of the internet. This browser has roots that go back all the way to the very early days of the internet. Since this week marks the 30th anniversary of the internet, there is no better time to talk about how Firefox became the browser we all know and love. + +### Early Roots + +In the early 1990s, a young man named [Marc Andreessen][1] was working on his bachelor’s degree in computer science at the University of Illinois. While there, he started working for the [National Center for Supercomputing Applications][2]. During that time [Sir Tim Berners-Lee][3] released an early form of the web standards that we know today. Marc [was introduced][4] to a very primitive web browser named [ViolaWWW][5]. Seeing that the technology had potential, Marc and Eric Bina created an easy to install browser for Unix named [NCSA Mosaic][6]). The first alpha was released in June 1993. By September, there were ports to Windows and Macintosh. Mosaic became very popular because it was easier to use than other browsing software. + +In 1994, Marc graduated and moved to California. He was approached by Jim Clark, who had made his money selling computer hardware and software. Clark had used Mosaic and saw the financial possibilities of the internet. Clark recruited Marc and Eric to start an internet software company. The company was originally named Mosaic Communications Corporation, however, the University of Illinois did not like [their use of the name Mosaic][7]. As a result, the company name was changed to Netscape Communications Corporation. + +The company’s first project was an online gaming network for the Nintendo 64, but that fell through. The first product they released was a web browser named Mosaic Netscape 0.9, subsequently renamed Netscape Navigator. Internally, the browser project was codenamed mozilla, which stood for “Mosaic killer”. An employee created a cartoon of a [Godzilla like creature][8]. They wanted to take out the competition. + +![Early Firefox Mascot][9]Early Mozilla mascot at Netscape + +They succeed mightily. At the time, one of the biggest advantages that Netscape had was the fact that its browser looked and functioned the same on every operating system. Netscape described this as giving everyone a level playing field. + +As usage of Netscape Navigator increase, the market share of NCSA Mosaic cratered. In 1995, Netscape went public. [On the first day][10], the stock started at $28, jumped to $75 and ended the day at $58. Netscape was without any rivals. + +But that didn’t last for long. In the summer of 1994, Microsoft released Internet Explorer 1.0, which was based on Spyglass Mosaic which was based on NCSA Mosaic. The [browser wars][11] had begun. + +Over the next few years, Netscape and Microsoft competed for dominance of the internet. Each added features to compete with the other. Unfortunately, Internet Explorer had an advantage because it came bundled with Windows. On top of that, Microsoft had more programmers and money to throw at the problem. Toward the end of 1997, Netscape started to run into financial problems. + +### Going Open Source + +![Mozilla Firefox][12] + +In January 1998, Netscape open-sourced the code of the Netscape Communicator 4.0 suite. The [goal][13] was to “harness the creative power of thousands of programmers on the Internet by incorporating their best enhancements into future versions of Netscape’s software. This strategy is designed to accelerate development and free distribution by Netscape of future high-quality versions of Netscape Communicator to business customers and individuals.” + +The project was to be shepherded by the newly created Mozilla Organization. However, the code from Netscape Communicator 4.0 proved to be very difficult to work with due to its size and complexity. On top of that, several parts could not be open sourced because of licensing agreements with third parties. In the end, it was decided to rewrite the browser from scratch using the new [Gecko][14]) rendering engine. + +In November 1998, Netscape was acquired by AOL for [stock swap valued at $4.2 billion][15]. + +Starting from scratch was a major undertaking. Mozilla Firefox (initially nicknamed Phoenix) was created in June 2002 and it worked on multiple operating systems, such as Linux, Mac OS, Microsoft Windows, and Solaris. + +The following year, AOL announced that they would be shutting down browser development. The Mozilla Foundation was subsequently created to handle the Mozilla trademarks and handle the financing of the project. Initially, the Mozilla Foundation received $2 million in donations from AOL, IBM, Sun Microsystems, and Red Hat. + +In March 2003, Mozilla [announced pl][16][a][16][ns][16] to separate the suite into stand-alone applications because of creeping software bloat. The stand-alone browser was initially named Phoenix. However, the name was changed due to a trademark dispute with the BIOS manufacturer Phoenix Technologies, which had a BIOS-based browser named trademark dispute with the BIOS manufacturer Phoenix Technologies. Phoenix was renamed Firebird only to run afoul of the Firebird database server people. The browser was once more renamed to the Firefox that we all know. + +At the time, [Mozilla said][17], “We’ve learned a lot about choosing names in the past year (more than we would have liked to). We have been very careful in researching the name to ensure that we will not have any problems down the road. We have begun the process of registering our new trademark with the US Patent and Trademark office.” + +![Mozilla Firefox 1.0][18]Firefox 1.0 : [Picture Credit][19] + +The first official release of Firefox was [0.8][20] on February 8, 2004. 1.0 followed on November 9, 2004. Version 2.0 and 3.0 followed in October 2006 and June 2008 respectively. Each major release brought with it many new features and improvements. In many respects, Firefox pulled ahead of Internet Explorer in terms of features and technology, but IE still had more users. + +That changed with the release of Google’s Chrome browser. In the months before the release of Chrome in September 2008, Firefox accounted for 30% of all [browser usage][21] and IE had over 60%. According to StatCounter’s [January 2019 report][22], Firefox accounts for less than 10% of all browser usage, while Chrome has over 70%. + +Fun Fact + +Contrary to popular belief, the logo of Firefox doesn’t feature a fox. It’s actually a [Red Panda][23]. In Chinese, “fire fox” is another name for the red panda. + +### The Future + +As noted above, Firefox currently has the lowest market share in its recent history. There was a time when a bunch of browsers were based on Firefox, such as the early version of the [Flock browser][24]). Now most browsers are based on Google technology, such as Opera and Vivaldi. Even Microsoft is giving up on browser development and [joining the Chromium band wagon][25]. + +This might seem like quite a downer after the heights of the early Netscape years. But don’t forget what Firefox has accomplished. A group of developers from around the world have created the second most used browser in the world. They clawed 30% market share away from Microsoft’s monopoly, they can do it again. After all, they have us, the open source community, behind them. + +The fight against the monopoly is one of the several reasons [why I use Firefox][26]. Mozilla regained some of its lost market-share with the revamped release of [Firefox Quantum][27] and I believe that it will continue the upward path. + +What event from Linux and open source history would you like us to write about next? Please let us know in the comments below. + +If you found this article interesting, please take a minute to share it on social media, Hacker News or [Reddit][28]. + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/history-of-firefox + +作者:[John Paul][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Marc_Andreessen +[2]: https://en.wikipedia.org/wiki/National_Center_for_Supercomputing_Applications +[3]: https://en.wikipedia.org/wiki/Tim_Berners-Lee +[4]: https://www.w3.org/DesignIssues/TimBook-old/History.html +[5]: http://viola.org/ +[6]: https://en.wikipedia.org/wiki/Mosaic_(web_browser +[7]: http://www.computinghistory.org.uk/det/1789/Marc-Andreessen/ +[8]: http://www.davetitus.com/mozilla/ +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/Mozilla_boxing.jpg?ssl=1 +[10]: https://www.marketwatch.com/story/netscape-ipo-ignited-the-boom-taught-some-hard-lessons-20058518550 +[11]: https://en.wikipedia.org/wiki/Browser_wars +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/mozilla-firefox.jpg?resize=800%2C450&ssl=1 +[13]: https://web.archive.org/web/20021001071727/wp.netscape.com/newsref/pr/newsrelease558.html +[14]: https://en.wikipedia.org/wiki/Gecko_(software) +[15]: http://news.cnet.com/2100-1023-218360.html +[16]: https://web.archive.org/web/20050618000315/http://www.mozilla.org/roadmap/roadmap-02-Apr-2003.html +[17]: https://www-archive.mozilla.org/projects/firefox/firefox-name-faq.html +[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/firefox-1.jpg?ssl=1 +[19]: https://www.iceni.com/blog/firefox-1-0-introduced-2004/ +[20]: https://en.wikipedia.org/wiki/Firefox_version_history +[21]: https://en.wikipedia.org/wiki/Usage_share_of_web_browsers +[22]: http://gs.statcounter.com/browser-market-share/desktop/worldwide/#monthly-201901-201901-bar +[23]: https://en.wikipedia.org/wiki/Red_panda +[24]: https://en.wikipedia.org/wiki/Flock_(web_browser +[25]: https://www.windowscentral.com/microsoft-building-chromium-powered-web-browser-windows-10 +[26]: https://itsfoss.com/why-firefox/ +[27]: https://itsfoss.com/firefox-quantum-ubuntu/ +[28]: http://reddit.com/r/linuxusersgroup +[29]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/mozilla-firefox.jpg?fit=800%2C450&ssl=1 From 3a2c9cb1caa2a2faa3539c9ed1d86bf748c08a74 Mon Sep 17 00:00:00 2001 From: hopefully2333 <787016457@qq.com> Date: Fri, 15 Mar 2019 13:44:11 +0800 Subject: [PATCH 265/796] 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 266/796] 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 267/796] =?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 268/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190313=20Why=20?= =?UTF-8?q?is=20no=20one=20signing=20their=20emails=3F=20sources/talk/2019?= =?UTF-8?q?0313=20Why=20is=20no=20one=20signing=20their=20emails.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0313 Why is no one signing their emails.md | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 sources/talk/20190313 Why is no one signing their emails.md diff --git a/sources/talk/20190313 Why is no one signing their emails.md b/sources/talk/20190313 Why is no one signing their emails.md new file mode 100644 index 0000000000..b2b862951a --- /dev/null +++ b/sources/talk/20190313 Why is no one signing their emails.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why is no one signing their emails?) +[#]: via: (https://arp242.net/weblog/signing-emails.html) +[#]: author: (Martin Tournoij https://arp242.net/) + +Why is no one signing their emails? +====== + + +I received this email a while ago: + +> Queensland University of Technology sent you an Amazon.com Gift Card! +> +> You’ve received an Amazon.com gift card! You’ll need the claim code below to place your order. +> +> Happy shopping! + +Queensland University of Technology? Why would they send me anything? Where is that even? Australia right? That’s the other side of the world! Looks like spam! + +It did look pretty good for spam, so I took a second look. And a very close third look, and then I decided it wasn’t spam. + +I was still confused why they sent me this. A week later I remembered: half a year prior I had done an interview regarding my participation on Stack Overflow for someone’s paper; she was studying somewhere in Australia – presumably the university of Queensland. No one had ever mentioned anything about a reward or Amazon gift card so I wasn’t expecting it. It’s a nice bonus though. + +Here’s the thing: I’ve spent several years professionally developing email systems; I administered email servers; I read all the relevant RFCs. While there are certainly people who are more knowledgable, I know more about email than the vast majority of the population. And I still had to take a careful look to verify the email wasn’t a phishing attempt. + +And I’m not even a target; I’m just this guy, you know? [Ask John Podesta what it is to be targeted][1]: + +> SecureWorks concluded Fancy Bear had sent Podesta an email on March 19, 2016, that had the appearance of a Google security alert, but actually contained a misleading link—a strategy known as spear-phishing. [..] The email was initially sent to the IT department as it was suspected of being a fake but was described as “legitimate” in an e-mail sent by a department employee, who later said he meant to write “illegitimate”. + +Yikes! If I was even remotely high-profile I’d be crazy paranoid about all emails I get. + +It seems to me that there is a fairly easy solution to verify the author of an email: sign it with a digital signature; PGP is probably the best existing solution right now. I don’t even care about encryption here, just signing to prevent phishing. + +PGP has a well-deserved reputation for being hard, but that’s only for certain scenarios. A lot of the problems/difficulties stem from trying to accommodate the “random person A emails random person B” use case, but this isn’t really what I care about here. “Large company with millions of users sends thousands of emails daily” is a very different use case. + +Much of the key exchange/web-of-trust dilemma can be bypassed by shipping email clients with keys for large organisations (PayPal, Google, etc.) baked in, like browsers do with some certificates. Even just publishing your key on your website (or, if you’re a bank, in local branches etc.) is already a lot better than not signing anything at all. Right now there seems to be a catch-22 scenario: clients don’t implement better support as very few people are using PGP, while very few companies bother signing their emails with PGP because so few people can benefit from it. + +On the end-user side, things are also not very hard; we’re just conceded with validating signatures, nothing more. For this purpose PGP isn’t hard. It’s like verifying your Linux distro’s package system: all of them sign their packages (usually with PGP) and they get verified on installation, but as an end-user I never see it unless something goes wrong. + +There are many aspects of PGP that are hard to set up and manage, but verifying signatures isn’t one of them. The user-visible part of this is very limited. Remember, no one is expected to sign their own emails: just verify that the signature is correct (which the software will do). Conceptually, it’s not that different from verifying a handwritten signature. + +DKIM and SPF already exist and are useful, but limited. All both do is verify that an email which claims to be from `amazon.com` is really from `amazon.com`. If I send an email from `mail.amazon-account-security.com` or `amazonn.com` then it just verifies that it was sent from that domain, not that it was sent from the organisation Amazon. + +What I am proposing is subtly different. In my (utopian) future every serious organisation will sign their email with PGP (just like every serious organisation uses https). Then every time I get an email which claims to be from Amazon I can see it’s either not signed, or not signed by a key I know. If adoption is broad enough we can start showing warnings such as “this email wasn’t signed, do you want to trust it?” and “this signature isn’t recognized, yikes!” + +There’s also S/MIME, which has better client support and which works more or less the same as HTTPS: you get a certificate from the Certificate Authority Mafia, sign your email with it, and presto. The downside of this is that anyone can sign their emails with a valid key, which isn’t necessarily telling you much (just because haxx0r.ru has a certificate doesn’t mean it’s trustworthy). + +Is it perfect? No. I understand stuff like key exchange is hard and that baking in keys isn’t perfect. Is it better? Hell yes. Would probably have avoided Podesta and the entire Democratic Party a lot of trouble. Here’s a “[sophisticated new phishing campaign][2]” targeted at PayPal users. How “sophisticated”? Well, by not having glaring stupid spelling errors, duplicating the PayPal layout in emails, duplicating the PayPal login screen, a few forms, and getting an SSL certificate. Truly, the pinnacle of Computer Science. + +Okay sure, they spent some effort on it; but any nincompoop can do it; if this passes for “sophisticated phishing” where “it’s easy to see how users could be fooled” then the bar is pretty low. + +I can’t recall receiving a single email from any organisation that is signed (much less encrypted). Banks, financial services, utilities, immigration services, governments, tax services, voting registration, Facebook, Twitter, a zillion websites … all happily sent me emails hoping I wouldn’t consider them spam and hoping I wouldn’t confuse a phishing email for one of theirs. + +Interesting experiment: send invoices for, say, a utility bill for a local provider. Just copy the layout from the last utility bill you received. I’ll bet you’ll make more money than freelancing on UpWork if you do it right. + +I’ve been intending to write this post for years, but never quite did because “surely not everyone is stupid?” I’m not a crypto expert, so perhaps I’m missing something here, but I wouldn’t know what. Let me know if I am. + +In the meanwhile PayPal is attempting to solve the problem by publishing [articles which advise you to check for spelling errors][3]. Okay, it’s good advice, but do we really want this to be the barrier between an attacker and your money? Or Russian hacking groups and your emails? Anyone can sign any email with any key, but “unknown signature” warnings strike me as a lot better UX than “carefully look for spelling errors or misleading domain names”. + +The way forward is to make it straight-forward to implement signing in apps and then just do it as a developer, whether asked or not; just as you set up https whether you’re asked or not. I’ll write a follow-up with more technical details later, assuming no one pokes holes in this article :-) + +#### Response to some feedback + +Some response to some feedback that I couldn’t be bothered to integrate in the article’s prose: + + * “You can’t trust webmail with crypto!” +If you use webmail then you’re already trusting the email provider with everything. What’s so bad with trusting them to verify a signature, too? + +We’re not communicating state secrets over encrypted email here; we’re just verifying the signature on “PayPal sent you a message, click here to view it”-kind of emails. + + * “Isn’t this ignoring the massive problem that is key management?” +Yes, it’s hard problem; but that doesn’t mean it can’t be done. I already mentioned some possible solutions in the article. + + + + +**Footnotes** + + 1. We could make something better; PGP contians a lot of cruft. But for now PGP is “good enough”. + + + + + +-------------------------------------------------------------------------------- + +via: https://arp242.net/weblog/signing-emails.html + +作者:[Martin Tournoij][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://arp242.net/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Podesta_emails#Data_theft +[2]: https://www.eset.com/us/about/newsroom/corporate-blog/paypal-users-targeted-in-sophisticated-new-phishing-campaign/ +[3]: https://www.paypal.com/cs/smarthelp/article/how-to-spot-fake,-spoof,-or-phishing-emails-faq2340 From b121d0bf36b55ce10e724356091efc863d7ba007 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 15 Mar 2019 16:12:45 +0800 Subject: [PATCH 269/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020171119=20Advanc?= =?UTF-8?q?ed=20Techniques=20for=20Reducing=20Emacs=20Startup=20Time=20sou?= =?UTF-8?q?rces/tech/20171119=20Advanced=20Techniques=20for=20Reducing=20E?= =?UTF-8?q?macs=20Startup=20Time.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...hniques for Reducing Emacs Startup Time.md | 252 ++++++++++++++++++ 1 file changed, 252 insertions(+) create mode 100644 sources/tech/20171119 Advanced Techniques for Reducing Emacs Startup Time.md diff --git a/sources/tech/20171119 Advanced Techniques for Reducing Emacs Startup Time.md b/sources/tech/20171119 Advanced Techniques for Reducing Emacs Startup Time.md new file mode 100644 index 0000000000..6a761ac7d1 --- /dev/null +++ b/sources/tech/20171119 Advanced Techniques for Reducing Emacs Startup Time.md @@ -0,0 +1,252 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Advanced Techniques for Reducing Emacs Startup Time) +[#]: via: (https://blog.d46.us/advanced-emacs-startup/) +[#]: author: (Joe Schafer https://blog.d46.us/) + +Advanced Techniques for Reducing Emacs Startup Time +====== + +Six techniques to reduce Emacs startup time by the author of the [Emacs Start Up Profiler][1]. + +tl;dr: Do these steps: + + 1. Profile with Esup. + 2. Adjust the garbage collection threshold. + 3. Autoload **everything** with use-package. + 4. Avoid helper functions which cause eager loads. + 5. See my Emacs [config][2] for an example. + + + +### From .emacs.d Bankruptcy to Now + +I recently declared my third .emacs.d bankruptcy and finished the fourth iteration of my Emacs configuration. The evolution was: + + 1. Copy and paste elisp snippets into `~/.emacs` and hope it works. + 2. Adopt a more structured approach with `el-get` to manage dependencies. + 3. Give up and outsource to Spacemacs. + 4. Get tired of Spacemacs intricacies and rewrite with `use-package`. + + + +This article is a collection of tips collected during the 3 rewrites and from creating the Emacs Start Up Profiler. Many thanks to the teams behind Spacemacs, use-package and general. Without these dedicated voluteers, this task would be vastly more difficult. + +### But What About Daemon Mode + +Before we get started, let me acknowledge the common retort when optimizing Emacs: “Emacs is meant to run as a daemon so you’ll only start it once.” That’s all well and good except: + + * Fast things feel nicer. + * When customizing Emacs, you sometimes get into weird states that can be hard to recover from without restarting. For example, if you add a slow `lambda` function to your `post-command-hook`, it’s tough to remove it. + * Restarting Emacs helps verify that customization will persist between sessions. + + + +### 1\. Establish the Current and Best Possible Start Up Time + +The first step is to measure the current start up time. The easy way is to display the information at startup which will show progress through the next steps. + +``` +(add-hook 'emacs-startup-hook + (lambda () + (message "Emacs ready in %s with %d garbage collections." + (format "%.2f seconds" + (float-time + (time-subtract after-init-time before-init-time))) + gcs-done))) +``` + +Second, measure the best possible startup speed so you know what’s possible. Mine is 0.3 seconds. + +``` +emacs -q --eval='(message "%s" (emacs-init-time))' + +;; For macOS users: +open -n /Applications/Emacs.app --args -q --eval='(message "%s" (emacs-init-time))' +``` + +### 2\. Profile Emacs Startup for Easy Wins + +The [Emacs StartUp Profiler][1] (ESUP) will give you detailed metrics for top-level expressions. + +![esup.png][3] + +Figure 1: + +Emacs Start Up Profiler Screenshot + +WARNING: Spacemacs users, ESUP currently chokes on the Spacemacs init.el file. Follow for updates. + +### 3\. Set the Garbage Collection Threshold Higher during Startup + +This saves about ****0.3 seconds**** on my configuration. + +The default value for Emacs is 760kB which is extremely conservative on a modern machine. The real trick is to lower it back to something reasonable after initialization. This saves about 0.3 seconds on my init files. + +``` +;; Make startup faster by reducing the frequency of garbage +;; collection. The default is 800 kilobytes. Measured in bytes. +(setq gc-cons-threshold (* 50 1000 1000)) + +;; The rest of the init file. + +;; Make gc pauses faster by decreasing the threshold. +(setq gc-cons-threshold (* 2 1000 1000)) +``` + +### 4\. Never require anything; autoload with use-package instead + +The best way to make Emacs faster is to do less. Running `require` eagerly loads the underlying source file. It’s rare the you’ll need functionality immediately at startup time. + +With [`use-package`][4], you declare which features you need from a package and `use-package` does the right thing. Here’s what it looks like: + +``` +(use-package evil-lisp-state ; the Melpa package name + + :defer t ; autoload this package + + :init ; Code to run immediately. + (setq evil-lisp-state-global nil) + + :config ; Code to run after the package is loaded. + (abn/define-leader-keys "k" evil-lisp-state-map)) +``` + +To see what packages Emacs currently has loaded, examine the `features` variable. For nice output see [lpkg explorer][5] or my variant in [abn-funcs-benchmark.el][6]. The output looks like: + +``` +479 features currently loaded + - abn-funcs-benchmark: /Users/jschaf/.dotfiles/emacs/funcs/abn-funcs-benchmark.el + - evil-surround: /Users/jschaf/.emacs.d/elpa/evil-surround-20170910.1952/evil-surround.elc + - misearch: /Applications/Emacs.app/Contents/Resources/lisp/misearch.elc + - multi-isearch: nil + - +``` + +### 5\. Avoid Helper Functions to Set Up Modes + +Often, Emacs packages will suggest running a helper function to set up keybindings. Here’s a few examples: + + * `(evil-escape-mode)` + * `(windmove-default-keybindings) ; Sets up keybindings.` + * `(yas-global-mode 1) ; Complex snippet setup.` + + + +Rewrite these with use-package to improve startup speed. These helper functions are really just sneaky ways to trick you into eagerly loading packages before you need them. + +As an example, here’s how to autoload `evil-escape-mode`. + +``` +;; The definition of evil-escape-mode. +(define-minor-mode evil-escape-mode + (if evil-escape-mode + (add-hook 'pre-command-hook 'evil-escape-pre-command-hook) + (remove-hook 'pre-command-hook 'evil-escape-pre-command-hook))) + +;; Before: +(evil-escape-mode) + +;; After: +(use-package evil-escape + :defer t + ;; Only needed for functions without an autoload comment (;;;###autoload). + :commands (evil-escape-pre-command-hook) + + ;; Adding to a hook won't load the function until we invoke it. + ;; With pre-command-hook, that means the first command we run will + ;; load evil-escape. + :init (add-hook 'pre-command-hook 'evil-escape-pre-command-hook)) +``` + +For a much trickier example, consider `org-babel`. The common recipe is: + +``` +(org-babel-do-load-languages + 'org-babel-load-languages + '((shell . t) + (emacs-lisp . nil))) +``` + +This is bad because `org-babel-do-load-languages` is defined in `org.el`, which is over 24k lines of code and takes about 0.2 seconds to load. After examining the source code, `org-babel-do-load-languages` is simply requiring the `ob-` package like so: + +``` +;; From org.el in the org-babel-do-load-languages function. +(require (intern (concat "ob-" lang))) +``` + +In the `ob-.el`, there’s only two methods we care about, `org-babel-execute:` and `org-babel-expand-body:`. We can autoload the org-babel functionality instead of `org-babel-do-load-languages` like so: + +``` +;; Avoid `org-babel-do-load-languages' since it does an eager require. +(use-package ob-python + :defer t + :ensure org-plus-contrib + :commands (org-babel-execute:python)) + +(use-package ob-shell + :defer t + :ensure org-plus-contrib + :commands + (org-babel-execute:sh + org-babel-expand-body:sh + + org-babel-execute:bash + org-babel-expand-body:bash)) +``` + +### 6\. Defer Packages you don’t need Immediately with Idle Timers + +This saves about ****0.4 seconds**** for the 9 packages I defer. + +Some packages are useful and you want them available soon, but are not essential for immediate editing. These modes include: + + * `recentf`: Saves recent files. + * `saveplace`: Saves point of visited files. + * `server`: Starts Emacs daemon. + * `autorevert`: Automatically reloads files that changed on disk. + * `paren`: Highlight matching parenthesis. + * `projectile`: Project management tools. + * `whitespace`: Highlight trailing whitespace. + + + +Instead of requiring these modes, ****load them after N seconds of idle time****. I use 1 second for the more important packages and 2 seconds for everything else. + +``` +(use-package recentf + ;; Loads after 1 second of idle time. + :defer 1) + +(use-package uniquify + ;; Less important than recentf. + :defer 2) +``` + +### Optimizations that aren’t Worth It + +Don’t bother byte-compiling your personal Emacs files. It saved about 0.05 seconds. Byte compiling causes difficult to debug errors when the source file gets out of sync with compiled file. + + +-------------------------------------------------------------------------------- + +via: https://blog.d46.us/advanced-emacs-startup/ + +作者:[Joe Schafer][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://blog.d46.us/ +[b]: https://github.com/lujun9972 +[1]: https://github.com/jschaf/esup +[2]: https://github.com/jschaf/dotfiles/blob/master/emacs/start.el +[3]: https://blog.d46.us/images/esup.png +[4]: https://github.com/jwiegley/use-package +[5]: https://gist.github.com/RockyRoad29/bd4ca6fdb41196a71662986f809e2b1c +[6]: https://github.com/jschaf/dotfiles/blob/master/emacs/funcs/abn-funcs-benchmark.el From 607a84a06b6140bbe47c1a5782b2f5f00d4aa1e7 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 15 Mar 2019 16:18:29 +0800 Subject: [PATCH 270/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020180826=20Be=20p?= =?UTF-8?q?roductive=20with=20Org-mode=20sources/tech/20180826=20Be=20prod?= =?UTF-8?q?uctive=20with=20Org-mode.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20180826 Be productive with Org-mode.md | 202 ++++++++++++++++++ 1 file changed, 202 insertions(+) create mode 100644 sources/tech/20180826 Be productive with Org-mode.md diff --git a/sources/tech/20180826 Be productive with Org-mode.md b/sources/tech/20180826 Be productive with Org-mode.md new file mode 100644 index 0000000000..3c6f3c4519 --- /dev/null +++ b/sources/tech/20180826 Be productive with Org-mode.md @@ -0,0 +1,202 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Be productive with Org-mode) +[#]: via: (https://www.badykov.com/emacs/2018/08/26/be-productive-with-org-mode/) +[#]: author: (Ayrat Badykov https://www.badykov.com) + +Be productive with Org-mode +====== + + +![org-mode-collage][1] + +### Introduction + +In my [previous post about emacs][2] I mentioned [Org-mode][3], a note manager and organizer. In this post, I’ll describe my day-to-day Org-mode use cases. + +### Notes and to-do lists + +First and foremost, Org-mode is a tool for managing notes and to-do lists and all work in Org-mode is centered around writing notes in plain text files. I manage several kinds of notes using Org-mode. + +#### General notes + +The most basic Org-mode use case is writing simple notes about things that you want to remember. For example, here are my notes about things I’m learning right now: + +``` +* Learn +** Emacs LISP +*** Plan + + - [ ] Read best practices + - [ ] Finish reading Emacs Manual + - [ ] Finish Exercism Exercises + - [ ] Write a couple of simple plugins + - Notification plugin + +*** Resources + + https://www.gnu.org/software/emacs/manual/html_node/elisp/index.html + http://exercism.io/languages/elisp/about + [[http://batsov.com/articles/2011/11/30/the-ultimate-collection-of-emacs-resources/][The Ultimate Collection of Emacs Resources]] + +** Rust gamedev +*** Study [[https://github.com/SergiusIW/gate][gate]] 2d game engine with web assembly support +*** [[ggez][https://github.com/ggez/ggez]] +*** [[https://www.amethyst.rs/blog/release-0-8/][Amethyst 0.8 Relesed]] + +** Upgrade Elixir/Erlang Skills +*** Read Erlang in Anger +``` + +How it looks using [org-bullets][4]: + +![notes][5] + +In this simple example you can see some of the Org-mode features: + + * nested notes + * links + * lists with checkboxes + + + +#### Project todos + +Often when I’m working on some task I notice things that I can improve or fix. Instead of leaving TODO comment in source code files (bad smell) I use [org-projectile][6] which allows me to write TODO items with a single shortcut in a separate file. Here’s an example of this file: + +``` +* [[elisp:(org-projectile-open-project%20"mana")][mana]] [3/9] + :PROPERTIES: + :CATEGORY: mana + :END: +** DONE [[file:~/Development/mana/apps/blockchain/lib/blockchain/contract/create_contract.ex::insufficient_gas_before_homestead%20=][fix this check using evm.configuration]] + CLOSED: [2018-08-08 Ср 09:14] + [[https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2.md][eip2]]: + If contract creation does not have enough gas to pay for the final gas fee for + adding the contract code to the state, the contract creation fails (i.e. goes out-of-gas) + rather than leaving an empty contract. +** DONE Upgrade Elixir to 1.7. + CLOSED: [2018-08-08 Ср 09:14] +** TODO [#A] Difficulty tests +** TODO [#C] Upgrage to OTP 21 +** DONE [#A] EIP150 + CLOSED: [2018-08-14 Вт 21:25] +*** DONE operation cost changes + CLOSED: [2018-08-08 Ср 20:31] +*** DONE 1/64th for a call and create + CLOSED: [2018-08-14 Вт 21:25] +** TODO [#C] Refactor interfaces +** TODO [#B] Caching for storage during execution +** TODO [#B] Removing old merkle trees +** TODO do not calculate cost twice +* [[elisp:(org-projectile-open-project%20".emacs.d")][.emacs.d]] [1/3] + :PROPERTIES: + :CATEGORY: .emacs.d + :END: +** TODO fix flycheck issues (emacs config) +** TODO use-package for fetching dependencies +** DONE clean configuration + CLOSED: [2018-08-26 Вс 11:48] +``` + +How it looks in Emacs: + +![project-todos][7] + +In this example you can see more Org mode features: + + * todo items have states - `TODO`, `DONE`. You can define your own states (`WAITING` etc) + * closed items have `CLOSED` timestamp + * some items have priorities - A, B, C. + * links can be internal (`[[file:~/...]`) + + + +#### Capture templates + +As described in Org-mode’s documentation, capture lets you quickly store notes with little interruption of your workflow. + +I configured several capture templates which help me to quickly create notes about things that I want to remember. + +``` +(setq org-capture-templates +'(("t" "Todo" entry (file+headline "~/Dropbox/org/todo.org" "Todo soon") +"* TODO %? \n %^t") +("i" "Idea" entry (file+headline "~/Dropbox/org/ideas.org" "Ideas") +"* %? \n %U") +("e" "Tweak" entry (file+headline "~/Dropbox/org/tweaks.org" "Tweaks") +"* %? \n %U") +("l" "Learn" entry (file+headline "~/Dropbox/org/learn.org" "Learn") +"* %? \n") +("w" "Work note" entry (file+headline "~/Dropbox/org/work.org" "Work") +"* %? \n") +("m" "Check movie" entry (file+headline "~/Dropbox/org/check.org" "Movies") +"* %? %^g") +("n" "Check book" entry (file+headline "~/Dropbox/org/check.org" "Books") +"* %^{book name} by %^{author} %^g"))) +``` + +For a book note I should add its name and its author, for a movie note I should add tags etc. + +### Planning + +Another great feature of Org-mode is that you can use it as a day planner. Let’s see an example of one of my days: + +![schedule][8] + +I didn’t give a lot of thought to this example, it’s my real file for today. It doesn’t look like much but it helps to spend your time on things that important to you and fight with procrastination. + +#### Habits + +From Org mode’s documentation, Org has the ability to track the consistency of a special category of TODOs, called “habits”. I use this feature along with day planning when I want to create new habits: + +![habits][9] + +As you can see currently I’m trying to wake early every day and workout once in two days. Also, it helped to start reading books every day. + +#### Agenda views + +Last but not least I use agenda views. Todo items can be scattered throughout different files (in my case daily plan and habits are in separate files), agenda views give an overview of all todo items: + +![agenda][10] + +### More Org mode features + + ++ Smartphone apps (Android, ios) + ++ Exporting Org mode files into different formats (html, markdown, pdf, latex etc) + ++ Tracking Finances with ledger + +### Conclusion + +In this post, I described a small subset of Org-mode’s extensive functionality that helps me be productive every day, spending time on things that important to me. + + +-------------------------------------------------------------------------------- + +via: https://www.badykov.com/emacs/2018/08/26/be-productive-with-org-mode/ + +作者:[Ayrat Badykov][a] +选题:[lujun9972][b] +译者:[lujun9972](https://github.com/lujun9972) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.badykov.com +[b]: https://github.com/lujun9972 +[1]: https://i.imgur.com/hgqCyen.jpg +[2]: http://www.badykov.com/emacs/2018/07/31/why-emacs-is-a-great-editor/ +[3]: https://orgmode.org/ +[4]: https://github.com/sabof/org-bullets +[5]: https://i.imgur.com/lGi60Uw.png +[6]: https://github.com/IvanMalison/org-projectile +[7]: https://i.imgur.com/Hbu8ilX.png +[8]: https://i.imgur.com/z5HpuB0.png +[9]: https://i.imgur.com/YJIp3d0.png +[10]: https://i.imgur.com/CKX9BL9.png From 0b3426fd098a492be01450251fa213b64b002869 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 15 Mar 2019 16:24:48 +0800 Subject: [PATCH 271/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020180330=20Asynch?= =?UTF-8?q?ronous=20rsync=20with=20Emacs,=20dired=20and=20tramp.=20sources?= =?UTF-8?q?/tech/20180330=20Asynchronous=20rsync=20with=20Emacs,=20dired?= =?UTF-8?q?=20and=20tramp..md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nous rsync with Emacs, dired and tramp..md | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 sources/tech/20180330 Asynchronous rsync with Emacs, dired and tramp..md diff --git a/sources/tech/20180330 Asynchronous rsync with Emacs, dired and tramp..md b/sources/tech/20180330 Asynchronous rsync with Emacs, dired and tramp..md new file mode 100644 index 0000000000..954644918b --- /dev/null +++ b/sources/tech/20180330 Asynchronous rsync with Emacs, dired and tramp..md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Asynchronous rsync with Emacs, dired and tramp.) +[#]: via: (https://vxlabs.com/2018/03/30/asynchronous-rsync-with-emacs-dired-and-tramp/) +[#]: author: (cpbotha https://vxlabs.com/author/cpbotha/) + +Asynchronous rsync with Emacs, dired and tramp. +====== + +[tmtxt-dired-async][1] by [Trần Xuân Trường][2] is an unfortunately lesser known Emacs package which extends dired, the Emacs file manager, to be able to run rsync and other commands (zip, unzip, downloading) asynchronously. + +This means you can copy gigabytes of directories around whilst still happily continuing with all of your other tasks in the Emacs operating system. + +It has a feature where you can add any number of files from different locations into a wait list with `C-c C-a`, and then asynchronously rsync the whole wait list into a final destination directory with `C-c C-v`. This alone is worth the price of admission. + +For example here it is pointlessly rsyncing the arduino 1.9 beta archive to another directory: + +[![][3]][4] + +When the process is complete, the window at the bottom will automatically be killed after 5 seconds. Here is a separate session right after the asynchronous unzipping of the above-mentioned arduino archive: + +[![][5]][6] + +This package has further increased the utility of my dired configuration. + +I just contributed [a pull request that enables tmtxt-dired-async to rsync to remote tramp-based directories][7], and I immediately used this new functionality to sort a few gigabytes of new photos onto the Linux server. + +To add tmtxt-dired-async to your config, download [tmtxt-async-tasks.el][8] (a required library) and [tmtxt-dired-async.el][9] (check that my PR is in there if you plan to use this with tramp) into your `~/.emacs.d/` and add the following to your config: + +``` +;; no MELPA packages of this, so we have to do a simple check here +(setq dired-async-el (expand-file-name "~/.emacs.d/tmtxt-dired-async.el")) +(when (file-exists-p dired-async-el) + (load (expand-file-name "~/.emacs.d/tmtxt-async-tasks.el")) + (load dired-async-el) + (define-key dired-mode-map (kbd "C-c C-r") 'tda/rsync) + (define-key dired-mode-map (kbd "C-c C-z") 'tda/zip) + (define-key dired-mode-map (kbd "C-c C-u") 'tda/unzip) + + (define-key dired-mode-map (kbd "C-c C-a") 'tda/rsync-multiple-mark-file) + (define-key dired-mode-map (kbd "C-c C-e") 'tda/rsync-multiple-empty-list) + (define-key dired-mode-map (kbd "C-c C-d") 'tda/rsync-multiple-remove-item) + (define-key dired-mode-map (kbd "C-c C-v") 'tda/rsync-multiple) + + (define-key dired-mode-map (kbd "C-c C-s") 'tda/get-files-size) + + (define-key dired-mode-map (kbd "C-c C-q") 'tda/download-to-current-dir)) +``` + +Enjoy! + + +-------------------------------------------------------------------------------- + +via: https://vxlabs.com/2018/03/30/asynchronous-rsync-with-emacs-dired-and-tramp/ + +作者:[cpbotha][a] +选题:[lujun9972][b] +译者:[lujun9972](https://github.com/lujun9972) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://vxlabs.com/author/cpbotha/ +[b]: https://github.com/lujun9972 +[1]: https://truongtx.me/tmtxt-dired-async.html +[2]: https://truongtx.me/about.html +[3]: https://i0.wp.com/vxlabs.com/wp-content/uploads/2018/03/rsync-arduino-zip.png?resize=660%2C340&ssl=1 +[4]: https://i0.wp.com/vxlabs.com/wp-content/uploads/2018/03/rsync-arduino-zip.png?ssl=1 +[5]: https://i1.wp.com/vxlabs.com/wp-content/uploads/2018/03/progress-window-5s.png?resize=660%2C310&ssl=1 +[6]: https://i1.wp.com/vxlabs.com/wp-content/uploads/2018/03/progress-window-5s.png?ssl=1 +[7]: https://github.com/tmtxt/tmtxt-dired-async/pull/6 +[8]: https://github.com/tmtxt/tmtxt-async-tasks +[9]: https://github.com/tmtxt/tmtxt-dired-async From 0a89f92c0ae091b3f9a336895904cd85ead005f3 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 15 Mar 2019 22:55:42 +0800 Subject: [PATCH 272/796] 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 273/796] 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 274/796] 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 275/796] =?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 276/796] 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 277/796] 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 278/796] 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 279/796] 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 280/796] 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 281/796] 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 282/796] 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 283/796] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90=20?= =?UTF-8?q?How=20To=20Remove-Delete=20The=20Empty=20Lines=20In=20A=20File?= =?UTF-8?q?=20In=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...lete The Empty Lines In A File In Linux.md | 192 ----------------- ...lete The Empty Lines In A File In Linux.md | 194 ++++++++++++++++++ 2 files changed, 194 insertions(+), 192 deletions(-) delete mode 100644 sources/tech/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md create mode 100644 translated/tech/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md diff --git a/sources/tech/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md b/sources/tech/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md deleted file mode 100644 index b55cbcd811..0000000000 --- a/sources/tech/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md +++ /dev/null @@ -1,192 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( pityonline ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How To Remove/Delete The Empty Lines In A File In Linux) -[#]: via: (https://www.2daygeek.com/remove-delete-empty-lines-in-a-file-in-linux/) -[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) - -How To Remove/Delete The Empty Lines In A File In Linux -====== - -Some times you may wants to remove or delete the empty lines in a file in Linux. - -If so, you can use the one of the below method to achieve it. - -It can be done in many ways but i have listed simple methods in the article. - -You may aware of that grep, awk and sed commands are specialized for textual data manipulation. - -Navigate to the following URL, if you would like to read more about these kind of topics. For **[creating a file in specific size in Linux][1]** multiple ways, for **[creating a file in Linux][2]** multiple ways and for **[removing a matching string from a file in Linux][3]**. - -These are fall in advanced commands category because these are used in most of the shell script to do required things. - -It can be done using the following 5 methods. - - * **`sed Command:`** Stream editor for filtering and transforming text. - * **`grep Command:`** Print lines that match patterns. - * **`cat Command:`** It concatenate files and print on the standard output. - * **`tr Command:`** Translate or delete characters. - * **`awk Command:`** The awk utility shall execute programs written in the awk programming language, which is specialized for textual data manipulation. - * **`perl Command:`** Perl is a programming language specially designed for text editing. - - - -To test this, i had already created the file called `2daygeek.txt` with some texts and empty lines. The details are below. - -``` -$ cat 2daygeek.txt -2daygeek.com is a best Linux blog to learn Linux. - -It's FIVE years old blog. - -This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0. - -He got two GIRL babys. - -Her names are Tanisha & Renusha. -``` - -Now everything is ready and i’m going to test this in multiple ways. - -### How To Remove/Delete The Empty Lines In A File In Linux Using sed Command? - -Sed is a stream editor. A stream editor is used to perform basic text transformations on an input stream (a file or input from a pipeline). - -``` -$ sed '/^$/d' 2daygeek.txt -2daygeek.com is a best Linux blog to learn Linux. -It's FIVE years old blog. -This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0. -He got two GIRL babes. -Her names are Tanisha & Renusha. -``` - -Details are follow: - - * **`sed:`** It’s a command - * **`//:`** It holds the searching string. - * **`^:`** Matches start of string. - * **`$:`** Matches end of string. - * **`d:`** Delete the matched string. - * **`2daygeek.txt:`** Source file name. - - - -### How To Remove/Delete The Empty Lines In A File In Linux Using grep Command? - -grep searches for PATTERNS in each FILE. PATTERNS is one or patterns separated by newline characters, and grep prints each line that matches a pattern. - -``` -$ grep . 2daygeek.txt -or -$ grep -Ev "^$" 2daygeek.txt -or -$ grep -v -e '^$' 2daygeek.txt -2daygeek.com is a best Linux blog to learn Linux. -It's FIVE years old blog. -This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0. -He got two GIRL babes. -Her names are Tanisha & Renusha. -``` - -Details are follow: - - * **`grep:`** It’s a command - * **`.:`** Replaces any character. - * **`^:`** matches start of string. - * **`$:`** matches end of string. - * **`E:`** For extended regular expressions pattern matching. - * **`e:`** For regular expressions pattern matching. - * **`v:`** To select non-matching lines from the file. - * **`2daygeek.txt:`** Source file name. - - - -### How To Remove/Delete The Empty Lines In A File In Linux Using awk Command? - -The awk utility shall execute programs written in the awk programming language, which is specialized for textual data manipulation. An awk program is a sequence of patterns and corresponding actions. - -``` -$ awk NF 2daygeek.txt -or -$ awk '!/^$/' 2daygeek.txt -or -$ awk '/./' 2daygeek.txt -2daygeek.com is a best Linux blog to learn Linux. -It's FIVE years old blog. -This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0. -He got two GIRL babes. -Her names are Tanisha & Renusha. -``` - -Details are follow: - - * **`awk:`** It’s a command - * **`//:`** It holds the searching string. - * **`^:`** matches start of string. - * **`$:`** matches end of string. - * **`.:`** Replaces any character. - * **`!:`** Delete the matched string. - * **`2daygeek.txt:`** Source file name. - - - -### How To Delete The Empty Lines In A File In Linux using Combination of cat And tr Command? - -cat stands for concatenate. It is very frequently used in Linux to reads data from a file. - -cat is one of the most frequently used commands on Unix-like operating systems. It’s offer three functions which is related to text file such as display content of a file, combine multiple files into the single output and create a new file. - -Translate, squeeze, and/or delete characters from standard input, writing to standard output. - -``` -$ cat 2daygeek.txt | tr -s '\n' -2daygeek.com is a best Linux blog to learn Linux. -It's FIVE years old blog. -This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0. -He got two GIRL babes. -Her names are Tanisha & Renusha. -``` - -Details are follow: - - * **`cat:`** It’s a command - * **`tr:`** It’s a command - * **`|:`** Pipe symbol. It pass first command output as a input to another command. - * **`s:`** Replace each sequence of a repeated character that is listed in the last specified SET. - * **`\n:`** To add a new line. - * **`2daygeek.txt:`** Source file name. - - - -### How To Remove/Delete The Empty Lines In A File In Linux Using perl Command? - -Perl stands in for “Practical Extraction and Reporting Language”. Perl is a programming language specially designed for text editing. It is now widely used for a variety of purposes including Linux system administration, network programming, web development, etc. - -``` -$ perl -ne 'print if /\S/' 2daygeek.txt -2daygeek.com is a best Linux blog to learn Linux. -It's FIVE years old blog. -This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0. -He got two GIRL babes. -Her names are Tanisha & Renusha. -``` - --------------------------------------------------------------------------------- - -via: https://www.2daygeek.com/remove-delete-empty-lines-in-a-file-in-linux/ - -作者:[Magesh Maruthamuthu][a] -选题:[lujun9972][b] -译者:[pityonline](https://github.com/pityonline) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.2daygeek.com/author/magesh/ -[b]: https://github.com/lujun9972 -[1]: https://www.2daygeek.com/create-a-file-in-specific-certain-size-linux/ -[2]: https://www.2daygeek.com/linux-command-to-create-a-file/ -[3]: https://www.2daygeek.com/empty-a-file-delete-contents-lines-from-a-file-remove-matching-string-from-a-file-remove-empty-blank-lines-from-a-file/ diff --git a/translated/tech/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md b/translated/tech/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md new file mode 100644 index 0000000000..e9e320a97b --- /dev/null +++ b/translated/tech/20190211 How To Remove-Delete The Empty Lines In A File In Linux.md @@ -0,0 +1,194 @@ +[#]: collector: (lujun9972) +[#]: translator: ( pityonline ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Remove/Delete The Empty Lines In A File In Linux) +[#]: via: (https://www.2daygeek.com/remove-delete-empty-lines-in-a-file-in-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +在 Linux 中如何删除文件中的空行 +====== + +有时你可能需要在 Linux 中删除某个文件中的空行。 + +如果是的,你可以使用下面方法中的其中一个。 + +有很多方法可以做到,但我在这里只是列举一些简单的方法。 + +你可能已经知道 `grep`,`awk` 和 `sed` 命令是专门用来处理文本数据的工具。 + +如果你想了解更多关于这些命令的文章,请访问这几个 URL。**[在 Linux 中创建指定大小的文件的几种方法][1]**,**[在 Linux 中创建一个文件的几种方法][2]** 以及 **[在 Linux 中删除一个文件中的匹配的字符串][3]**。 + +这些属于高级命令,它们可用在大多数 shell 脚本中执行所需的操作。 + +下列 5 种方法可以做到。 + +* **`sed:`** 过滤和替换文本的流编辑器。 +* **`grep:`** 输出匹配到的行。 +* **`cat:`** 合并文件并打印内容到标准输出。 +* **`tr:`** 替换或删除字符。 +* **`awk:`** awk 工具用于执行 awk 语言编写的程序,专门用于文本处理。 +* **`perl:`** Perl 是一种用于处理文本的编程语言。 + +我创建了一个 `2daygeek.txt` 文件来测试这些命令。下面是文件的内容。 + +``` +$ cat 2daygeek.txt +2daygeek.com is a best Linux blog to learn Linux. + +It's FIVE years old blog. + +This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0. + +He got two GIRL babys. + +Her names are Tanisha & Renusha. +``` + +现在一切就绪,我们准备开始用多种方法来验证。 + +### 使用 sed 命令 + +sed 是一个流编辑器stream editor。流编辑器是用来编辑输入流(文件或管道)中的文本的。 + +``` +$ sed '/^$/d' 2daygeek.txt +2daygeek.com is a best Linux blog to learn Linux. +It's FIVE years old blog. +This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0. +He got two GIRL babes. +Her names are Tanisha & Renusha. +``` + +以下是命令展开的细节: + +* **`sed:`** 该命令本身。 +* **`//:`** 标记匹配范围。 +* **`^:`** 匹配字符串开头。 +* **`$:`** 匹配字符串结尾。 +* **`d:`** 删除匹配的字符串。 +* **`2daygeek.txt:`** 源文件名。 + +### 使用 grep 命令 + +`grep` 可以通过正则表达式在文件中搜索。该表达式可以是一行或多行空行分割的字符,`grep` 会打印所有匹配的内容。 + +``` +$ grep . 2daygeek.txt +or +$ grep -Ev "^$" 2daygeek.txt +or +$ grep -v -e '^$' 2daygeek.txt +2daygeek.com is a best Linux blog to learn Linux. +It's FIVE years old blog. +This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0. +He got two GIRL babes. +Her names are Tanisha & Renusha. +``` + +Details are follow: +以下是命令展开的细节: + +* **`grep:`** 该命令本身。 +* **`.:`** 替换任意字符。 +* **`^:`** 匹配字符串开头。 +* **`$:`** 匹配字符串结尾。 +* **`E:`** 使用扩展正则匹配模式。 +* **`e:`** 使用常规正则匹配模式。 +* **`v:`** 反向匹配。 +* **`2daygeek.txt:`** 源文件名。 + +### 使用 awk 命令 + +`awk` 可以执行使用 awk 语言写的脚本,大多是专用于处理文本的。awk 脚本是一系列 awk 命令和正则的组合。 + +``` +$ awk NF 2daygeek.txt +or +$ awk '!/^$/' 2daygeek.txt +or +$ awk '/./' 2daygeek.txt +2daygeek.com is a best Linux blog to learn Linux. +It's FIVE years old blog. +This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0. +He got two GIRL babes. +Her names are Tanisha & Renusha. +``` + +以下是命令展开的细节: + +* **`awk:`** 该命令本身。 +* **`//:`** 标记匹配范围。 +* **`^:`** 匹配字符串开头。 +* **`$:`** 匹配字符串结尾。 +* **`.:`** 匹配任意字符。 +* **`!:`** 删除匹配的字符串。 +* **`2daygeek.txt:`** 源文件名。 + +### 使用 cat 和 tr 命令 组合 + +`cat` 是串联(拼接)concatenate的简写。经常用于在 Linux 中读取一个文件的内容。 + +cat 是在类 Unix 系统中使用频率最高的命令之一。它提供了常用的三个处理文本文件的功能:显示文件内容,将多个文件拼接成一个,以及创建一个新文件。 + +tr 可以将标准输入中的字符转换,压缩或删除,然后重定向到标准输出。 + +``` +$ cat 2daygeek.txt | tr -s '\n' +2daygeek.com is a best Linux blog to learn Linux. +It's FIVE years old blog. +This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0. +He got two GIRL babes. +Her names are Tanisha & Renusha. +``` + +以下是命令展开的细节: + +* **`cat:`** cat 命令本身。 +* **`tr:`** tr 命令本身。 +* **`|:`** 管道符号。它可以将前面的命令的标准输出作为下一个命令的标准输入。 +* **`s:`** 替换标数据集中任意多个重复字符为一个。 +* **`\n:`** 添加一个新的换行。 +* **`2daygeek.txt:`** 源文件名。 + +### 使用 perl 命令 + +Perl 表示实用的提取和报告语言Practical Extraction and Reporting Language。Perl 在初期被设计为一个专用于文本处理的编程语言,现在已扩展应用到 Linux 系统管理,网络编程和网站开发等多个领域。 + +``` +$ perl -ne 'print if /\S/' 2daygeek.txt +2daygeek.com is a best Linux blog to learn Linux. +It's FIVE years old blog. +This website is maintained by Magesh M, it's licensed under CC BY-NC 4.0. +He got two GIRL babes. +Her names are Tanisha & Renusha. +``` + +以下是命令展开的细节: + +* **`perl:`** perl 命令。 +* **`n:`** 逐行读入数据。 +* **`e:`** 执行某个命令。 +* **`print:`** 打印信息。 +* **`if:`** if 条件分支。 +* **`//:`** 标记匹配范围。 +* **`\S:`** 匹配任意非空白字符。 +* **`2daygeek.txt:`** 源文件名。 + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/remove-delete-empty-lines-in-a-file-in-linux/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[pityonline](https://github.com/pityonline) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/create-a-file-in-specific-certain-size-linux/ +[2]: https://www.2daygeek.com/linux-command-to-create-a-file/ +[3]: https://www.2daygeek.com/empty-a-file-delete-contents-lines-from-a-file-remove-matching-string-from-a-file-remove-empty-blank-lines-from-a-file/ From b66058e9533d71e589a1d13949a3767359a1f087 Mon Sep 17 00:00:00 2001 From: pityonline Date: Sun, 17 Mar 2019 00:40:19 +0800 Subject: [PATCH 284/796] 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 285/796] 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 286/796] 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 287/796] 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 288/796] 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 289/796] 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 290/796] 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 291/796] 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 292/796] 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 293/796] 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 294/796] =?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 295/796] 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 296/796] 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 297/796] 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 298/796] 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 299/796] =?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 300/796] [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 301/796] 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 302/796] 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 303/796] 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 304/796] 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 305/796] 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 306/796] 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 307/796] 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 308/796] 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 309/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190315=20How=20?= =?UTF-8?q?to=20create=20portable=20documents=20with=20CBZ=20and=20DjVu=20?= =?UTF-8?q?sources/tech/20190315=20How=20to=20create=20portable=20document?= =?UTF-8?q?s=20with=20CBZ=20and=20DjVu.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...te portable documents with CBZ and DjVu.md | 317 ++++++++++++++++++ 1 file changed, 317 insertions(+) create mode 100644 sources/tech/20190315 How to create portable documents with CBZ and DjVu.md diff --git a/sources/tech/20190315 How to create portable documents with CBZ and DjVu.md b/sources/tech/20190315 How to create portable documents with CBZ and DjVu.md new file mode 100644 index 0000000000..70f292e827 --- /dev/null +++ b/sources/tech/20190315 How to create portable documents with CBZ and DjVu.md @@ -0,0 +1,317 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to create portable documents with CBZ and DjVu) +[#]: via: (https://opensource.com/article/19/3/comic-book-archive-djvu) +[#]: author: (Seth Kenlon (Red Hat, Community Moderator) https://opensource.com/users/seth) + +How to create portable documents with CBZ and DjVu +====== + +Stop using PDFs with these two smart digital archive formats. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/books_stack_library_reading.jpg?itok=uulcS8Sw) + +Recently, I discovered that my great-great-grandfather wrote two books near the turn of the 20th century: one about sailing and the other about his career as [New York City's fire chief][1]. The books have a niche audience, but since they are part of my family history, I wanted to preserve a digital copy of each. But, I wondered, what portable document format is best suited for such an endeavor? + +I decided early on that PDF was not an option. The format, while good for printing preflight, seems condemned to nonstop feature bloat, and it produces documents that are difficult to introspect and edit. I wanted a smarter format with similar features. Two came to mind: comic book archive and DjVu. + +### Comic book archive + +[Comic book archive][2] is a simple format most often used, as the name suggests, for comic books. You can see examples of comic book archives on sites like [Comic Book Plus][3] and [The Digital Comic Museum][4]. + +The greatest feature of a comic book archive is also its weakest: it's so simple, it's almost more of a convention than a format. In fact, a comic book archive is just a ZIP, TAR, 7Z, or RAR archive given the extension .cbz, .cbt, .cb7, or .cbr, respectively. It has no standard for storing metadata. + +They are, however, very easy to create. + +#### Creating comic book archives + + 1. Create a directory full of image files, and rename the images so that they have an inherent order: + +``` +$ n=0 && for i in *.png ; do mv $i `printf %04d $n`.png ; done +``` + + + + 2. Archive the files using your favorite archive tool. In my experience, CBZ is best supported. + +``` +$ zip comicbook.zip -r *.png +``` + + + + 3. Finally, rename the file with the appropriate extension. + +``` +$ mv comicbook.zip comicbook.cbz +``` + + + + +The resulting file should open on most of your devices. On Linux, both [Evince][5] and [Okular][6] can open CBZ files. On Android, [Document Viewer][7] and [Bubble][8] can open them. + +#### Uncompressing comic book archives + +Getting your data back out of a comic book archive is also easy: just unarchive the CBZ file. + +Since your favorite archive tool may not recognize the .cbz extension as a valid archive, it's best to rename it back to its native extension: +``` + +``` + +$ mv comicbook.cbz comicbook.zip +$ unzip comicbook.zip + +### DjVu + +A more advanced format, developed more than 20 years ago by AT&T, is [DjVu][9] (pronounced "déjà vu"). It's a digital document format with advanced compression technology and is viewable in more applications than you probably realize, including [Evince][5], [Okular][6], [DjVu.js][10] online, the [DjVu.js viewer][11] Firefox extension, [GNU Emacs][12], [Document Viewer][7] on Android, and the open source, cross-platform [DjView][13] viewer on Sourceforge. + +You can read more about DjVu and find sample .djvu files, at [djvu.org][14]. + +DjVu has several appealing features, including image compression, outline (bookmark) structure, and support for embedded text. It's easy to introspect and edit using free and open source tools. + +#### Installing DjVu + +The open source toolchain is [DjVuLibre][15], which you can find in your distribution's software repository. For example, on Fedora: + +``` +$ sudo dnf install dvjulibre +``` + +#### Creating a DjVu file + +A .djvu is an image that has been encoded as a DjVu file. A .djvu can contain one or more images (stored as "pages"). + +To manually produce a DjVu, you can use one of two encoders: **c44** for high-quality images or **cjb2** for simple bi-tonal images. Each encoder accepts a different image format: c44 can process .pnm or .jpeg files, while cjb2 can process .pbm or .tiff images. + +If you need to preprocess an image, you can do that in a terminal with [Image Magick][16], using the **-density** option to define your desired resolution: + +``` +$ convert -density 200 foo.png foo.pnm +``` + +Then you can convert it to DjVu: + +``` +$ c44 -dpi 200 foo.pnm foo.djvu +``` + +If your image is simple, like black text on a white page, you can try to convert it using the simpler encoder. If necessary, use Image Magick first to convert it to a compatible intermediate format: + +``` +$ convert -density 200 foo.png foo.pbm +``` + +And then convert it to DjVu: + +``` +$ cjb2 -dpi 200 foo.pbm foo.djvu +``` + +You now have a simple, single-page .djvu document. + +#### Creating a multi-page DjVu file + +While a single-page DjVu can be useful, given DjVu's sometimes excellent compression, it's most commonly used as a multi-page format. + +Assuming you have a directory of many .djvu files, you can bundle them together with the **djvm** command: + +``` +$ djvm -c pg_1.djvu two.djvu 003.djvu mybook.djvu +``` + +Unlike a CBZ archive, the names of the bundled images have no effect on their order in the DjVu document, rather it preserves the order you provide in the command. If you had the foresight to name them in a natural sorting order (001.djvu, 002.djvu, 003.djvu, 004.djvu, and so on), you can use a wildcard: + +``` +$ djvm -c *.djvu mybook.djvu +``` + +#### Manipulating a DjVu document + +It's easy to edit DjVu documents with **djvm**. For instance, you can insert a page into an existing DjVu document: + +``` +$ djvm -i mybook.djvu newpage.djvu 2 +``` + +In this example, the page _newpage.djvu_ becomes the new page 2 in the file _mybook.djvu_. + +You can also delete a page. For example, to delete page 4 from _mybook.djvu_ : + +``` +$ djvm -d mybook.djvu 4 +``` + +#### Setting an outline + +You can add metadata to a DjVu file, such as an outline (commonly called "bookmarks"). To do this manually, create a plaintext file with the document's outline. A DjVu outline is expressed in a [Lisp][17]-like structure, with an opening **bookmarks** element followed by bookmark names and page numbers: +``` +(bookmarks +("Front cover" "#1") +("Chapter 1" "#3") +("Chapter 2" "#18") +("Chapter 3" "#26") +) +``` + +The parentheses define levels in the outline. The outline currently has only top-level bookmarks, but any section can have a subsection by delaying its closing parenthesis. For example, to add a subsection to Chapter 1: +``` +(bookmarks +("Front cover" "#1") +("Chapter 1" "#3" +("Section 1" "#6")) +("Chapter 2" "#18") +("Chapter 3" "#26") +) +``` + +Once the outline is complete, save the file and apply it to your DjVu file using the **djvused** command: + +``` +$ djvused -e 'set-outline outline.txt' -s mybook.djvu +``` + +Open the DjVu file to see the outline. + +![A DjVu with an outline as viewed in Okular][19] + +#### Embedding text + +If you want to store the text of a document you're creating, you can embed text elements ("hidden text" in **djvused** terminology) in your DjVu file so that applications like Okular or DjView can select and copy the text to a user's clipboard. + +This is a complex operation because, in order to embed text, you must first have text. If you have access to a good OCR application (or the time and dedication to transcribe the printed page), you may have that data, but then you must map the text to the bitmap image. + +Once you have the text and the coordinates for each line (or, if you prefer, for each word), you can write a **djvused** script with blocks for each page: +``` +select; remove-ant; remove-txt +# ------------------------- +select "p0004.djvu" # page 4 +set-txt +(page 0 0 2550 3300 +(line 1661 2337 2235 2369 "Fires and Fire-fighters") +(line 1761 2337 2235 2369 "by John Kenlon")) + +. +# ------------------------- +select "p0005.djvu" # page 5 +set-txt +(page 0 0 2550 3300 +(line 294 2602 1206 2642 "Some more text here, blah blah blah.")) +``` + +The integers for each line represent the minimum and maximum locations for the X and Y coordinates of each line ( **xmin** , **ymin** , **xmax** , **ymax** ). Each line is a rectangle measured in pixels, with an origin at the _bottom-left_ corner of the page. + +You can define embedded text elements as words, lines, and hyperlinks, and you can map complex regions with shapes other than just rectangles. You can also embed specially defined metadata, such as BibTex keys, which are expressed in lowercase (year, booktitle, editor, author, and so on), and DocInfo keys, borrowed from the PDF spec, always starting with an uppercase letter (Title, Author, Subject, Creator, Produced, CreationDate, ModDate, and so on). + +#### Automating DjVu creation + +While it's nice to be able to handcraft a finely detailed DjVu document, if you adopt DjVu as an everyday format, you'll notice that your applications lack some of the conveniences available in the more ubiquitous PDF. For instance, few (if any) applications offer a convenient _Print to DjVu_ or _Export to DjVu_ option, as they do for PDF. + +However, you can still use DjVu by leveraging PDF as an intermediate format. + +Unfortunately, the library required for easy, automated DjVu conversion is licensed under the CPL, which has requirements that cannot be satisfied by the GPL code in the toolchain. For this reason, it can't be distributed as a compiled library, but you're free to compile it yourself. + +The process is relatively simple due to an excellent build script provided by the DjVuLibre team. + + 1. First, prepare your system with software development tools. On Fedora, the quick-and-easy way is with a DNF group: + +``` +$ sudo dnf group install @c-development +``` + +On Ubuntu: + +``` +$ sudo apt-get install build-essential +``` + + + + 2. Next, download the [**GSDjVu** source code][20] from Sourceforge. Be sure to download **GSDjVu** , not **DjVuLibre** (in other words, don't click on the big green button at the top of the file listing, but on the latest file instead). + + + 3. Unarchive the file you just downloaded, and change directory into it: +``` +$ cd ~/Downloads +$ tar xvf gsdjvu-X.YY.tar.gz +$ cd gsdjvu-X.YY +``` + + + + 4. Create a directory called **BUILD**. It must be called **BUILD** , so quell your creativity: +``` +$ mkdir BUILD +$ cd BUILD +``` + + + + 5. Download the additional source packages required to build the **GSDjVu **application. Specifically, you must download the source for **Ghostscript** (you almost certainly already have this installed, but you need its source to build against). Additionally, your system must have source packages for **jpeg** , **libpng** , **openjpeg** , and **zlib**. If you think your system already has the source packages for these projects, you can run the build script; if the sources are not found, the script will fail and let you correct the error before trying again. + + + 6. Run the interactive **build-gsdjvu** build script included in the download. This script unpacks the source files, patches Ghostscript with the **gdevdjvu** driver, compiles Ghostscript, and prunes unnecessary files from the build results. + + + 7. You can install **GSDjVu **anywhere in your path. If you don't know what your **PATH** variable is, you can see it with **echo $PATH**. For example, to install it to the **/usr/local** prefix: +``` +$ sudo cp -r BUILD/INST/gsdjvu /usr/local/lib64 +$ cd /usr/local/bin +$ sudo ln -s ../lib64/gsdjvu/gsdjvu gsdjvu +``` + + + + +#### Converting a PDF to DjVu + +Now that you've built the Ghostscript driver, converting a PDF to DjVu requires just one command: + +``` +$ djvudigital --words mydocument.pdf mydocument.djvu +``` + +This transforms all pages, bookmarks, and embedded text in a PDF into a DjVu file. The `--words` option maps all mapped embedded PDF text to the corresponding points in the DjVu file. If there is no embedded PDF, then no embedded text is carried over. Using this tool, you can use convenient PDF functions from your applications and end up with DjVu files. + +### Why DjVu and CBZ? + +DjVu and comic book archive are great additional document formats for your archival arsenal. It seems silly to stuff a series of images into a PostScript format, like PDF, or a format clearly meant mostly for text, like EPUB, so it's nice to have CBZ and DjVu as additional options. They might not be right for all of your documents, but it's good to get comfortable with them so you can use one when it makes the most sense. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/comic-book-archive-djvu + +作者:[Seth Kenlon (Red Hat, Community Moderator)][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://www.fireengineering.com/articles/print/volume-56/issue-27/features/chief-john-kenlon-of-new-york-city.html +[2]: https://en.wikipedia.org/wiki/Comic_book_archive +[3]: https://comicbookplus.com/ +[4]: https://digitalcomicmuseum.com/ +[5]: https://wiki.gnome.org/Apps/Evince +[6]: https://okular.kde.org +[7]: https://f-droid.org/en/packages/org.sufficientlysecure.viewer/ +[8]: https://f-droid.org/en/packages/com.nkanaev.comics/ +[9]: http://djvu.org/ +[10]: http://djvu.js.org/ +[11]: https://github.com/RussCoder/djvujs +[12]: https://elpa.gnu.org/packages/djvu.html +[13]: http://djvu.sourceforge.net/djview4.html +[14]: http://djvu.org +[15]: http://djvu.sourceforge.net +[16]: https://www.imagemagick.org/ +[17]: https://en.wikipedia.org/wiki/Lisp_(programming_language) +[18]: /file/426061 +[19]: https://opensource.com/sites/default/files/uploads/outline.png (A DjVu with an outline as viewed in Okular) +[20]: https://sourceforge.net/projects/djvu/files/GSDjVu/1.10/ From 021cbf308981e16775adaacc82f6f4ed3e8d7563 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 18 Mar 2019 11:09:34 +0800 Subject: [PATCH 310/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190315=20Sweet?= =?UTF-8?q?=20Home=203D:=20An=20open=20source=20tool=20to=20help=20you=20d?= =?UTF-8?q?ecide=20on=20your=20dream=20home=20sources/tech/20190315=20Swee?= =?UTF-8?q?t=20Home=203D-=20An=20open=20source=20tool=20to=20help=20you=20?= =?UTF-8?q?decide=20on=20your=20dream=20home.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...l to help you decide on your dream home.md | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 sources/tech/20190315 Sweet Home 3D- An open source tool to help you decide on your dream home.md diff --git a/sources/tech/20190315 Sweet Home 3D- An open source tool to help you decide on your dream home.md b/sources/tech/20190315 Sweet Home 3D- An open source tool to help you decide on your dream home.md new file mode 100644 index 0000000000..63c9e5f282 --- /dev/null +++ b/sources/tech/20190315 Sweet Home 3D- An open source tool to help you decide on your dream home.md @@ -0,0 +1,73 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Sweet Home 3D: An open source tool to help you decide on your dream home) +[#]: via: (https://opensource.com/article/19/3/tool-find-home) +[#]: author: (Jeff Macharyas (Community Moderator) ) + +Sweet Home 3D: An open source tool to help you decide on your dream home +====== + +Interior design application makes it easy to render your favorite house—real or imaginary. + +![Houses in a row][1] + +I recently accepted a new job in Virginia. Since my wife was working and watching our house in New York until it sold, it was my responsibility to go out and find a new house for us and our cat. A house that she would not see until we moved into it! + +I contracted with a real estate agent and looked at a few houses, taking many pictures and writing down illegible notes. At night, I would upload the photos into a Google Drive folder, and my wife and I would review them simultaneously over the phone while I tried to remember whether the room was on the right or the left, whether it had a fan, etc. + +Since this was a rather tedious and not very accurate way to present my findings, I went in search of an open source solution to better illustrate what our future dream house would look like that wouldn't hinge on my fuzzy memory and blurry photos. + +[Sweet Home 3D][2] did exactly what I wanted it to do. Sweet Home 3D is available on Sourceforge and released under the GNU General Public License. The [website][3] is very informative, and I was able to get it up and running in no time. Sweet Home 3D was developed by Paris-based Emmanuel Puybaret of eTeks. + +### Hanging the drywall + +I downloaded Sweet Home 3D onto my MacBook Pro and added a PNG version of a flat floorplan of a house to use as a background base map. + +From there, it was a simple matter of using the Rooms palette to trace the pattern and set the "real life" dimensions. After I mapped the rooms, I added the walls, which I could customize by color, thickness, height, etc. + +![Sweet Home 3D floorplan][5] + +Now that I had the "drywall" built, I downloaded various pieces of "furniture" from a large array that includes actual furniture as well as doors, windows, shelves, and more. Each item downloads as a ZIP file, so I created a folder of all my uncompressed pieces. I could customize each piece of furniture, and repetitive items, such as doors, were easy to copy-and-paste into place. + +Once I had all my walls and doors and windows in place, I used the application's 3D view to navigate through the house. Drawing upon my photos and memory, I made adjustments to all the objects until I had a close representation of the house. I could have spent more time modifying the house by adding textures, additional furniture, and objects, but I got it to the point I needed. + +![Sweet Home 3D floorplan][7] + +After I finished, I exported the plan as an OBJ file, which can be opened in a variety of programs, such as [Blender][8] and Preview on the Mac, to spin the house around and examine it from various angles. The Video function was most useful, as I could create a starting point, draw a path through the house, and record the "journey." I exported the video as a MOV file, which I opened and viewed on the Mac using QuickTime. + +My wife was able to see (almost) exactly what I saw, and we could even start arranging furniture ahead of the move, too. Now, all I have to do is load up the moving truck and head south. + +Sweet Home 3D will also prove useful at my new job. I was looking for a way to improve the map of the college's buildings and was planning to just re-draw it in [Inkscape][9] or Illustrator or something. However, since I have the flat map, I can use Sweet Home 3D to create a 3D version of the floorplan and upload it to our website to make finding the bathrooms so much easier! + +### An open source crime scene? + +An interesting aside: according to the [Sweet Home 3D blog][10], "the French Forensic Police Office (Scientific Police) recently chose Sweet Home 3D as a tool to design plans [to represent roads and crime scenes]. This is a concrete application of the recommendation of the French government to give the preference to free open source solutions." + +This is one more bit of evidence of how open source solutions are being used by citizens and governments to create personal projects, solve crimes, and build worlds. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/tool-find-home + +作者:[Jeff Macharyas (Community Moderator)][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/house_home_colors_live_building.jpg?itok=HLpsIfIL (Houses in a row) +[2]: https://sourceforge.net/projects/sweethome3d/ +[3]: http://www.sweethome3d.com/ +[4]: /file/426441 +[5]: https://opensource.com/sites/default/files/uploads/virginia-house-create-screenshot.png (Sweet Home 3D floorplan) +[6]: /file/426451 +[7]: https://opensource.com/sites/default/files/uploads/virginia-house-3d-screenshot.png (Sweet Home 3D floorplan) +[8]: https://opensource.com/article/18/5/blender-hotkey-cheat-sheet +[9]: https://opensource.com/article/19/1/inkscape-cheat-sheet +[10]: http://www.sweethome3d.com/blog/2018/12/10/customization_for_the_forensic_police.html From 9d31ac816598c5afd407e171431558a00fa8bf1a Mon Sep 17 00:00:00 2001 From: sanfusu <34563541+sanfusu@users.noreply.github.com> Date: Mon, 18 Mar 2019 14:42:59 +0800 Subject: [PATCH 311/796] 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 312/796] 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 313/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190314=20Why=20?= =?UTF-8?q?feedback,=20not=20metrics,=20is=20critical=20to=20DevOps=20sour?= =?UTF-8?q?ces/talk/20190314=20Why=20feedback,=20not=20metrics,=20is=20cri?= =?UTF-8?q?tical=20to=20DevOps.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ack, not metrics, is critical to DevOps.md | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 sources/talk/20190314 Why feedback, not metrics, is critical to DevOps.md diff --git a/sources/talk/20190314 Why feedback, not metrics, is critical to DevOps.md b/sources/talk/20190314 Why feedback, not metrics, is critical to DevOps.md new file mode 100644 index 0000000000..b2a79226ed --- /dev/null +++ b/sources/talk/20190314 Why feedback, not metrics, is critical to DevOps.md @@ -0,0 +1,84 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why feedback, not metrics, is critical to DevOps) +[#]: via: (https://opensource.com/article/19/3/devops-feedback-not-metrics) +[#]: author: (Ranjith Varakantam (Red Hat) https://opensource.com/users/ranjith) + +Why feedback, not metrics, is critical to DevOps +====== + +Metrics can tell you some things, but not the most important things about how your products and teams are doing. + +![CICD with gears][1] + +Most managers and agile coaches depend on metrics over feedback from their teams, users, and even customers. In fact, quite a few use feedback and metrics synonymously, where they present feedback from teams or customers as a bunch of numbers or a graphical representation of those numbers. This is not only unfortunate, but it can be misleading as it presents only part of the story and not the entire truth. + +When it comes to two critical factors—how we manage or guide our teams and how we operate and influence the product that our teams are developing—few exceptional leaders and teams get it right. For one thing, it has become very easy to get your hands on data and metrics. Furthermore, it's still hard to get real feedback from teams and users. It requires significant investments and energy, and unless everyone understands the critical need for it, getting and giving feedback tends to be a low priority and keeps getting pushed to the back burner. + +### How to manage and guide teams + +With the acceptance of agile, a lot of teams have put a ridiculously high value on metrics, such as velocity, burndown charts, cumulative flow diagram (CFD), etc., instead of the value delivered by the team in each iteration or deployment. The focus is on the delivery or output produced without a clear understanding of how this relates to personal performance or implications for the project, product, or service. + +A few managers and agile coaches even abuse the true spirit of agile by misusing metrics to chastise or even penalize their teams. Instead of creating an environment of empowerment, they are slipping back into the command-and-control method where metrics are used to bully teams into submission. + +In our group, the best managers have weekly one-on-one meetings with every team member. These meetings not only give them a real pulse on team morale but also a profound understanding of the project and the decisions being made to move it forward. This weekly feedback loop also helps the team members communicate technical, functional, and even personal issues better. As a result, the team is much more cohesive in understanding the overall project needs and able to make decisions promptly. + +These leaders also skip levels—reaching out to team members two or three levels below them—and have frequent conversations with other group members who interact with their teams on a regular basis. These actions give the managers a holistic picture, which they couldn't get if they relied on feedback from one manager or lead, and help them identify any blind spots the leads and managers may have. + +These one-on-one meetings effectively transform a manager into a coach who has a close understanding of every team member. Like a good coach, these managers both give and receive feedback from the team members regarding the product, decision-making transparency, places where the team feels management is lagging, and areas that are being ignored. This empowers the teams by giving them a voice, not once in a while in an annual meeting or an annual survey, but every week. This is the level where DevOps teams should be in order to deliver their commitments successfully. + +This demands significant investments of time and energy, but the results more than justify it. The alternative is to rely on metrics and annual reviews and surveys, which has failed miserably. Unless we begin valuing feedback over metrics, we will keep seeing the metrics we want to see but failed projects and miserable team morale. + +### Influencing projects and product development + +We see similar behavior on the project or product side, with too few conversations with the users and developers and too much focus on metrics. Let's take the example of a piece of software that was released to the community or market, and the primary success metric is the number of downloads or installs. This can be deceiving for several reasons: + + 1. This product was packaged into another piece of software that users installed; even though the users are not even aware of your product's existence or purpose, it is still counted as a win and something the user needs. + + 2. The marketing team spent a huge budget promoting the product—and even offered an incentive to developers to download it. The _incentive_ drives the downloads, not user need or desire, but the metric is still considered a measure of success. + + 3. Software updates are counted as downloads, even when they are involuntary updates pushed rather than initiated by the user. This keeps bumping up the number, even though the user might have used it once, a year ago, for a specific task. + + + + +In these cases, the user automatically becomes a metric that's used to report how well the product is doing, just based on the fact it was downloaded and it's accepting updates, regardless of whether the user likes or uses the software. Instead, we should be focusing on actual usage of the product and the feedback these users have to offer us, rather than stopping short at the download numbers. + +The same holds true for SaaS products—instead of counting the number of signups, we should look at how often users use the product or service. Signups by themselves have little meaning, especially to the DevOps team where the focus is on getting constant feedback and striving for continuous improvements. + +### Gathering feedback + +So, why do we rely on metrics so much? My guess is they are easy to collect, and the marketing team is more interested in getting the product into the users' hands than evaluating how it is fairing. Unless the engineering team invests quite a bit of time in collecting feedback with tracing, which captures how often the program is executed and which components are used most often, it can be difficult to collect feedback. + +A big advantage of working in an open source community is that we first release the piece of software into a community where we can get feedback. Most open source enthusiasts take the time to log issues and bugs based on their experience with the product. If we can supplement this data with tracing, the team has an accurate record of how the product is used. + +Open as many channels of communication as possible–chat, email, Twitter, etc.—and allow users to choose their feedback channel. + +A few DevOps teams have integrated blue-green deployments, A/B testing, and canary releases to shorten the feedback loop. Setting up these frameworks it is not a trivial matter and calls for a huge upfront investment and constant updates to make them seamlessly work. But once everything is set up and data begins to flow, the team can act upon real feedback based on real user interactions with every new bit of software released. + +Most agile practitioners and lean movement activists push for a build-deploy-measure-learn cycle, and for this to happen, we need to collect feedback in addition to metrics. It might seem expensive and time consuming in the short term, but in the long run, it is a foolproof way of learning. + +### Proof that feedback pays off + +Whether it pertains to people or projects, it pays to rely on first-hand feedback rather than metrics, which are seldom interpreted in impartial ways. We have ample proof of this in other industries, where companies such as Zappos and the Virgin Group have done wonders for their business simply by listening to their customers. There is no reason we cannot follow suit, especially those of us working in open source communities. + +Feedback is the only effective way we can uncover our blind spots. Metrics are not of much help in this regard, as we can't find out what's wrong when we are dealing with unknowns. Blind spots can create serious gaps between reality and what we think we know. Feedback not only encourages continuous improvement, whether it's on a personal or a product level, but the simple act of listening and acting on it increases trust and loyalty. + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/devops-feedback-not-metrics + +作者:[Ranjith Varakantam (Red Hat)][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ranjith +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cicd_continuous_delivery_deployment_gears.png?itok=kVlhiEkc (CICD with gears) From cf8575f619eb6692482263e678bb966463d62850 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 18 Mar 2019 15:01:11 +0800 Subject: [PATCH 314/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190316=20Progra?= =?UTF-8?q?m=20the=20real=20world=20using=20Rust=20on=20Raspberry=20Pi=20s?= =?UTF-8?q?ources/tech/20190316=20Program=20the=20real=20world=20using=20R?= =?UTF-8?q?ust=20on=20Raspberry=20Pi.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...e real world using Rust on Raspberry Pi.md | 141 ++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 sources/tech/20190316 Program the real world using Rust on Raspberry Pi.md diff --git a/sources/tech/20190316 Program the real world using Rust on Raspberry Pi.md b/sources/tech/20190316 Program the real world using Rust on Raspberry Pi.md new file mode 100644 index 0000000000..773fd1cc10 --- /dev/null +++ b/sources/tech/20190316 Program the real world using Rust on Raspberry Pi.md @@ -0,0 +1,141 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Program the real world using Rust on Raspberry Pi) +[#]: via: (https://opensource.com/article/19/3/physical-computing-rust-raspberry-pi) +[#]: author: (Rahul Thakoor https://opensource.com/users/rahul27) + +Program the real world using Rust on Raspberry Pi +====== + +rust_gpizero uses the Rust programming language to do physical computing on the Raspberry Pi. + +![][1] + +If you own a Raspberry Pi, chances are you may already have experimented with physical computing—writing code to interact with the real, physical world, like blinking some LEDs or [controlling a servo motor][2]. You may also have used [GPIO Zero][3], a Python library that provides a simple interface to GPIO devices from Raspberry Pi with a friendly Python API. GPIO Zero is developed by [Opensource.com][4] community moderator [Ben Nuttall][5]. + +I am working on [**rust_gpiozero**][6], a port of the awesome GPIO Zero library that uses the Rust programming language. It is still a work in progress, but it already includes some useful components. + +[Rust][7] is a systems programming language developed at Mozilla. It is focused on performance, reliability, and productivity. The Rust website has [great resources][8] if you'd like to learn more about it. + +### Getting started + +Before starting with rust_gpiozero, it's smart to have a basic grasp of the Rust programming language. I recommend working through at least the first three chapters in [The Rust Programming Language][9] book. + +I recommend [installing Rust][10] on your Raspberry Pi using [**rustup**][11]. Alternatively, you can set up a cross-compilation environment using [cross][12] (which works only on an x86_64 Linux host) or [this how-to][13]. + +After you've installed Rust, create a new Rust project by entering: + +``` +cargo new rust_gpiozero_demo +``` + +Add **rust_gpiozero** as a dependency (currently in v0.2.0) by adding the following to the dependencies section in your **Cargo.toml** file + +``` +rust_gpiozero = "0.2.0" +``` + +Next, blink an LED—the "hello world" of physical computing by modifying the **main.rs** file with the following: +``` +use rust_gpiozero::*; +use std::thread; +use std::time::Duration; + +fn main() { + // Create a new LED attached to Pin 17 + let led = LED::new(17); + + // Blink the LED 5 times + for _ in 0.. 5{ + led.on(); + thread::sleep(Duration::from_secs(1)); + led.off(); + thread::sleep(Duration::from_secs(1)); + } +} +``` + +rust_gpiozero provides an easier interface for blinking an LED. You can use the blink method, providing the number of seconds it should stay on and off. This simplifies the code to the following: +``` +use rust_gpiozero::*; +fn main() { + // Create a new LED attached to Pin 17 + let mut led = LED::new(17); + + // on_time = 2 secs, off_time=3 secs + led.blink(2.0,3.0); + + // prevent program from exiting immediately + led.wait(); +} +``` + +### Other components + +rust_gpiozero provides several components that are similar to GPIO Zero for controlling output and input devices. These include [LED][14], [Buzzer][15], [Motor][16], Pulse Width Modulation LED ([PWMLED][17]), [Servo][18], and [Button][19]. + +Support for other components, sensors, and devices will be added eventually. You can refer to the [documentation][20] for further usage information. + +### More resources + +rust_gpiozero is still a work in progress. If you need more resources for getting started with Rust on your Raspberry Pi, here are some useful links: + +#### Raspberry Pi Peripheral Access Library (RPPAL) + +Similar to GPIO Zero, which is based on the [RPi.GPIO][21] library, rust_gpiozero builds upon the awesome **[RPPAL][22]** library by [Rene van der Meer][23]. If you want more control for your projects using Rust, you should definitely try RPPAL. It has support for GPIO, Inter-Integrated Circuit (I 2C), hardware and software Pulse Width Modulation (PWM), and Serial Peripheral Interface (SPI). Universal asynchronous receiver-transmitter (UART) support is currently in development. + +#### Sense HAT support + +**[Sensehat-rs][24]** is a library by [Jonathan Pallant][25] ([@therealjpster][26]) that provides Rust support for the Raspberry Pi [Sense HAT][27] add-on board. Jonathan also has a [starter workshop][28] for using the library and he wrote a beginner's intro to use Rust on Raspberry Pi, "Read Sense HAT with Rust," in [Issue 73 of _The MagPi_][29] magazine. + +### Wrap Up + +Hopefully, this has inspired you to use the Rust programming language for physical computing on your Raspberry Pi. rust_gpiozero is a library which provides useful components such as LED, Buzzer, Motor, PWMLED, Servo, and Button. More features are planned and you can follow me on [twitter][30] or check out [my blog][31] to stay tuned. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/physical-computing-rust-raspberry-pi + +作者:[Rahul Thakoor][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003784_02_os.comcareers_os_rh2x.png?itok=jbRfXinl +[2]: https://projects.raspberrypi.org/en/projects/grandpa-scarer/4 +[3]: https://gpiozero.readthedocs.io/en/stable/# +[4]: http://Opensource.com +[5]: https://opensource.com/users/bennuttall +[6]: https://crates.io/crates/rust_gpiozero +[7]: https://www.rust-lang.org/ +[8]: https://www.rust-lang.org/learn +[9]: https://doc.rust-lang.org/book/ +[10]: https://www.rust-lang.org/tools/install +[11]: https://rustup.rs/ +[12]: https://github.com/rust-embedded/cross +[13]: https://github.com/kunerd/clerk/wiki/How-to-use-HD44780-LCD-from-Rust#setting-up-the-cross-toolchain +[14]: https://docs.rs/rust_gpiozero/0.2.0/rust_gpiozero/output_devices/struct.LED.html +[15]: https://docs.rs/rust_gpiozero/0.2.0/rust_gpiozero/output_devices/struct.Buzzer.html +[16]: https://docs.rs/rust_gpiozero/0.2.0/rust_gpiozero/output_devices/struct.Motor.html +[17]: https://docs.rs/rust_gpiozero/0.2.0/rust_gpiozero/output_devices/struct.PWMLED.html +[18]: https://docs.rs/rust_gpiozero/0.2.0/rust_gpiozero/output_devices/struct.Servo.html +[19]: https://docs.rs/rust_gpiozero/0.2.0/rust_gpiozero/input_devices/struct.Button.html +[20]: https://docs.rs/rust_gpiozero/ +[21]: https://pypi.org/project/RPi.GPIO/ +[22]: https://github.com/golemparts/rppal +[23]: https://twitter.com/golemparts +[24]: https://crates.io/crates/sensehat +[25]: https://github.com/thejpster +[26]: https://twitter.com/therealjpster +[27]: https://www.raspberrypi.org/products/sense-hat/ +[28]: https://github.com/thejpster/pi-workshop-rs/ +[29]: https://www.raspberrypi.org/magpi/issues/73/ +[30]: https://twitter.com/rahulthakoor +[31]: https://rahul-thakoor.github.io/ From 385fc136b563ef1efdb234aa1eb76895cadbf78c Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 18 Mar 2019 15:26:04 +0800 Subject: [PATCH 315/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190314=2014=20d?= =?UTF-8?q?ays=20of=20celebrating=20the=20Raspberry=20Pi=20sources/tech/20?= =?UTF-8?q?190314=2014=20days=20of=20celebrating=20the=20Raspberry=20Pi.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...14 days of celebrating the Raspberry Pi.md | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 sources/tech/20190314 14 days of celebrating the Raspberry Pi.md diff --git a/sources/tech/20190314 14 days of celebrating the Raspberry Pi.md b/sources/tech/20190314 14 days of celebrating the Raspberry Pi.md new file mode 100644 index 0000000000..42ea4ab03e --- /dev/null +++ b/sources/tech/20190314 14 days of celebrating the Raspberry Pi.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (14 days of celebrating the Raspberry Pi) +[#]: via: (https://opensource.com/article/19/3/happy-pi-day) +[#]: author: (Anderson Silva (Red Hat) https://opensource.com/users/ansilva) + +14 days of celebrating the Raspberry Pi +====== + +In the 14th and final article in our series on getting started with the Raspberry Pi, take a look back at all the things we've learned. + +![][1] + +**Happy Pi Day!** + +Every year on March 14th, we geeks celebrate Pi Day. In the way we abbreviate dates—MMDD—March 14 is written 03/14, which numerically reminds us of 3.14, or the first three numbers of [pi][2]. What many Americans don't realize is that virtually no other country in the world uses this [date format][3], so Pi Day pretty much only works in the US, though it is celebrated globally. + +Wherever you are in the world, let's celebrate the Raspberry Pi and wrap up this series by reviewing the topics we've covered in the past two weeks: + + * Day 1: [Which Raspberry Pi should you choose?][4] + * Day 2: [How to buy a Raspberry Pi][5] + * Day 3: [How to boot up a new Raspberry Pi][6] + * Day 4: [Learn Linux with the Raspberry Pi][7] + * Day 5: [5 ways to teach kids to program with Raspberry Pi][8] + * Day 6: [3 popular programming languages you can learn with Raspberry Pi][9] + * Day 7: [How to keep your Raspberry Pi updated][10] + * Day 8: [How to use your Raspberry Pi for entertainment][11] + * Day 9: [Play games on the Raspberry Pi][12] + * Day 10: [Let's get physical: How to use GPIO pins on the Raspberry Pi][13] + * Day 11: [Learn about computer security with the Raspberry Pi][14] + * Day 12: [Do advanced math with Mathematica on the Raspberry Pi][15] + * Day 13: [Contribute to the Raspberry Pi community][16] + + + +![Pi Day illustration][18] + +I'll end this series by thanking everyone who was brave enough to follow along and especially those who learned something from it during these past 14 days! I also want to encourage everyone to keep expanding their knowledge about the Raspberry Pi and all of the open (and closed) source technology that has been built around it. + +I also encourage you to learn about other cultures, philosophies, religions, and worldviews. What makes us human is this amazing (and sometimes amusing) ability that we have to adapt not only to external environmental circumstances—but also intellectual ones. + +No matter what you do, keep learning! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/happy-pi-day + +作者:[Anderson Silva (Red Hat)][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/raspberry-pi-juggle.png?itok=oTgGGSRA +[2]: https://www.piday.org/million/ +[3]: https://en.wikipedia.org/wiki/Date_format_by_country +[4]: https://opensource.com/article/19/3/which-raspberry-pi-choose +[5]: https://opensource.com/article/19/3/how-buy-raspberry-pi +[6]: https://opensource.com/article/19/3/how-boot-new-raspberry-pi +[7]: https://opensource.com/article/19/3/learn-linux-raspberry-pi +[8]: https://opensource.com/article/19/3/teach-kids-program-raspberry-pi +[9]: https://opensource.com/article/19/3/programming-languages-raspberry-pi +[10]: https://opensource.com/article/19/3/how-raspberry-pi-update +[11]: https://opensource.com/article/19/3/raspberry-pi-entertainment +[12]: https://opensource.com/article/19/3/play-games-raspberry-pi +[13]: https://opensource.com/article/19/3/gpio-pins-raspberry-pi +[14]: https://opensource.com/article/19/3/learn-about-computer-security-raspberry-pi +[15]: https://opensource.com/article/19/3/do-math-raspberry-pi +[16]: https://opensource.com/article/19/3/contribute-raspberry-pi-community +[17]: /file/426561 +[18]: https://opensource.com/sites/default/files/uploads/raspberrypi_14_piday.jpg (Pi Day illustration) From ff6080d1a675c1254d9b9017f4a98ba96ce59261 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 18 Mar 2019 15:37:45 +0800 Subject: [PATCH 316/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190315=20How=20?= =?UTF-8?q?To=20Parse=20And=20Pretty=20Print=20JSON=20With=20Linux=20Comma?= =?UTF-8?q?ndline=20Tools=20sources/tech/20190315=20How=20To=20Parse=20And?= =?UTF-8?q?=20Pretty=20Print=20JSON=20With=20Linux=20Commandline=20Tools.m?= =?UTF-8?q?d?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Print JSON With Linux Commandline Tools.md | 264 ++++++++++++++++++ 1 file changed, 264 insertions(+) create mode 100644 sources/tech/20190315 How To Parse And Pretty Print JSON With Linux Commandline Tools.md diff --git a/sources/tech/20190315 How To Parse And Pretty Print JSON With Linux Commandline Tools.md b/sources/tech/20190315 How To Parse And Pretty Print JSON With Linux Commandline Tools.md new file mode 100644 index 0000000000..6cf53bdbca --- /dev/null +++ b/sources/tech/20190315 How To Parse And Pretty Print JSON With Linux Commandline Tools.md @@ -0,0 +1,264 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Parse And Pretty Print JSON With Linux Commandline Tools) +[#]: via: (https://www.ostechnix.com/how-to-parse-and-pretty-print-json-with-linux-commandline-tools/) +[#]: author: (EDITOR https://www.ostechnix.com/author/editor/) + +How To Parse And Pretty Print JSON With Linux Commandline Tools +====== + +**JSON** is a lightweight and language independent data storage format, easy to integrate with most programming languages and also easy to understand by humans, of course when properly formatted. The word JSON stands for **J** ava **S** cript **O** bject **N** otation, though it starts with JavaScript, and primarily used to exchange data between server and browser, but now being used in many fields including embedded systems. Here we’re going to parse and pretty print JSON with command line tools on Linux. It’s extremely useful for handling large JSON data in a shell scripts, or manipulating JSON data in a shell script. + +### What is pretty printing? + +The JSON data is structured to be somewhat more human readable. However in most cases, JSON data is stored in a single line, even without a line ending character. + +Obviously that’s not very convenient for reading and editing manually. + +That’s when pretty print is useful. The name is quite self explanatory, re-formatting the JSON text to be more legible by humans. This is known as **JSON pretty printing**. + +### Parse And Pretty Print JSON With Linux Commandline Tools + +JSON data could be parsed with command line text processors like **awk** , **sed** and **gerp**. In fact JSON.awk is an awk script to do that. However there are some dedicated tools for the same purpose. + + 1. **jq** or **jshon** , JSON parser for shell, both of them are quite useful. + + 2. Shell scripts like **JSON.sh** or **jsonv.sh** to parse JSON in bash, zsh or dash shell. + + 3. **JSON.awk** , JSON parser awk script. + + 4. Python modules like **json.tool**. + + 5. **underscore-cli** , Node.js and javascript based. + + + + +In this tutorial I’m focusing only on **jq** , which is quite powerful JSON parser for shells with advanced filtering and scripting capability. + +### JSON pretty printing + +JSON data could be in one and nearly illegible for humans, so to make it somewhat readable, JSON pretty printing is here. + +**Example:** A data from **jsonip.com** , to get external IP address in JSON format, use **curl** or **wget** tools like below. + +``` +$ wget -cq http://jsonip.com/ -O - +``` + +The actual data looks like this: + +``` +{"ip":"111.222.333.444","about":"/about","Pro!":"http://getjsonip.com"} +``` + +Now pretty print it with jq: + +``` +$ wget -cq http://jsonip.com/ -O - | jq '.' +``` + +This should look like below, after filtering the result with jq. + +``` +{ + + "ip": "111.222.333.444", + + "about": "/about", + + "Pro!": "http://getjsonip.com" + +} +``` + +The Same thing could be done with python **json.tool** module. Here is an example: + +``` +$ cat anything.json | python -m json.tool +``` + +This Python based solution should be fine for most users, but it’s not that useful where Python is not pre-installed or could not be installed, like on embedded systems. + +However the json.tool python module has a distinct advantage, it’s cross platform. So, you can use it seamlessly on Windows, Linux or mac OS. + + +### How to parse JSON with jq + +First, you need to install jq, it’s already picked up by most GNU/Linux distributions, install it with their respective package installer commands. + +On Arch Linux: + +``` +$ sudo pacman -S jq +``` + +On Debian, Ubuntu, Linux Mint: + +``` +$ sudo apt-get install jq +``` + +On Fedora: + +``` +$ sudo dnf install jq +``` + +On openSUSE: + +``` +$ sudo zypper install jq +``` + +For other OS or platforms, see the [official installation instructions][1]. + +**Basic filters and identifiers of jq** + +jq could read the JSON data either from **stdin** or a **file**. You’ve to use both depending on the situation. + +The single symbol of **.** is the most basic filter. These filters are also called as **object identifier-index**. Using a single **.** along with jq basically pretty prints the input JSON file. + +**Single quotes** – You don’t have to use the single quote always. But if you’re combining several filters in a single line, then you must use them. + +**Double quotes** – You’ve to enclose any special character like **@** , **#** , **$** within two double quotes, like this example, **jq .foo.”@bar”** + +**Raw data print** – For any reason, if you need only the final parsed data, not enclosed within a double quote, use the -r flag with the jq command, like this. **– jq -r .foo.bar**. + +**Parsing specific data** + +To filter out a specific part of JSON, you’ve to look into the pretty printed JSON file’s data hierarchy. + +An example of JSON data, from Wikipedia: + +``` +{ + + "firstName": "John", + + "lastName": "Smith", + + "age": 25, + + "address": { + + "streetAddress": "21 2nd Street", + + "city": "New York", + + "state": "NY", + + "postalCode": "10021" + +}, + + "phoneNumber": [ + +{ + + "type": "home", + + "number": "212 555-1234" + +}, + +{ + + "type": "fax", + + "number": "646 555-4567" + +} + +], + + "gender": { + + "type": "male" + + } + +} +``` + +I’m going to use this JSON data as an example in this tutorial, saved this as **sample.json**. + +Let’s say I want to filter out the address from sample.json file. So the command should be like: + +``` +$ jq .address sample.json +``` + +**Sample output:** + +``` +{ + + "streetAddress": "21 2nd Street", + + "city": "New York", + + "state": "NY", + + "postalCode": "10021" + +} +``` + +Again let’s say I want the postal code, then I’ve to add another **object identifier-index** , i.e. another filter. + +``` +$ cat sample.json | jq .address.postalCode +``` + +Also note that the **filters are case sensitive** and you’ve to use the exact same string to get something meaningful output instead of null. + +**Parsing elements from JSON array** + +Elements of JSON array are enclosed within square brackets, undoubtedly quite versatile to use. + +To parse elements from a array, you’ve to use the **[]identifier** along with other object identifier-index. + +In this sample JSON data, the phone numbers are stored inside an array, to get all the contents from this array, you’ve to use only the brackets, like this example. + +``` +$ jq .phoneNumber[] sample.json +``` + +Let’s say you just want the first element of the array, then use the array object numbers starting for 0, for the first item, use **[0]** , for the next items, it should be incremented by one each step. + +``` +$ jq .phoneNumber[0] sample.json +``` + +**Scripting examples** + +Let’s say I want only the the number for home, not entire JSON array data. Here’s when scripting within jq command comes handy. + +``` +$ cat sample.json | jq -r '.phoneNumber[] | select(.type == "home") | .number' +``` + +Here first I’m piping the results of one filer to another, then using the select attribute to select a particular type of data, again piping the result to another filter. + +Explaining every type of jq filters and scripting is beyond the scope and purpose of this tutorial. It’s highly suggested to read the JQ manual for better understanding given below. + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-parse-and-pretty-print-json-with-linux-commandline-tools/ + +作者:[EDITOR][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/editor/ +[b]: https://github.com/lujun9972 +[1]: https://stedolan.github.io/jq/download/ From b42b89b05c67be8568f886b5fbe78d874c5f929e Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 18 Mar 2019 15:41:15 +0800 Subject: [PATCH 317/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190315=20How=20?= =?UTF-8?q?To=20Navigate=20Inside=20A=20Directory/Folder=20In=20Linux=20Wi?= =?UTF-8?q?thout=20CD=20Command=3F=20sources/tech/20190315=20How=20To=20Na?= =?UTF-8?q?vigate=20Inside=20A=20Directory-Folder=20In=20Linux=20Without?= =?UTF-8?q?=20CD=20Command.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...tory-Folder In Linux Without CD Command.md | 169 ++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 sources/tech/20190315 How To Navigate Inside A Directory-Folder In Linux Without CD Command.md diff --git a/sources/tech/20190315 How To Navigate Inside A Directory-Folder In Linux Without CD Command.md b/sources/tech/20190315 How To Navigate Inside A Directory-Folder In Linux Without CD Command.md new file mode 100644 index 0000000000..d0d21adeb8 --- /dev/null +++ b/sources/tech/20190315 How To Navigate Inside A Directory-Folder In Linux Without CD Command.md @@ -0,0 +1,169 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Navigate Inside A Directory/Folder In Linux Without CD Command?) +[#]: via: (https://www.2daygeek.com/navigate-switch-directory-without-using-cd-command-in-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +How To Navigate Inside A Directory/Folder In Linux Without CD Command? +====== + +As everybody know that we can’t navigate inside a directory in Linux without CD command. + +Yes that’s true but we have the Linux built-in command called `shopt` that help us to solve this issue. + +[shopt][1] is a shell builtin command to set and unset various bash shell options, which is installed so, we no need to install it again. + +Yes we can navigate inside a directory without CD command after enabling this option. + +We will show you, how to do this in this article. This is a small tweak but it’s very useful for newbies who all are moving from Windows to Linux. + +This is not useful for Linux administrator because we won’t navigate to the directory without CD command, as we had a good practices on this. + +If you are trying to navigate a directory/folder in Linux without cd command, you will be getting the following error message. This is common in Linux. + +``` +$ Documents/ +bash: Documents/: Is a directory +``` + +To achieve this, we need to append the following values in a user `.bashrc` file. + +### What Is the .bashrc File? + +The “.bashrc” file is a shell script which is run every time a user opens a new shell in interactive mode. + +You can add any command in that file that you want to type at the command prompt. + +The .bashrc file itself contains a series of configurations for the terminal session. This includes setting up or enabling: colouring, completion, the shell history, command aliases and more. + +``` +$ vi ~/.bashrc + +shopt -s autocd +``` + +Run the following command to make the changes to take effect. + +``` +$ source ~/.bashrc +``` + +We have done all the configuration. Simple do the testing on this to confirm whether this working or not. + +``` +$ Documents/ +cd -- Documents/ + +$ daygeek/ +cd -- daygeek/ + +$ /home/daygeek/Documents/daygeek +cd -- /home/daygeek/Documents/daygeek + +$ pwd +/home/daygeek/Documents/daygeek +``` + +![][3] +Yes, it’s working fine as expected. + +However, it’s working fine in `fish shell` without making any changes in the `.bashrc` file. +![][4] + +If you would like to perform this action for temporarily then use the following commands (set/unset). This will go away when you reboot the system. + +``` +# shopt -s autocd + +# shopt | grep autocd +autocd on + +# shopt -u autocd + +# shopt | grep autocd +autocd off +``` + +shopt command is offering so many other options and if you want to verify those, run the following command. + +``` +$ shopt +autocd on +assoc_expand_once off +cdable_vars off +cdspell on +checkhash off +checkjobs off +checkwinsize on +cmdhist on +compat31 off +compat32 off +compat40 off +compat41 off +compat42 off +compat43 off +compat44 off +complete_fullquote on +direxpand off +dirspell off +dotglob off +execfail off +expand_aliases on +extdebug off +extglob off +extquote on +failglob off +force_fignore on +globasciiranges on +globstar off +gnu_errfmt off +histappend on +histreedit off +histverify off +hostcomplete on +huponexit off +inherit_errexit off +interactive_comments on +lastpipe off +lithist off +localvar_inherit off +localvar_unset off +login_shell off +mailwarn off +no_empty_cmd_completion off +nocaseglob off +nocasematch off +nullglob off +progcomp on +progcomp_alias off +promptvars on +restricted_shell off +shift_verbose off +sourcepath on +xpg_echo off +``` + +I had found few other utilities, that are help us to navigate a directory faster in Linux compared with cd command. + +Those are pushd, popd, up shell script and bd utility. We will cover these topics in the upcoming articles. + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/navigate-switch-directory-without-using-cd-command-in-linux/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html +[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[3]: https://www.2daygeek.com/wp-content/uploads/2019/03/navigate-switch-directory-without-using-cd-command-in-linux-1.jpg +[4]: https://www.2daygeek.com/wp-content/uploads/2019/03/navigate-switch-directory-without-using-cd-command-in-linux-2.jpg From 01920a58fb699ec57de4be30ed3380ac3e6e5fa7 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 18 Mar 2019 16:01:54 +0800 Subject: [PATCH 318/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020170414=205=20pr?= =?UTF-8?q?ojects=20for=20Raspberry=20Pi=20at=20home=20sources/tech/201704?= =?UTF-8?q?14=205=20projects=20for=20Raspberry=20Pi=20at=20home.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...414 5 projects for Raspberry Pi at home.md | 146 ++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 sources/tech/20170414 5 projects for Raspberry Pi at home.md diff --git a/sources/tech/20170414 5 projects for Raspberry Pi at home.md b/sources/tech/20170414 5 projects for Raspberry Pi at home.md new file mode 100644 index 0000000000..37c9fde3db --- /dev/null +++ b/sources/tech/20170414 5 projects for Raspberry Pi at home.md @@ -0,0 +1,146 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 projects for Raspberry Pi at home) +[#]: via: (https://opensource.com/article/17/4/5-projects-raspberry-pi-home) +[#]: author: (Ben Nuttall (Community Moderator) ) + +5 projects for Raspberry Pi at home +====== + +![5 projects for Raspberry Pi at home][1] + +The [Raspberry Pi][2] computer can be used in all kinds of settings and for a variety of purposes. It obviously has a place in education for helping students with learning programming and maker skills in the classroom and the hackspace, and it has plenty of industrial applications in the workplace and in factories. I'm going to introduce five projects you might want to build in your own home. + +### Media center + +One of the most common uses for Raspberry Pi in people's homes is behind the TV running media center software serving multimedia files. It's easy to set this up, and the Raspberry Pi provides plenty of GPU (Graphics Processing Unit) power to render HD TV shows and movies to your big screen TV. [Kodi][3] (formerly XBMC) on a Raspberry Pi is a great way to playback any media you have on a hard drive or network-attached storage. You can also install a plugin to play YouTube videos. + +There are a few different options available, most prominently [OSMC][4] (Open Source Media Center) and [LibreELEC][5], both based on Kodi. They both perform well at playing media content, but OSMC has a more visually appearing user interface, while LibreElec is much more lightweight. All you have to do is choose a distribution, download the image and install on an SD card (or just use [NOOBS][6]), boot it up, and you're ready to go. + +![LibreElec ][7] + +LibreElec; Raspberry Pi Foundation, CC BY-SA + +![OSMC][8] + +OSMC.tv, Copyright, Used with permission + +Before proceeding you'll need to decide [w][9][hich Raspberry Pi model to use][9]. These distributions will work on any Pi (1, 2, 3, or Zero), and video playback will essentially be matched on each of these. Apart from the Pi 3 (and Zero W) having built-in Wi-Fi, the only noticeable difference is the reaction speed of the user interface, which will be much faster on a Pi 3. A Pi 2 will not be much slower, so that's fine if you don't need Wi-Fi, but the Pi 3 will noticeably outperform the Pi 1 and Zero when it comes to flicking through the menus. + +### SSH gateway + +If you want to be able to access computers and devices on your home network from outside over the internet, you have to open up ports on those devices to allow outside traffic. Opening ports to the internet is a security risk, meaning you're always at risk of attack, misuse, or any kind of unauthorized access. However, if you install a Raspberry Pi on your network and set up port forwarding to allow only SSH access to that Pi, you can use that as a secure gateway to hop onto other Pis and PCs on the network. + +Most routers allow you to configure port-forwarding rules. You'll need to give your Pi a fixed internal IP address and set up port 22 on your router to map to port 22 on your Raspberry Pi. If your ISP provides you with a static IP address, you'll be able to SSH into it with this as the host address (for example, **ssh pi@123.45.56.78** ). If you have a domain name, you can configure a subdomain to point to this IP address, so you don't have to remember it (for example, **ssh[pi@home.mydomain.com][10]** ). + +![][11] + +However, if you're going to expose a Raspberry Pi to the internet, you should be very careful not to put your network at risk. There are a few simple procedures you can follow to make it sufficiently secure: + +1\. Most people suggest you change your login password (which makes sense, seeing as the default password “raspberry” is well known), but this does not protect against brute-force attacks. You could change your password and add a two-factor authentication (so you need your password _and_ a time-dependent passcode generated by your phone), which is more secure. However, I believe the best way to secure your Raspberry Pi from intruders is to [disable][12] [“password authentication”][12] in your SSH configuration, so you allow only SSH key access. This means that anyone trying to SSH in by guessing your password will never succeed. Only with your private SSH key can anyone gain access. Similarly, most people suggest changing the SSH port from the default 22 to something unexpected, but a simple [Nmap][13] of your IP address will reveal your true SSH port. + +2\. Ideally, you would not run much in the way of other software on this Pi, so you don't end up accidentally exposing anything else. If you want to run other software, you might be better running it on another Pi on the network that is not exposed to the internet. Ensure that you keep your packages up to date by upgrading regularly, particularly the **openssh-server** package, so that any security vulnerabilities are patched. + +3\. Install [sshblack][14] or [fail2ban][15] to blacklist any users who seem to be acting maliciously, such as attempting to brute force your SSH password. + +Once you've secured your Raspberry Pi and put it online, you'll be able to log in to your network from anywhere in the world. Once you're on your Raspberry Pi, you can SSH into other devices on the network using their local IP address (for example, 192.168.1.31). If you have passwords on these devices, just use the password. If they're also SSH-key-only, you'll need to ensure your key is forwarded over SSH by using the **-A** flag: **ssh -A pi@123.45.67.89**. + +### CCTV / pet camera + +Another great home project is to set up a camera module to take photos or stream video, capture and save files, or streamed internally or to the internet. There are many reasons you might want to do this, but two common use cases are for a homemade security camera or to monitor a pet. + +The [Raspberry Pi camera module][16] is a brilliant accessory. It provides full HD photo and video, lots of advanced configuration, and is [easy to][17] [program][17]. The [infrared camera][18] is ideal for this kind of use, and with an infrared LED (which the Pi can control) you can see in the dark! + +If you want to take still images on a regular basis to keep an eye on things, you can just write a short [Python][19] script or use the command line tool [raspistill][20], and schedule it to recur in [Cron][21]. You might want to have it save them to [Dropbox][22] or another web service, upload them to a web server, or you can even create a [web app][23] to display them. + +If you want to stream video, internally or externally, that's really easy, too. A simple MJPEG (Motion JPEG) example is provided in the [picamera documentation][24] (under “web streaming”). Just download or copy that code into a file, run it and visit the Pi's IP address at port 8000, and you'll see your camera's output live. + +A more advanced streaming project, [pistreaming][25], is available, which uses [JSMpeg][26] (a JavaScript video player) with the web server and a websocket for the camera stream running separately. This method is more performant and is just as easy to get running as the previous example, but there is more code involved and if set up to stream on the internet, requires you to open two ports. + +Once you have web streaming set up, you can position the camera where you want it. I have one set up to keep an eye on my pet tortoise: + +![Tortoise ][27] + +Ben Nuttall, CC BY-SA + +If you want to be able to control where the camera actually points, you can do so using servos. A neat solution is to use Pimoroni's [Pan-Tilt HAT][28], which allows you to move the camera easily in two dimensions. To integrate this with pistreaming, see the project's [pantilthat branch][29]. + +![Pan-tilt][30] + +Pimoroni.com, Copyright, Used with permission + +If you want to position your Pi outside, you'll need a waterproof enclosure and some way of getting power to the Pi. PoE (Power-over-Ethernet) cables can be a good way of achieving this. + +### Home automation and IoT + +It's 2017 and there are internet-connected devices everywhere, especially in the home. Our lightbulbs have Wi-Fi, our toasters are smarter than they used to be, and our tea kettles are at risk of attack from Russia. As long as you keep your devices secure, or don't connect them to the internet if they don't need to be, then you can make great use of IoT devices to automate tasks around the home. + +There are plenty of services you can buy or subscribe to, like Nest Thermostat or Philips Hue lightbulbs, which allow you to control your heating or your lighting from your phone, respectively—whether you're inside or away from home. You can use a Raspberry Pi to boost the power of these kinds of devices by automating interactions with them according to a set of rules involving timing or even sensors. One thing you can't do with Philips Hue is have the lights come on when you enter the room, but with a Raspberry Pi and a motion sensor, you can use a Python API to turn on the lights. Similarly, you can configure your Nest to turn on the heating when you're at home, but what if you only want it to turn on if there's at least two people home? Write some Python code to check which phones are on the network and if there are at least two, tell the Nest to turn on the heat. + +You can do a great deal more without integrating with existing IoT devices and with only using simple components. A homemade burglar alarm, an automated chicken coop door opener, a night light, a music box, a timed heat lamp, an automated backup server, a print server, or whatever you can imagine. + +### Tor proxy and blocking ads + +Adafruit's [Onion Pi][31] is a [Tor][32] proxy that makes your web traffic anonymous, allowing you to use the internet free of snoopers and any kind of surveillance. Follow Adafruit's tutorial on setting up Onion Pi and you're on your way to a peaceful anonymous browsing experience. + +![Onion-Pi][33] + +Onion-pi from Adafruit, Copyright, Used with permission + +![Pi-hole][34]You can install a Raspberry Pi on your network that intercepts all web traffic and filters out any advertising. Simply download the [Pi-hole][35] software onto the Pi, and all devices on your network will be ad-free (it even blocks in-app ads on your mobile devices). + +There are plenty more uses for the Raspberry Pi at home. What do you use Raspberry Pi for at home? What do you want to use it for? + +Let us know in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/17/4/5-projects-raspberry-pi-home + +作者:[Ben Nuttall (Community Moderator)][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/raspberry_pi_home_automation.png?itok=2TnmJpD8 (5 projects for Raspberry Pi at home) +[2]: https://www.raspberrypi.org/ +[3]: https://kodi.tv/ +[4]: https://osmc.tv/ +[5]: https://libreelec.tv/ +[6]: https://www.raspberrypi.org/downloads/noobs/ +[7]: https://opensource.com/sites/default/files/libreelec_0.png (LibreElec ) +[8]: https://opensource.com/sites/default/files/osmc.png (OSMC) +[9]: https://opensource.com/life/16/10/which-raspberry-pi-should-you-choose-your-project +[10]: mailto:pi@home.mydomain.com +[11]: https://opensource.com/sites/default/files/resize/screenshot_from_2017-04-07_15-13-01-700x380.png +[12]: http://stackoverflow.com/questions/20898384/ssh-disable-password-authentication +[13]: https://nmap.org/ +[14]: http://www.pettingers.org/code/sshblack.html +[15]: https://www.fail2ban.org/wiki/index.php/Main_Page +[16]: https://www.raspberrypi.org/products/camera-module-v2/ +[17]: https://opensource.com/life/15/6/raspberry-pi-camera-projects +[18]: https://www.raspberrypi.org/products/pi-noir-camera-v2/ +[19]: http://picamera.readthedocs.io/ +[20]: https://www.raspberrypi.org/documentation/usage/camera/raspicam/raspistill.md +[21]: https://www.raspberrypi.org/documentation/linux/usage/cron.md +[22]: https://github.com/RZRZR/plant-cam +[23]: https://github.com/bennuttall/bett-bot +[24]: http://picamera.readthedocs.io/en/release-1.13/recipes2.html#web-streaming +[25]: https://github.com/waveform80/pistreaming +[26]: http://jsmpeg.com/ +[27]: https://opensource.com/sites/default/files/tortoise.jpg (Tortoise) +[28]: https://shop.pimoroni.com/products/pan-tilt-hat +[29]: https://github.com/waveform80/pistreaming/tree/pantilthat +[30]: https://opensource.com/sites/default/files/pan-tilt.gif (Pan-tilt) +[31]: https://learn.adafruit.com/onion-pi/overview +[32]: https://www.torproject.org/ +[33]: https://opensource.com/sites/default/files/onion-pi.jpg (Onion-Pi) +[34]: https://opensource.com/sites/default/files/resize/pi-hole-250x250.png (Pi-hole) +[35]: https://pi-hole.net/ From 7594b0c11d7d6b0c65fbfb33561be7a57cfd1e58 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 18 Mar 2019 16:04:39 +0800 Subject: [PATCH 319/796] =?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 320/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190318=20Instal?= =?UTF-8?q?l=20MEAN.JS=20Stack=20In=20Ubuntu=2018.04=20LTS=20sources/tech/?= =?UTF-8?q?20190318=20Install=20MEAN.JS=20Stack=20In=20Ubuntu=2018.04=20LT?= =?UTF-8?q?S.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...stall MEAN.JS Stack In Ubuntu 18.04 LTS.md | 266 ++++++++++++++++++ 1 file changed, 266 insertions(+) create mode 100644 sources/tech/20190318 Install MEAN.JS Stack In Ubuntu 18.04 LTS.md diff --git a/sources/tech/20190318 Install MEAN.JS Stack In Ubuntu 18.04 LTS.md b/sources/tech/20190318 Install MEAN.JS Stack In Ubuntu 18.04 LTS.md new file mode 100644 index 0000000000..925326e0d7 --- /dev/null +++ b/sources/tech/20190318 Install MEAN.JS Stack In Ubuntu 18.04 LTS.md @@ -0,0 +1,266 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Install MEAN.JS Stack In Ubuntu 18.04 LTS) +[#]: via: (https://www.ostechnix.com/install-mean-js-stack-ubuntu/) +[#]: author: (sk https://www.ostechnix.com/author/sk/) + +Install MEAN.JS Stack In Ubuntu 18.04 LTS +====== + +![Install MEAN.JS Stack][1] + +**MEAN.JS** is an Open-Source, full-Stack JavaScript solution for building fast, and robust web applications. **MEAN.JS** stack consists of **MongoDB** (NoSQL database), **ExpressJs** (NodeJS server-side application web framework), **AngularJS** (Client-side web application framework), and **Node.js** (JavaScript run-time, popular for being a web server platform). In this tutorial, we will be discussing how to install MEAN.JS stack in Ubuntu. This guide was tested in Ubuntu 18.04 LTS server. However, it should work on other Ubuntu versions and Ubuntu variants. + +### Install MongoDB + +**MongoDB** is a free, cross-platform, open source, NoSQL document-oriented database. To install MongoDB on your Ubuntu system, refer the following guide: + + * [**Install MongoDB Community Edition In Linux**][2] + + + +### Install Node.js + +**NodeJS** is an open source, cross-platform, and lightweight JavaScript run-time environment that can be used to build scalable network applications. + +To install NodeJS on your system, refer the following guide: + + * [**How To Install NodeJS On Linux**][3] + + + +After installing, MongoDB, and Node.js, we need to install the other required components such as **Yarn** , **Grunt** , and **Gulp** for MEAN.js stack. + +### Install Yarn package manager + +Yarn is a package manager used by MEAN.JS stack to manage front-end packages. + +To install Bower, run the following command: + +``` +$ npm install -g yarn +``` + +### Install Grunt Task Runner + +Grunt Task Runner is used to to automate the development process. + +To install Grunt, run: + +``` +$ npm install -g grunt-cli +``` + +To verify if Yarn and Grunt have been installed, run: + +``` +$ npm list -g --depth=0 /home/sk/.nvm/versions/node/v11.11.0/lib ├── [email protected] ├── [email protected] └── [email protected] +``` + +### Install Gulp Task Runner (Optional) + +This is optional. You can use Gulp instead of Grunt. To install Gulp Task Runner, run the following command: + +``` +$ npm install -g gulp +``` + +We have installed all required prerequisites. Now, let us deploy MEAN.JS stack. + +### Download and Install MEAN.JS Stack + +Install Git if it is not installed already: + +``` +$ sudo apt-get install git +``` + +Next, git clone the MEAN.JS repository with command: + +``` +$ git clone https://github.com/meanjs/mean.git meanjs +``` + +**Sample output:** + +``` +Cloning into 'meanjs'... +remote: Counting objects: 8596, done. +remote: Compressing objects: 100% (12/12), done. +remote: Total 8596 (delta 3), reused 0 (delta 0), pack-reused 8584 Receiving objects: 100% (8596/8596), 2.62 MiB | 140.00 KiB/s, done. +Resolving deltas: 100% (4322/4322), done. +Checking connectivity... done. +``` + +The above command will clone the latest version of the MEAN.JS repository to **meanjs** folder in your current working directory. + +Go to the meanjs folder: + +``` +$ cd meanjs/ +``` + +Run the following command to install the Node.js dependencies required for testing and running our application: + +``` +$ npm install +``` + +This will take some time. Please be patient. + +* * * + +**Troubleshooting:** + +When I run the above command in Ubuntu 18.04 LTS, I get the following error: + +``` +Downloading binary from https://github.com/sass/node-sass/releases/download/v4.5.3/linux-x64-67_binding.node +Cannot download "https://github.com/sass/node-sass/releases/download/v4.5.3/linux-x64-67_binding.node": + +HTTP error 404 Not Found + +[....] +``` + +If you ever get these type of common errors like “node-sass and gulp-sass”, do the following: + +First uninstall the project and global gulp-sass modules using the following commands: + +``` +$ npm uninstall gulp-sass +$ npm uninstall -g gulp-sass +``` + +Next uninstall the global node-sass module: + +``` +$ npm uninstall -g node-sass +``` + +Install the global node-sass first. Then install the gulp-sass module at the local project level. + +``` +$ npm install -g node-sass +$ npm install gulp-sass +``` + +Now try the npm install again from the project folder using command: + +``` +$ npm install +``` + +Now all dependencies will start to install without any issues. + +* * * + +Once all dependencies are installed, run the following command to install all the front-end modules needed for the application: + +``` +$ yarn --allow-root --config.interactive=false install +``` + +Or, + +``` +$ yarn --allow-root install +``` + +You will see the following message at the end if the installation is successful. + +``` +[...] +> meanjs@0.6.0 snyk-protect /home/sk/meanjs +> snyk protect + +Successfully applied Snyk patches + +Done in 99.47s. +``` + +### Test MEAN.JS + +MEAN.JS stack has been installed. We can now able to start a sample application using command: + +``` +$ npm start +``` + +After a few seconds, you will see a message like below. This means MEAN.JS stack is working! + +``` +[...] +MEAN.JS - Development Environment + +Environment: development +Server: http://0.0.0.0:3000 +Database: mongodb://localhost/mean-dev +App version: 0.6.0 +MEAN.JS version: 0.6.0 +``` + +![][4] + +To verify, open up the browser and navigate to **** or ****. You should see a screen something like below. + +![][5] + +Mean stack test page + +Congratulations! MEAN.JS stack is ready to start building web applications. + +For further details, I recommend you to refer **[MEAN.JS stack official documentation][6]**. + +* * * + +Want to setup MEAN.JS stack in CentOS, RHEL, Scientific Linux? Check the following link for more details. + + * **[Install MEAN.JS Stack in CentOS 7][7]** + + + +* * * + +And, that’s all for now, folks. Hope this tutorial will help you to setup MEAN.JS stack. + +If you find this tutorial useful, please share it on your social, professional networks and support OSTechNix. + +More good stuffs to come. Stay tuned! + +Cheers! + +**Resources:** + + * **[MEAN.JS website][8]** + * [**MEAN.JS GitHub Repository**][9] + + + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/install-mean-js-stack-ubuntu/ + +作者:[sk][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.ostechnix.com/install-mongodb-linux/ +[3]: https://www.ostechnix.com/install-node-js-linux/ +[4]: http://www.ostechnix.com/wp-content/uploads/2016/03/meanjs.png +[5]: http://www.ostechnix.com/wp-content/uploads/2016/03/mean-stack-test-page.png +[6]: http://meanjs.org/docs.html +[7]: http://www.ostechnix.com/install-mean-js-stack-centos-7/ +[8]: http://meanjs.org/ +[9]: https://github.com/meanjs/mean From eda05a64f51f74ad06978cfa1232bd0ff8840a15 Mon Sep 17 00:00:00 2001 From: Liwen Jiang Date: Mon, 18 Mar 2019 06:43:15 -0500 Subject: [PATCH 321/796] 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 322/796] 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 323/796] 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 324/796] 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 325/796] 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 326/796] =?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 327/796] =?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 328/796] 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 329/796] 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 330/796] 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 331/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190318=20How=20?= =?UTF-8?q?to=20host=20your=20own=20webfonts=20sources/tech/20190318=20How?= =?UTF-8?q?=20to=20host=20your=20own=20webfonts.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20190318 How to host your own webfonts.md | 107 ++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 sources/tech/20190318 How to host your own webfonts.md diff --git a/sources/tech/20190318 How to host your own webfonts.md b/sources/tech/20190318 How to host your own webfonts.md new file mode 100644 index 0000000000..78fba8389d --- /dev/null +++ b/sources/tech/20190318 How to host your own webfonts.md @@ -0,0 +1,107 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to host your own webfonts) +[#]: via: (https://opensource.com/article/19/3/webfonts) +[#]: author: (Seth Kenlon (Red Hat, Community Moderator) https://opensource.com/users/seth) + +How to host your own webfonts +====== + +### Customize your website by self-hosting openly licensed fonts. + +![Open source fonts][1] + +Fonts are often a mystery to many computer users. For example, have you designed a cool flyer and, when you take the file somewhere for printing, find all the titles rendered in Arial because the printer doesn't have the fancy font you used in your design? There are ways to prevent this, of course: you can convert words in special fonts into paths, bundle fonts into a PDF, bundle open source fonts with your design files, or—at least—list the fonts required. And yet it's still a problem because we're human and we're forgetful. + +The web has the same sort of problem. If you have even a basic understanding of CSS, you've probably seen this kind of declaration: + +``` +h1 { font-family: "Times New Roman", Times, serif; } +``` + +This is a designer's attempt to define a specific font, provide a fallback if a user doesn't have Times New Roman installed, and offer yet another fallback if the user doesn't have Times either. It's better than using a graphic instead of text, but it's still an awkward, inelegant method of font non-management, However, in the early-ish days of the web, it's all we had to work with. + +### Webfonts + +Then webfonts happened, moving font management from the client to the server. Fonts on websites were rendered for the client by the server, rather than requiring the web browser to find a font on the user's system. Google and other providers even host openly licensed fonts, which designers can include on their sites with a simple CSS rule. + +The problem with this free convenience, of course, is that it doesn't come without cost. It's $0 to use, but major sites like Google love to keep track of who references their data, fonts included. If you don't see a need to assist Google in building a record of everyone's activity on the web, the good news is you can host your own webfonts, and it's as simple as uploading fonts to your host and using one easy CSS rule. As a side benefit, your site may load faster, as you'll be making one fewer external call upon loading each page. + +### Self-hosted webfonts + +The first thing you need is an openly licensed font. This can be confusing if you're not used to thinking or caring about obscure software licenses, especially since it seems like all fonts are free. Very few of us have consciously paid for a font, and yet most people have high-priced fonts on their computers. Thanks to licensing deals, your computer may have shipped with fonts that [you aren't legally allowed to copy and redistribute][2]. Fonts like Arial, Verdana, Calibri, Georgia, Impact, Lucida and Lucida Grande, Times and Times New Roman, Trebuchet, Geneva, and many others are owned by Microsoft, Apple, and Adobe. If you purchased a computer preloaded with Windows or MacOS, you paid for the right to use the bundled fonts, but you don't own those fonts and are not permitted to upload them to a web server (unless otherwise stated). + +Fortunately, the open source craze hit the font world long ago, and there are excellent collections of openly licensed fonts from collectives and projects like [The League of Moveable Type][3], [Font Library][4], [Omnibus Type][5], and even [Google][6] and [Adobe][7]. + +You can use most common font file formats, including TTF, OTF, WOFF, EOT, and so on. Since Sorts Mill Goudy includes a WOFF (Web Open Font Format, developed in part by Mozilla) version, I'll use it in this example. However, other formats work the same way. + +Assuming you want to use [Sorts Mill Goudy][8] on your web page: + + 1. Upload the **GoudyStM-webfont.woff** file to your web server: + +``` +scp GoudyStM-webfont.woff seth@example.com:~/www/fonts/ +``` + +Your host may also provide a graphical upload tool through cPanel or a similar web control panel. + + + + 2. In your site's CSS file, add an **@font-face** rule, similar to this: + + +``` +@font-face { +  font-family: "titlefont"; +  src: url("../fonts/GoudyStM-webfont.woff"); +} +``` + +The **font-family** value is something you make up. It's a human-friendly name for whatever the font face represents. I am using "titlefont" in this example because I imagine this font will be used for the main titles on an imaginary site. You could just as easily use "officialfont" or "myfont." + +The **src** value is the path to the font file. The path to the font must be appropriate for your server's file structure; in this example, I have the **fonts** directory alongside a **css** directory. You may not have your site structured that way, so adjust the paths as needed, remembering that a single dot means _this folder_ and two dots mean _a folder back_. + + + + 3. Now that you've defined the font face name and the location, you can call it for any given CSS class or ID you desire. For example, if you want **< h1>** to render in the Sorts Mill Goudy font, then make its CSS rule use your custom font name: + +``` +h1 { font-family: "titlefont", serif; } +``` + + + + +You're now hosting and using your own fonts. + + +![Web fonts on a website][10] + +_Thanks to Alexandra Kanik for teaching me about @font-face and most everything else I know about good web design._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/webfonts + +作者:[Seth Kenlon (Red Hat, Community Moderator)][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/life_typography_fonts.png?itok=Q1jMys5G (Open source fonts) +[2]: https://docs.microsoft.com/en-us/typography/fonts/font-faq +[3]: https://www.theleagueofmoveabletype.com/ +[4]: https://fontlibrary.org/ +[5]: https://www.omnibus-type.com +[6]: https://github.com/googlefonts +[7]: https://github.com/adobe-fonts +[8]: https://www.theleagueofmoveabletype.com/sorts-mill-goudy +[9]: /file/426056 +[10]: https://opensource.com/sites/default/files/uploads/webfont.jpg (Web fonts on a website) From a5df1edc9f7fa9d5ecb324fec1748316e0faa7e9 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 19 Mar 2019 10:13:30 +0800 Subject: [PATCH 332/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190318=20Buildi?= =?UTF-8?q?ng=20and=20augmenting=20libraries=20by=20calling=20Rust=20from?= =?UTF-8?q?=20JavaScript=20sources/tech/20190318=20Building=20and=20augmen?= =?UTF-8?q?ting=20libraries=20by=20calling=20Rust=20from=20JavaScript.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...braries by calling Rust from JavaScript.md | 176 ++++++++++++++++++ 1 file changed, 176 insertions(+) create mode 100644 sources/tech/20190318 Building and augmenting libraries by calling Rust from JavaScript.md diff --git a/sources/tech/20190318 Building and augmenting libraries by calling Rust from JavaScript.md b/sources/tech/20190318 Building and augmenting libraries by calling Rust from JavaScript.md new file mode 100644 index 0000000000..935f8eded5 --- /dev/null +++ b/sources/tech/20190318 Building and augmenting libraries by calling Rust from JavaScript.md @@ -0,0 +1,176 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Building and augmenting libraries by calling Rust from JavaScript) +[#]: via: (https://opensource.com/article/19/3/calling-rust-javascript) +[#]: author: (Ryan Levick https://opensource.com/users/ryanlevick) + +Building and augmenting libraries by calling Rust from JavaScript +====== + +Explore how to use WebAssembly (Wasm) to embed Rust inside JavaScript. + +![JavaScript in Vim][1] + +In _[Why should you use Rust in WebAssembly?][2]_ , I looked at why you might want to write WebAssembly (Wasm), and why you might choose Rust as the language to do it in. Now I'll share what that looks like by exploring ways to embed Rust inside JavaScript. + +This is something that separates Rust from Go, C#, and other languages with large runtimes that can compile to Wasm. Rust has a minimal runtime (basically just an allocator), making it easy to use Rust from JavaScript libraries. C and C++ have similar stories, but what sets Rust apart is its tooling, which we'll take a look at now. + +### The basics + +If you've never used Rust before, you'll first want to get that set up. It's pretty easy. First download [**Rustup**][3], which is a way to control versions of Rust and different toolchains for cross-compilation. This will give you access to [**Cargo**][4], which is the Rust build tool and package manager. + +Now we have a decision to make. We can easily write Rust code that runs in the browser through WebAssembly, but if we want to do anything other than make people's CPU fans spin, we'll probably at some point want to interact with the Document Object Model (DOM) or use some JavaScript API. In other words: _we need JavaScript interop_ (aka the JavaScript interoperability API). + +### The problem and the solutions + +WebAssembly is an extremely simple machine language. If we want to be able to communicate with JavaScript, Wasm gives us only four data types to do it with: 32- and 64-bit floats and integers. Wasm doesn't have a concept of strings, arrays, objects, or any other rich data type. Basically, we can only pass around pointers between Rust and JavaScript. Needless to say, this is less than ideal. + +The good news is there are two libraries that facilitate communication between Rust-based Wasm and JavaScript: [**wasm-bindgen**][5] and [**stdweb**][6]. The bad news, however, is these two libraries are unfortunately incompatible with each other. **wasm-bindgen** is lower-level than **stdweb** and attempts to provide full control over how JavaScript and Rust interact. In fact, there is even talk of [rewriting **stdweb** using **wasm-bindgen**][7], which would get rid of the issue of incompatibility. + +Because **wasm-bindgen** is the lighter-weight option (and the option officially worked on by the official [Rust WebAssembly working group][8]), we'll focus at that. + +### wasm-bindgen and wasm-pack + +We're going to create a function that takes a string from JavaScript, makes it uppercase and prepends "HELLO, " to it, and returns it back to JavaScript. We'll call this function **excited_greeting**! + +First, let's create our Rust library that will house this fabulous function: + +``` +$ cargo new my-wasm-library --lib +$ cd my-wasm-library +``` + +Now we'll want to replace the contents of **src/lib.rs** with our exciting logic. I think it's best to write the code out instead of copy/pasting. + +``` +// Include the `wasm_bindgen` attribute into the current namespace. +use wasm_bindgen::prelude::wasm_bindgen; + +// This attribute makes calling Rust from JavaScript possible. +// It generates code that can convert the basic types wasm understands +// (integers and floats) into more complex types like strings and +// vice versa. If you're interested in how this works, check this out: +// +#[wasm_bindgen] +// This is pretty plain Rust code. If you've written Rust before this +// should look extremely familiar. If not, why wait?! Check this out: +// +pub fn excited_greeting(original: &str) -> String { +format!("HELLO, {}", original.to_uppercase()) +} +``` + +Second, we'll have to make two changes to our **Cargo.toml** configuration file: + + * Add **wasm_bindgen** as a dependency. + * Configure the type of library binary to be a **cdylib** or dynamic system library. In this case, our system is **wasm** , and setting this option is how we produce **.wasm** binary files. + + +``` +[package] +name = "my-wasm-library" +version = "0.1.0" +authors = ["$YOUR_INFO"] +edition = "2018" + +[lib] +crate-type = ["cdylib", "rlib"] + +[dependencies] +wasm-bindgen = "0.2.33" +``` + +Now let's build! If we just use **cargo build** , we'll get a **.wasm** binary, but in order to make it easy to call our Rust code from JavaScript, we'd like to have some JavaScript code that converts rich JavaScript types like strings and objects to pointers and passes these pointers to the Wasm module on our behalf. Doing this manually is tedious and prone to bugs. + +Luckily, in addition to being a library, **wasm-bindgen** also has the ability to create this "glue" JavaScript for us. This means in our code we can interact with our Wasm module using normal JavaScript types, and the generated code from **wasm-bindgen** will do the dirty work of converting these rich types into the pointer types that Wasm actually understands. + +We can use the awesome **wasm-pack** to build our Wasm binary, invoke the **wasm-bindgen** CLI tool, and package all of our JavaScript (and any optional generated TypeScript types) into one nice and neat package. Let's do that now! + +First we'll need to install **wasm-pack** : + +``` +$ cargo install wasm-pack +``` + +By default, **wasm-bindgen** produces ES6 modules. We'll use our code from a simple script tag, so we just want it to produce a plain old JavaScript object that gives us access to our Wasm functions. To do this, we'll pass it the **\--target no-modules** option. + +``` +$ wasm-pack build --target no-modules +``` + +We now have a **pkg** directory in our project. If we look at the contents, we'll see the following: + + * **package.json** : useful if we want to package this up as an NPM module + * **my_wasm_library_bg.wasm** : our actual Wasm code + * **my_wasm_library.js** : the JavaScript "glue" code + * Some TypeScript definition files + + + +Now we can create an **index.html** file that will make use of our JavaScript and Wasm: + +``` +<[html][9]> +<[head][10]> +<[meta][11] content="text/html;charset=utf-8" http-equiv="Content-Type" /> + +<[body][12]> + +<[script][13] src='./pkg/my_wasm_library.js'> + +<[script][13]> +window.addEventListener('load', async () => { +// Load the wasm file +await wasm_bindgen('./pkg/my_wasm_library_bg.wasm'); +// Once it's loaded the `wasm_bindgen` object is populated +// with the functions defined in our Rust code +const greeting = wasm_bindgen.excited_greeting("Ryan") +console.log(greeting) +}); + + + +``` + +You may be tempted to open the HTML file in your browser, but unfortunately, this is not possible. For security reasons, Wasm files have to be served from the same domain as the HTML file. You'll need an HTTP server. If you have a favorite static HTTP server that can serve files from your filesystem, feel free to use that. I like to use [**basic-http-server**][14], which you can install and run like so: + +``` +$ cargo install basic-http-server +$ basic-http-server +``` + +Now open the **index.html** file through the web server by going to **** and check your JavaScript console. You should see a very exciting greeting there! + +If you have any questions, please [let me know][15]. Next time, we'll take a look at how we can use various browser and JavaScript APIs from within our Rust code. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/calling-rust-javascript + +作者:[Ryan Levick][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ryanlevick +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/javascript_vim.jpg?itok=mqkAeakO (JavaScript in Vim) +[2]: https://opensource.com/article/19/2/why-use-rust-webassembly +[3]: https://rustup.rs/ +[4]: https://doc.rust-lang.org/cargo/ +[5]: https://github.com/rustwasm/wasm-bindgen +[6]: https://github.com/koute/stdweb +[7]: https://github.com/koute/stdweb/issues/318 +[8]: https://www.rust-lang.org/governance/wgs/wasm +[9]: http://december.com/html/4/element/html.html +[10]: http://december.com/html/4/element/head.html +[11]: http://december.com/html/4/element/meta.html +[12]: http://december.com/html/4/element/body.html +[13]: http://december.com/html/4/element/script.html +[14]: https://github.com/brson/basic-http-server +[15]: https://twitter.com/ryan_levick From 70e1196bb01510e906567b7cde96087130ad7ca8 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 19 Mar 2019 10:34:27 +0800 Subject: [PATCH 333/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190318=2010=20P?= =?UTF-8?q?ython=20image=20manipulation=20tools=20sources/tech/20190318=20?= =?UTF-8?q?10=20Python=20image=20manipulation=20tools.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0318 10 Python image manipulation tools.md | 331 ++++++++++++++++++ 1 file changed, 331 insertions(+) create mode 100644 sources/tech/20190318 10 Python image manipulation tools.md diff --git a/sources/tech/20190318 10 Python image manipulation tools.md b/sources/tech/20190318 10 Python image manipulation tools.md new file mode 100644 index 0000000000..334e2b4344 --- /dev/null +++ b/sources/tech/20190318 10 Python image manipulation tools.md @@ -0,0 +1,331 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (10 Python image manipulation tools) +[#]: via: (https://opensource.com/article/19/3/python-image-manipulation-tools) +[#]: author: (Parul Pandey https://opensource.com/users/parul-pandey) + +10 Python image manipulation tools +====== + +These Python libraries provide an easy and intuitive way to transform images and make sense of the underlying data. + +![][1] + +Today's world is full of data, and images form a significant part of this data. However, before they can be used, these digital images must be processed—analyzed and manipulated in order to improve their quality or extract some information that can be put to use. + +Common image processing tasks include displays; basic manipulations like cropping, flipping, rotating, etc.; image segmentation, classification, and feature extractions; image restoration; and image recognition. Python is an excellent choice for these types of image processing tasks due to its growing popularity as a scientific programming language and the free availability of many state-of-the-art image processing tools in its ecosystem. + +This article looks at 10 of the most commonly used Python libraries for image manipulation tasks. These libraries provide an easy and intuitive way to transform images and make sense of the underlying data. + +### 1\. scikit-image + +**[**scikit** -image][2]** is an open source Python package that works with [NumPy][3] arrays. It implements algorithms and utilities for use in research, education, and industry applications. It is a fairly simple and straightforward library, even for those who are new to Python's ecosystem. The code is high-quality, peer-reviewed, and written by an active community of volunteers. + +#### Resources + +scikit-image is very well [documented][4] with a lot of examples and practical use cases. + +#### Usage + +The package is imported as **skimage** , and most functions are found within the submodules. + +Image filtering: + +``` +import matplotlib.pyplot as plt +%matplotlib inline + +from skimage import data,filters + +image = data.coins() # ... or any other NumPy array! +edges = filters.sobel(image) +plt.imshow(edges, cmap='gray') +``` + +![Image filtering in scikit-image][6] + +Template matching using the [match_template][7] function: + +![Template matching in scikit-image][9] + +You can find more examples in the [gallery][10]. + +### 2\. NumPy + +[**NumPy**][11] is one of the core libraries in Python programming and provides support for arrays. An image is essentially a standard NumPy array containing pixels of data points. Therefore, by using basic NumPy operations, such as slicing, masking, and fancy indexing, you can modify the pixel values of an image. The image can be loaded using **skimage** and displayed using Matplotlib. + +#### Resources + +A complete list of resources and documentation is available on NumPy's [official documentation page][11]. + +#### Usage + +Using Numpy to mask an image: + +``` +import numpy as np +from skimage import data +import matplotlib.pyplot as plt +%matplotlib inline + +image = data.camera() +type(image) +numpy.ndarray #Image is a NumPy array: + +mask = image < 87 +image[mask]=255 +plt.imshow(image, cmap='gray') +``` + +![NumPy][13] + +### 3\. SciPy + +**[SciPy][14]** is another of Python's core scientific modules (like NumPy) and can be used for basic image manipulation and processing tasks. In particular, the submodule [**scipy.ndimage**][15] (in SciPy v1.1.0) provides functions operating on n-dimensional NumPy arrays. The package currently includes functions for linear and non-linear filtering, binary morphology, B-spline interpolation, and object measurements. + +#### Resources + +For a complete list of functions provided by the **scipy.ndimage** package, refer to the [documentation][16]. + +#### Usage + +Using SciPy for blurring using a [Gaussian filter][17]: +``` +from scipy import misc,ndimage + +face = misc.face() +blurred_face = ndimage.gaussian_filter(face, sigma=3) +very_blurred = ndimage.gaussian_filter(face, sigma=5) + +#Results +plt.imshow() +``` + +![Using a Gaussian filter in SciPy][19] + +### 4\. PIL/Pillow + +**PIL** (Python Imaging Library) is a free library for the Python programming language that adds support for opening, manipulating, and saving many different image file formats. However, its development has stagnated, with its last release in 2009. Fortunately, there is [**Pillow**][20], an actively developed fork of PIL, that is easier to install, runs on all major operating systems, and supports Python 3. The library contains basic image processing functionality, including point operations, filtering with a set of built-in convolution kernels, and color-space conversions. + +#### Resources + +The [documentation][21] has instructions for installation as well as examples covering every module of the library. + +#### Usage + +Enhancing an image in Pillow using ImageFilter: + +``` +from PIL import Image,ImageFilter +#Read image +im = Image.open('image.jpg') +#Display image +im.show() + +from PIL import ImageEnhance +enh = ImageEnhance.Contrast(im) +enh.enhance(1.8).show("30% more contrast") +``` + +![Enhancing an image in Pillow using ImageFilter][23] + +[Image source code][24] + +### 5\. OpenCV-Python + +**OpenCV** (Open Source Computer Vision Library) is one of the most widely used libraries for computer vision applications. [**OpenCV-Python**][25] is the Python API for OpenCV. OpenCV-Python is not only fast, since the background consists of code written in C/C++, but it is also easy to code and deploy (due to the Python wrapper in the foreground). This makes it a great choice to perform computationally intensive computer vision programs. + +#### Resources + +The [OpenCV2-Python-Guide][26] makes it easy to get started with OpenCV-Python. + +#### Usage + +Using _Image Blending using Pyramids_ in OpenCV-Python to create an "Orapple": + + +![Image blending using Pyramids in OpenCV-Python][28] + +[Image source code][29] + +### 6\. SimpleCV + +[**SimpleCV**][30] is another open source framework for building computer vision applications. It offers access to several high-powered computer vision libraries such as OpenCV, but without having to know about bit depths, file formats, color spaces, etc. Its learning curve is substantially smaller than OpenCV's, and (as its tagline says), "it's computer vision made easy." Some points in favor of SimpleCV are: + + * Even beginning programmers can write simple machine vision tests + * Cameras, video files, images, and video streams are all interoperable + + + +#### Resources + +The official [documentation][31] is very easy to follow and has tons of examples and use cases to follow. + +#### Usage + +### [7-_simplecv.png][32] + +![SimpleCV][33] + +### 7\. Mahotas + +**[Mahotas][34]** is another computer vision and image processing library for Python. It contains traditional image processing functions such as filtering and morphological operations, as well as more modern computer vision functions for feature computation, including interest point detection and local descriptors. The interface is in Python, which is appropriate for fast development, but the algorithms are implemented in C++ and tuned for speed. Mahotas' library is fast with minimalistic code and even minimum dependencies. Read its [official paper][35] for more insights. + +#### Resources + +The [documentation][36] contains installation instructions, examples, and even some tutorials to help you get started using Mahotas easily. + +#### Usage + +The Mahotas library relies on simple code to get things done. For example, it does a good job with the [Finding Wally][37] problem with a minimum amount of code. + +Solving the Finding Wally problem: + +![Finding Wally problem in Mahotas][39] + +[Image source code][40] + +![Finding Wally problem in Mahotas][42] + +[Image source code][40] + +### 8\. SimpleITK + +[**ITK**][43] (Insight Segmentation and Registration Toolkit) is an "open source, cross-platform system that provides developers with an extensive suite of software tools for image analysis. **[SimpleITK][44]** is a simplified layer built on top of ITK, intended to facilitate its use in rapid prototyping, education, [and] interpreted languages." It's also an image analysis toolkit with a [large number of components][45] supporting general filtering operations, image segmentation, and registration. SimpleITK is written in C++, but it's available for a large number of programming languages including Python. + +#### Resources + +There are a large number of [Jupyter Notebooks][46] illustrating the use of SimpleITK for educational and research activities. The notebooks demonstrate using SimpleITK for interactive image analysis using the Python and R programming languages. + +#### Usage + +Visualization of a rigid CT/MR registration process created with SimpleITK and Python: + +![SimpleITK animation][48] + +[Image source code][49] + +### 9\. pgmagick + +[**pgmagick**][50] is a Python-based wrapper for the GraphicsMagick library. The [**GraphicsMagick**][51] image processing system is sometimes called the Swiss Army Knife of image processing. Its robust and efficient collection of tools and libraries supports reading, writing, and manipulating images in over 88 major formats including DPX, GIF, JPEG, JPEG-2000, PNG, PDF, PNM, and TIFF. + +#### Resources + +pgmagick's [GitHub repository][52] has installation instructions and requirements. There is also a detailed [user guide][53]. + +#### Usage + +Image scaling: + +![Image scaling in pgmagick][55] + +[Image source code][56] + +Edge extraction: + +![Edge extraction in pgmagick][58] + +[Image source code][59] + +### 10\. Pycairo + +[**Pycairo**][60] is a set of Python bindings for the [Cairo][61] graphics library. Cairo is a 2D graphics library for drawing vector graphics. Vector graphics are interesting because they don't lose clarity when resized or transformed. Pycairo can call Cairo commands from Python. + +#### Resources + +The Pycairo [GitHub repository][62] is a good resource with detailed instructions on installation and usage. There is also a [getting started guide][63], which has a brief tutorial on Pycairo. + +#### Usage + +Drawing lines, basic shapes, and radial gradients with Pycairo: + +![Pycairo][65] + +[Image source code][66] + +### Conclusion + +These are some of the useful and freely available image processing libraries in Python. Some are well known and others may be new to you. Try them out to get to know more about them! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/python-image-manipulation-tools + +作者:[Parul Pandey][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/parul-pandey +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/daisy_gimp_art_design.jpg?itok=6kCxAKWO +[2]: https://scikit-image.org/ +[3]: http://docs.scipy.org/doc/numpy/reference/index.html#module-numpy +[4]: http://scikit-image.org/docs/stable/user_guide.html +[5]: /file/426206 +[6]: https://opensource.com/sites/default/files/uploads/1-scikit-image.png (Image filtering in scikit-image) +[7]: http://scikit-image.org/docs/dev/auto_examples/features_detection/plot_template.html#sphx-glr-auto-examples-features-detection-plot-template-py +[8]: /file/426211 +[9]: https://opensource.com/sites/default/files/uploads/2-scikit-image.png (Template matching in scikit-image) +[10]: https://scikit-image.org/docs/dev/auto_examples +[11]: http://www.numpy.org/ +[12]: /file/426216 +[13]: https://opensource.com/sites/default/files/uploads/3-numpy.png (NumPy) +[14]: https://www.scipy.org/ +[15]: https://docs.scipy.org/doc/scipy/reference/ndimage.html#module-scipy.ndimage +[16]: https://docs.scipy.org/doc/scipy/reference/tutorial/ndimage.html#correlation-and-convolution +[17]: https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.gaussian_filter.html +[18]: /file/426221 +[19]: https://opensource.com/sites/default/files/uploads/4-scipy.png (Using a Gaussian filter in SciPy) +[20]: https://python-pillow.org/ +[21]: https://pillow.readthedocs.io/en/3.1.x/index.html +[22]: /file/426226 +[23]: https://opensource.com/sites/default/files/uploads/5-pillow.png (Enhancing an image in Pillow using ImageFilter) +[24]: http://sipi.usc.edu/database/ +[25]: https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_setup/py_intro/py_intro.html +[26]: https://github.com/abidrahmank/OpenCV2-Python-Tutorials +[27]: /file/426236 +[28]: https://opensource.com/sites/default/files/uploads/6-opencv.jpeg (Image blending using Pyramids in OpenCV-Python) +[29]: https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_imgproc/py_pyramids/py_pyramids.html#pyramids +[30]: http://simplecv.org/ +[31]: http://examples.simplecv.org/en/latest/ +[32]: /file/426241 +[33]: https://opensource.com/sites/default/files/uploads/7-_simplecv.png (SimpleCV) +[34]: https://mahotas.readthedocs.io/en/latest/ +[35]: https://openresearchsoftware.metajnl.com/articles/10.5334/jors.ac/ +[36]: https://mahotas.readthedocs.io/en/latest/install.html +[37]: https://blog.clarifai.com/wheres-waldo-using-machine-learning-to-find-all-the-waldos +[38]: /file/426246 +[39]: https://opensource.com/sites/default/files/uploads/8-mahotas.png (Finding Wally problem in Mahotas) +[40]: https://mahotas.readthedocs.io/en/latest/wally.html +[41]: /file/426251 +[42]: https://opensource.com/sites/default/files/uploads/9-mahotas.png (Finding Wally problem in Mahotas) +[43]: https://itk.org/ +[44]: http://www.simpleitk.org/ +[45]: https://itk.org/ITK/resources/resources.html +[46]: http://insightsoftwareconsortium.github.io/SimpleITK-Notebooks/ +[47]: /file/426256 +[48]: https://opensource.com/sites/default/files/uploads/10-simpleitk.gif (SimpleITK animation) +[49]: https://github.com/InsightSoftwareConsortium/SimpleITK-Notebooks/blob/master/Utilities/intro_animation.py +[50]: https://pypi.org/project/pgmagick/ +[51]: http://www.graphicsmagick.org/ +[52]: https://github.com/hhatto/pgmagick +[53]: https://pgmagick.readthedocs.io/en/latest/ +[54]: /file/426261 +[55]: https://opensource.com/sites/default/files/uploads/11-pgmagick.png (Image scaling in pgmagick) +[56]: https://pgmagick.readthedocs.io/en/latest/cookbook.html#scaling-a-jpeg-image +[57]: /file/426266 +[58]: https://opensource.com/sites/default/files/uploads/12-pgmagick.png (Edge extraction in pgmagick) +[59]: https://pgmagick.readthedocs.io/en/latest/cookbook.html#edge-extraction +[60]: https://pypi.org/project/pycairo/ +[61]: https://cairographics.org/ +[62]: https://github.com/pygobject/pycairo +[63]: https://pycairo.readthedocs.io/en/latest/tutorial.html +[64]: /file/426271 +[65]: https://opensource.com/sites/default/files/uploads/13-pycairo.png (Pycairo) +[66]: http://zetcode.com/gfx/pycairo/basicdrawing/ From 1f87b7701b964dc7d5470371c71a16d37cb7aaf1 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 19 Mar 2019 10:52:36 +0800 Subject: [PATCH 334/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190318=20Solus?= =?UTF-8?q?=204=20=E2=80=98Fortitude=E2=80=99=20Released=20with=20Signific?= =?UTF-8?q?ant=20Improvements=20sources/tech/20190318=20Solus=204=20?= =?UTF-8?q?=E2=80=98Fortitude-=20Released=20with=20Significant=20Improveme?= =?UTF-8?q?nts.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...e- Released with Significant Improvements.md | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 sources/tech/20190318 Solus 4 ‘Fortitude- Released with Significant Improvements.md diff --git a/sources/tech/20190318 Solus 4 ‘Fortitude- Released with Significant Improvements.md b/sources/tech/20190318 Solus 4 ‘Fortitude- Released with Significant Improvements.md new file mode 100644 index 0000000000..c7a8d4bc55 --- /dev/null +++ b/sources/tech/20190318 Solus 4 ‘Fortitude- Released with Significant Improvements.md @@ -0,0 +1,108 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Solus 4 ‘Fortitude’ Released with Significant Improvements) +[#]: via: (https://itsfoss.com/solus-4-release) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Solus 4 ‘Fortitude’ Released with Significant Improvements +====== + +Finally, after a year of work, the much anticipated Solus 4 is here. It’s a significant release not just because this is a major upgrade, but also because this is the first major release after [Ikey Doherty (the founder of Solus) left the project][1] a few months ago. + +Now that everything’s under control with the new _management_ , **Solus 4 Fortitude** with updated Budgie desktop and other significant improvements has officially released. + +### What’s New in Solus 4 + +![Solus 4 Fortitude][2] + +#### Core Improvements + +Solus 4 comes loaded with **[Linux Kernel 4.20.16][3]** which enables better hardware support (like Touchpad support, improved support for Intel Coffee Lake and Ice Lake CPUs, and for AMD Picasso & Raven2 APUs). + +This release also ships with the latest [FFmpeg 4.1.1][4]. Also, they have enabled the support for [dav1d][5] in [VLC][6] – which is an open source AV1 decoder. So, you can consider these upgrades to significantly improve the Multimedia experience. + +It also includes some minor fixes to the Software Center – if you were encountering any issues while finding an application or viewing the description. + +In addition, WPS Office has been removed from the listing. + +#### UI Improvements + +![Budgie 10.5][7] + +The Budgie desktop update includes some minor changes and also comes baked in with the [Plata (Noir) GTK Theme.][8] + +You will no longer observe same applications multiple times in the menu, they’ve fixed this. They have also introduced a “ **Caffeine** ” mode as applet which prevents the system from suspending, locking the screen or changing the brightness while you are working. You can schedule the time accordingly. + +![Caffeine Mode][9] + +The new Budgie desktop experience also adds quick actions to the app icons on the task bar, dubbed as “ **Icon Tasklist** “. It makes it easy to manage the active tabs on a browser or the actions to minimize and move it to a new workplace (as shown in the image below). + +![Icon Tasklist][10] + +As the [change log][11] mentions, the above pop over design lets you do more: + + * _Close all instances of the selected application_ + * _Easily access per-window controls for marking it always on top, maximizing / unmaximizing, minimizing, and moving it to various workspaces._ + * _Quickly favorite / unfavorite apps_ + * _Quickly launch a new instance of the selected application_ + * _Scroll up or down on an IconTasklist button when a single window is open to activate and bring it into focus, or minimize it, based on the scroll direction._ + * _Toggle to minimize and unminimize various application windows_ + + + +The notification area now groups the notifications from specific applications instead of piling it all up. So, that’s a good improvement. + +In addition to these, the sound widget got some cool improvements while letting you personalize the look and feel of your desktop in an efficient manner. + +To know about all the nitty-gritty details, do refer the official [release note][11]s. + +### Download Solus 4 + +You can get the latest version of Solus from its download page below. It is available in the default Budgie, GNOME and MATE desktop flavors. + +[Get Solus 4][12] + +### Wrapping Up** + +Solus 4 is definitely an impressive upgrade – without introducing any unnecessary fancy features but by adding only the useful ones, subtle changes. + +What do you think about the latest Solus 4 Fortitude? Have you tried it yet? + +Let us know your thoughts in the comments below. + + + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/solus-4-release + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/ikey-leaves-solus/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/solus-4-featured.jpg?fit=800%2C450&ssl=1 +[3]: https://itsfoss.com/kernel-4-20-release/ +[4]: https://www.ffmpeg.org/ +[5]: https://code.videolan.org/videolan/dav1d +[6]: https://www.videolan.org/index.html +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/Budgie-desktop.jpg?resize=800%2C450&ssl=1 +[8]: https://gitlab.com/tista500/plata-theme +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/caffeine-mode.jpg?ssl=1 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/IconTasklistPopover.jpg?ssl=1 +[11]: https://getsol.us/2019/03/17/solus-4-released/ +[12]: https://getsol.us/download/ +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/Budgie-desktop.jpg?fit=800%2C450&ssl=1 +[14]: https://www.facebook.com/sharer.php?t=Solus%204%20%E2%80%98Fortitude%E2%80%99%20Released%20with%20Significant%20Improvements&u=https%3A%2F%2Fitsfoss.com%2Fsolus-4-release%2F +[15]: https://twitter.com/intent/tweet?text=Solus+4+%E2%80%98Fortitude%E2%80%99+Released+with+Significant+Improvements&url=https%3A%2F%2Fitsfoss.com%2Fsolus-4-release%2F&via=itsfoss2 +[16]: https://www.linkedin.com/shareArticle?title=Solus%204%20%E2%80%98Fortitude%E2%80%99%20Released%20with%20Significant%20Improvements&url=https%3A%2F%2Fitsfoss.com%2Fsolus-4-release%2F&mini=true +[17]: https://www.reddit.com/submit?title=Solus%204%20%E2%80%98Fortitude%E2%80%99%20Released%20with%20Significant%20Improvements&url=https%3A%2F%2Fitsfoss.com%2Fsolus-4-release%2F From 241e79743cf5033b57968b62f7cca612c49616d8 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 19 Mar 2019 11:08:11 +0800 Subject: [PATCH 335/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190318=203=20Wa?= =?UTF-8?q?ys=20To=20Check=20Whether=20A=20Port=20Is=20Open=20On=20The=20R?= =?UTF-8?q?emote=20Linux=20System=3F=20sources/tech/20190318=203=20Ways=20?= =?UTF-8?q?To=20Check=20Whether=20A=20Port=20Is=20Open=20On=20The=20Remote?= =?UTF-8?q?=20Linux=20System.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Port Is Open On The Remote Linux System.md | 162 ++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 sources/tech/20190318 3 Ways To Check Whether A Port Is Open On The Remote Linux System.md diff --git a/sources/tech/20190318 3 Ways To Check Whether A Port Is Open On The Remote Linux System.md b/sources/tech/20190318 3 Ways To Check Whether A Port Is Open On The Remote Linux System.md new file mode 100644 index 0000000000..046682ef83 --- /dev/null +++ b/sources/tech/20190318 3 Ways To Check Whether A Port Is Open On The Remote Linux System.md @@ -0,0 +1,162 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 Ways To Check Whether A Port Is Open On The Remote Linux System?) +[#]: via: (https://www.2daygeek.com/how-to-check-whether-a-port-is-open-on-the-remote-linux-system-server/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +3 Ways To Check Whether A Port Is Open On The Remote Linux System? +====== + +This is an important topic, which is not only for Linux administrator and it will be very helpful for all. + +I mean to say. It’s very useful for users who are working in IT Infra. + +They have to check whether the port is open or not on Linux server before proceeding to next steps. + +If it’s not open then they can directly ask the Linux admin to check on this. + +If it’s open then we need to check with application team, etc,. + +In this article, we will show you, how to check this using three methods. + +It can be done using the following Linux commands. + + * **`nc:`** Netcat is a simple Unix utility which reads and writes data across network connections, using TCP or UDP protocol. + * **`nmap:`** Nmap (“Network Mapper”) is an open source tool for network exploration and security auditing. It was designed to rapidly scan large networks. + * **`telnet:`** The telnet command is used for interactive communication with another host using the TELNET protocol. + + + +### How To Check Whether A Port Is Open On The Remote Linux System Using nc (netcat) Command? + +nc stands for netcat. Netcat is a simple Unix utility which reads and writes data across network connections, using TCP or UDP protocol. + +It is designed to be a reliable “back-end” tool that can be used directly or easily driven by other programs and scripts. + +At the same time, it is a feature-rich network debugging and exploration tool, since it can create almost any kind of connection you would need and has several interesting built-in capabilities. + +Netcat has three main modes of functionality. These are the connect mode, the listen mode, and the tunnel mode. + +**Common Syntax for nc (netcat):** + +``` +$ nc [-options] [HostName or IP] [PortNumber] +``` + +In this example, we are going to check whether the port 22 is open or not on the remote Linux system. + +If it’s success then you will be getting the following output. + +``` +# nc -zvw3 192.168.1.8 22 +Connection to 192.168.1.8 22 port [tcp/ssh] succeeded! +``` + +**Details:** + + * **`nc:`** It’s a command. + * **`z:`** zero-I/O mode (used for scanning). + * **`v:`** For verbose. + * **`w3:`** timeout wait seconds + * **`192.168.1.8:`** Destination system IP. + * **`22:`** Port number needs to be verified. + + + +If it’s fail then you will be getting the following output. + +``` +# nc -zvw3 192.168.1.95 22 +nc: connect to 192.168.1.95 port 22 (tcp) failed: Connection refused +``` + +### How To Check Whether A Port Is Open On The Remote Linux System Using nmap Command? + +Nmap (“Network Mapper”) is an open source tool for network exploration and security auditing. It was designed to rapidly scan large networks, although it works fine against single hosts. + +Nmap uses raw IP packets in novel ways to determine what hosts are available on the network, what services (application name and version) those hosts are offering, what operating systems (and OS versions) they are running, what type of packet filters/firewalls are in use, and dozens of other characteristics. + +While Nmap is commonly used for security audits, many systems and network administrators find it useful for routine tasks such as network inventory, managing service upgrade schedules, and monitoring host or service uptime. + +**Common Syntax for nmap:** + +``` +$ nmap [-options] [HostName or IP] [-p] [PortNumber] +``` + +If it’s success then you will be getting the following output. + +``` +# nmap 192.168.1.8 -p 22 + +Starting Nmap 7.70 ( https://nmap.org ) at 2019-03-16 03:37 IST Nmap scan report for 192.168.1.8 Host is up (0.00031s latency). + +PORT STATE SERVICE + +22/tcp open ssh + +Nmap done: 1 IP address (1 host up) scanned in 13.06 seconds +``` + +If it’s fail then you will be getting the following output. + +``` +# nmap 192.168.1.8 -p 80 +Starting Nmap 7.70 ( https://nmap.org ) at 2019-03-16 04:30 IST +Nmap scan report for 192.168.1.8 +Host is up (0.00036s latency). + +PORT STATE SERVICE +80/tcp closed http + +Nmap done: 1 IP address (1 host up) scanned in 13.07 seconds +``` + +### How To Check Whether A Port Is Open On The Remote Linux System Using telnet Command? + +The telnet command is used for interactive communication with another host using the TELNET protocol. + +**Common Syntax for telnet:** + +``` +$ telnet [HostName or IP] [PortNumber] +``` + +If it’s success then you will be getting the following output. + +``` +$ telnet 192.168.1.9 22 +Trying 192.168.1.9... +Connected to 192.168.1.9. +Escape character is '^]'. +SSH-2.0-OpenSSH_5.3 +^] +Connection closed by foreign host. +``` + +If it’s fail then you will be getting the following output. + +``` +$ telnet 192.168.1.9 80 +Trying 192.168.1.9... +telnet: Unable to connect to remote host: Connection refused +``` + +We had found only the above three methods. If you found any other ways, please let us know by updating your query in the comments section. + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/how-to-check-whether-a-port-is-open-on-the-remote-linux-system-server/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 From 535d16406d7bccf30b57f8af0a104e1da849e5d3 Mon Sep 17 00:00:00 2001 From: Chang Liu Date: Tue, 19 Mar 2019 13:16:13 +0800 Subject: [PATCH 336/796] [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 337/796] 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 338/796] 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 339/796] 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 340/796] 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 341/796] 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 342/796] =?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 343/796] 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 344/796] 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 345/796] 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 346/796] 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 347/796] 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 348/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190301=20Emacs?= =?UTF-8?q?=20for=20(even=20more=20of)=20the=20win=20sources/tech/20190301?= =?UTF-8?q?=20Emacs=20for=20(even=20more=20of)=20the=20win.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...190301 Emacs for (even more of) the win.md | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 sources/tech/20190301 Emacs for (even more of) the win.md diff --git a/sources/tech/20190301 Emacs for (even more of) the win.md b/sources/tech/20190301 Emacs for (even more of) the win.md new file mode 100644 index 0000000000..c1697f3cae --- /dev/null +++ b/sources/tech/20190301 Emacs for (even more of) the win.md @@ -0,0 +1,84 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Emacs for (even more of) the win) +[#]: via: (https://so.nwalsh.com/2019/03/01/emacs) +[#]: author: (Norman Walsh https://so.nwalsh.com) + +Emacs for (even more of) the win +====== + +I use Emacs every day. I rarely notice it. But when I do, it usually brings me joy. + +>If you are a professional writer…Emacs outshines all other editing software in approximately the same way that the noonday sun does the stars. It is not just bigger and brighter; it simply makes everything else vanish. + +I’ve been using [Emacs][1] for well over twenty years. I use it for writing almost anything and everything (I edit Scala and Java in [IntelliJ][2]). I read my email in it. If it can be done in Emacs, that’s where I prefer to do it. + +Although I’ve used Emacs for literally decades, I realized around the new year that very little about my use of Emacs had changed in the past decade or more. New editing modes had come along, of course, I’d picked up a package or two, and I did adopt [Helm][3] a few years ago, but mostly it just did all the heavy lifting that I required of it, day in and day out without complaining or getting in my way. On the one hand, that’s a testament to how good it is. On the other hand, that’s an invitation to dig in and see what I’ve missed. + +At about the same time, I resolved to improve several aspects of my work life: + + * **Better meeting management.** I’m lead on a couple of projects at work and those projects have meetings, both regularly scheduled and ad hoc; some of them I run, some of them, I only attend. + +I realized I’d become sloppy about my participation in meetings. It’s all too easy sit in a room where there’s a meeting going on but actually read email and work on other items. (I strongly oppose the “no laptops” rule in meetings, but that’s a topic for another day.) + +There are a couple of problems with sloppy participation. First, it’s disrespectful to the person who convened the meeting and the other participants. That’s actually sufficient reason not to do it, but I think there’s another problem: it disguises the cost of meetings. + +If you’re in a meeting but also answering your email and maybe fixing a bug, then that meeting didn’t cost anything (or as much). If meetings are cheap, then there will be more of them. + +I want fewer, shorter meetings. I don’t want to disguise their cost, I want them to be perceived as damned expensive and to be avoided unless absolutely necessary. + +Sometimes, they are absolutely necessary. And I appreciate that a quick meeting can sometimes resolve an issue quickly. But if I have ten short meetings a day, let’s not pretend that I’m getting anything else productive accomplished. + +I resolved to take notes at all the meetings I attend. I’m not offering to take minutes, necessarily, but I am taking minutes of a sort. It keeps me focused on the meeting and not catching up on other things. + + * **Better time management.** There are lots and lots of things that I need or want to do, both professionally and personally. I’ve historically kept track off some of them in issue lists, some in saved email threads (in Emacs and [Gmail][4], for slightly different types of reminders), in my calendar, on “todo lists” of various sorts on my phone, and on little scraps of paper. And probably other places as well. + +I resolved to keep them all in one place. Not because I think there’s one place that’s uniformly best or better, but because I hope to accomplish two things. First, by having them all in one place, I hope to be able to develop a better and more holistic view of where I’m putting my energies. Second, because I want to develop a habitn. “A settled or regular tendency or practice, especially one that is hard to give up.” of recording, tracking, and preserving them. + + * **Better accountability.** If you work in certain science or engineering disciplines, you will have developed the habit of keeping a [lab notebook][5]. Alas, I did not. But I resolved to do so. + +I’m not interested in the legal aspects that encourage bound pages or scribing only in permanent marker. What I’m interested in is developing the habit of keeping a record. My goal is to have a place to jot down ideas and design sketches and the like. If I have sudden inspiration or if I think of an edge case that isn’t in the test suite, I want my instinct to be to write it in my journal instead of scribbling it on a scrap of paper or promising myself that I’ll remember it. + + + + +This confluence of resolutions led me quickly and more-or-less directly to [Org][6]. There is a large, active, and loyal community of Org users. I’ve played with it in the past (I even [wrote about it][7], at least in passing, a couple of years ago) and I tinkered long enough to [integrate MarkLogic][8] into it. (Boy has that paid off in the last week or two!) + +But I never used it. + +I am now using it. I take minutes in it, I record all of my todo items in it, and I keep a journal in it. I’m not sure there’s much value in me attempting to wax eloquent about it or enumerate all its features, you’ll find plenty of either with a quick web search. + +If you use Emacs, you should be using Org. If you don’t use Emacs, I’m confident you wouldn’t be the first person who started because of Org. It does a lot. It takes a little time to learn your way around and remember the shortcuts, but I think it’s worth it. (And if you carry an [iOS][9] device in your pocket, I recommend [beorg][10] for recording items while you’re on the go.) + +Naturally, I worked out how to [get XML out of it][11]⊕“Worked out” sure is a funny way to spell “hacked together in elisp.”. And from there, how to turn it back into the markup my weblog expects (and do so at the push of a button in Emacs, of course). So this is the first posting written in Org. It won’t be the last. + +P.S. Happy birthday [little weblog][12]. + +-------------------------------------------------------------------------------- + +via: https://so.nwalsh.com/2019/03/01/emacs + +作者:[Norman Walsh][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://so.nwalsh.com +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Emacs +[2]: https://en.wikipedia.org/wiki/IntelliJ_IDEA +[3]: https://emacs-helm.github.io/helm/ +[4]: https://en.wikipedia.org/wiki/Gmail +[5]: https://en.wikipedia.org/wiki/Lab_notebook +[6]: https://en.wikipedia.org/wiki/Org-mode +[7]: https://www.balisage.net/Proceedings/vol17/html/Walsh01/BalisageVol17-Walsh01.html +[8]: https://github.com/ndw/ob-ml-marklogic/ +[9]: https://en.wikipedia.org/wiki/IOS +[10]: https://beorgapp.com/ +[11]: https://github.com/ndw/org-to-xml +[12]: https://so.nwalsh.com/2017/03/01/helloWorld From ddf88a6c945be4c440ace9d7e052ab4031a0f73a Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 20 Mar 2019 11:49:51 +0800 Subject: [PATCH 349/796] =?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 350/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190319=20How=20?= =?UTF-8?q?to=20set=20up=20a=20homelab=20from=20hardware=20to=20firewall?= =?UTF-8?q?=20sources/tech/20190319=20How=20to=20set=20up=20a=20homelab=20?= =?UTF-8?q?from=20hardware=20to=20firewall.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... up a homelab from hardware to firewall.md | 107 ++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 sources/tech/20190319 How to set up a homelab from hardware to firewall.md diff --git a/sources/tech/20190319 How to set up a homelab from hardware to firewall.md b/sources/tech/20190319 How to set up a homelab from hardware to firewall.md new file mode 100644 index 0000000000..28a50d8a43 --- /dev/null +++ b/sources/tech/20190319 How to set up a homelab from hardware to firewall.md @@ -0,0 +1,107 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to set up a homelab from hardware to firewall) +[#]: via: (https://opensource.com/article/19/3/home-lab) +[#]: author: (Michael Zamot (Red Hat) https://opensource.com/users/mzamot) + +How to set up a homelab from hardware to firewall +====== + +Take a look at hardware and software options for building your own homelab. + +![][1] + +Do you want to create a homelab? Maybe you want to experiment with different technologies, create development environments, or have your own private cloud. There are many reasons to have a homelab, and this guide aims to make it easier to get started. + +There are three categories to consider when planning a home lab: hardware, software, and maintenance. We'll look at the first two categories here and save maintaining your computer lab for a future article. + +### Hardware + +When thinking about your hardware needs, first consider how you plan to use your lab as well as your budget, noise, space, and power usage. + +If buying new hardware is too expensive, search local universities, ads, and websites like eBay or Craigslist for recycled servers. They are usually inexpensive, and server-grade hardware is built to last many years. You'll need three types of hardware: a virtualization server, storage, and a router/firewall. + +#### Virtualization servers + +A virtualization server allows you to run several virtual machines that share the physical box's resources while maximizing and isolating resources. If you break one virtual machine, you won't have to rebuild the entire server, just the virtual one. If you want to do a test or try something without the risk of breaking your entire system, just spin up a new virtual machine and you're ready to go. + +The two most important factors to consider in a virtualization server are the number and speed of its CPU cores and its memory. If there are not enough resources to share among all the virtual machines, they'll be overallocated and try to steal each other's CPU cycles and memory. + +So, consider a CPU platform with multiple cores. You want to ensure the CPU supports virtualization instructions (VT-x for Intel and AMD-V for AMD). Examples of good consumer-grade processors that can handle virtualization are Intel i5 or i7 and AMD Ryzen. If you are considering server-grade hardware, the Xeon class for Intel and EPYC for AMD are good options. Memory can be expensive, especially the latest DDR4 SDRAM. When estimating memory requirements, factor at least 2GB for the host operating system's memory consumption. + +If your electricity bill or noise is a concern, solutions like Intel's NUC devices provide a small form factor, low power usage, and reduced noise, but at the expense of expandability. + +#### Network-attached storage (NAS) + +If you want a machine loaded with hard drives to store all your personal data, movies, pictures, etc. and provide storage for the virtualization server, network-attached storage (NAS) is what you want. + +In most cases, you won't need a powerful CPU; in fact, many commercial NAS solutions use low-powered ARM CPUs. A motherboard that supports multiple SATA disks is a must. If your motherboard doesn't have enough ports, use a host bus adapter (HBA) SAS controller to add extras. + +Network performance is critical for a NAS, so select a gigabit network interface (or better). + +Memory requirements will differ based on your filesystem. ZFS is one of the most popular filesystems for NAS, and you'll need more memory to use features such as caching or deduplication. Error-correcting code (ECC) memory is your best bet to protect data from corruption (but make sure your motherboard supports it before you buy). Last, but not least, don't forget an uninterruptible power supply (UPS), because losing power can cause data corruption. + +#### Firewall and router + +Have you ever realized that a cheap router/firewall is usually the main thing protecting your home network from the exterior world? These routers rarely receive timely security updates, if they receive any at all. Scared now? Well, [you should be][2]! + +You usually don't need a powerful CPU or a great deal of memory to build your own router/firewall, unless you are handling a huge throughput or want to do CPU-intensive tasks, like a VPN server or traffic filtering. In such cases, you'll need a multicore CPU with AES-NI support. + +You may want to get at least two 1-gigabit or better Ethernet network interface cards (NICs), also, not needed, but recommended, a managed switch to connect your DIY-router to create VLANs to further isolate and secure your network. + +![Home computer lab PfSense][4] + +### Software + +After you've selected your virtualization server, NAS, and firewall/router, the next step is exploring the different operating systems and software to maximize their benefits. While you could use a regular Linux distribution like CentOS, Debian, or Ubuntu, they usually take more time to configure and administer than the following options. + +#### Virtualization software + +**[KVM][5]** (Kernel-based Virtual Machine) lets you turn Linux into a hypervisor so you can run multiple virtual machines in the same box. The best thing is that KVM is part of Linux, and it is the go-to option for many enterprises and home users. If you are comfortable, you can install **[libvirt][6]** and **[virt-manager][7]** to manage your virtualization platform. + +**[Proxmox VE][8]** is a robust, enterprise-grade solution and a full open source virtualization and container platform. It is based on Debian and uses KVM as its hypervisor and LXC for containers. Proxmox offers a powerful web interface, an API, and can scale out to many clustered nodes, which is helpful because you'll never know when you'll run out of capacity in your lab. + +**[oVirt][9] (RHV)** is another enterprise-grade solution that uses KVM as the hypervisor. Just because it's enterprise doesn't mean you can't use it at home. oVirt offers a powerful web interface and an API and can handle hundreds of nodes (if you are running that many servers, I don't want to be your neighbor!). The potential problem with oVirt for a home lab is that it requires a minimum set of nodes: You'll need one external storage, such as a NAS, and at least two additional virtualization nodes (you can run it just on one, but you'll run into problems in maintenance of your environment). + +#### NAS software + +**[FreeNAS][10]** is the most popular open source NAS distribution, and it's based on the rock-solid FreeBSD operating system. One of its most robust features is its use of the ZFS filesystem, which provides data-integrity checking, snapshots, replication, and multiple levels of redundancy (mirroring, striped mirrors, and striping). On top of that, everything is managed from the powerful and easy-to-use web interface. Before installing FreeNAS, check its hardware support, as it is not as wide as Linux-based distributions. + +Another popular alternative is the Linux-based **[OpenMediaVault][11]**. One of its main features is its modularity, with plugins that extend and add features. Among its included features are a web-based administration interface; protocols like CIFS, SFTP, NFS, iSCSI; and volume management, including software RAID, quotas, access control lists (ACLs), and share management. Because it is Linux-based, it has extensive hardware support. + +#### Firewall/router software + +**[pfSense][12]** is an open source, enterprise-grade FreeBSD-based router and firewall distribution. It can be installed directly on a server or even inside a virtual machine (to manage your virtual or physical networks and save space). It has many features and can be expanded using packages. It is managed entirely using the web interface, although it also has command-line access. It has all the features you would expect from a router and firewall, like DHCP and DNS, as well as more advanced features, such as intrusion detection (IDS) and intrusion prevention (IPS) systems. You can create multiple networks listening on different interfaces or using VLANs, and you can create a secure VPN server with a few clicks. pfSense uses pf, a stateful packet filter that was developed for the OpenBSD operating system using a syntax similar to IPFilter. Many companies and organizations use pfSense. + +* * * + +With all this information in mind, it's time for you to get your hands dirty and start building your lab. In a future article, I will get into the third category of running a home lab: using automation to deploy and maintain it. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/home-lab + +作者:[Michael Zamot (Red Hat)][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mzamot +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb +[2]: https://opensource.com/article/18/5/how-insecure-your-router +[3]: /file/427426 +[4]: https://opensource.com/sites/default/files/uploads/pfsense2.png (Home computer lab PfSense) +[5]: https://www.linux-kvm.org/page/Main_Page +[6]: https://libvirt.org/ +[7]: https://virt-manager.org/ +[8]: https://www.proxmox.com/en/proxmox-ve +[9]: https://ovirt.org/ +[10]: https://freenas.org/ +[11]: https://www.openmediavault.org/ +[12]: https://www.pfsense.org/ From dbba85a0b67689be5847bda77406b46f65eeb760 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 20 Mar 2019 12:13:43 +0800 Subject: [PATCH 351/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190319=20Blockc?= =?UTF-8?q?hain=202.0:=20Blockchain=20In=20Real=20Estate=20[Part=204]=20so?= =?UTF-8?q?urces/tech/20190319=20Blockchain=202.0-=20Blockchain=20In=20Rea?= =?UTF-8?q?l=20Estate=20-Part=204.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... 2.0- Blockchain In Real Estate -Part 4.md | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 sources/tech/20190319 Blockchain 2.0- Blockchain In Real Estate -Part 4.md diff --git a/sources/tech/20190319 Blockchain 2.0- Blockchain In Real Estate -Part 4.md b/sources/tech/20190319 Blockchain 2.0- Blockchain In Real Estate -Part 4.md new file mode 100644 index 0000000000..9e85b82f2c --- /dev/null +++ b/sources/tech/20190319 Blockchain 2.0- Blockchain In Real Estate -Part 4.md @@ -0,0 +1,50 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Blockchain 2.0: Blockchain In Real Estate [Part 4]) +[#]: via: (https://www.ostechnix.com/blockchain-2-0-blockchain-in-real-estate/) +[#]: author: (EDITOR https://www.ostechnix.com/author/editor/) + +Blockchain 2.0: Blockchain In Real Estate [Part 4] +====== + +![](https://www.ostechnix.com/wp-content/uploads/2019/03/Blockchain-In-Real-Estate-720x340.png) + +### Blockchain 2.0: Smart‘er’ Real Estate + +The [**previous article**][1] of this series explored the features of blockchain which will enable institutions to transform and interlace **traditional banking** and **financing systems** with it. This part will explore – **Blockchain in real estate**. The real estate industry is ripe for a revolution. It’s among the most actively traded most significant asset classes known to man. However, filled with regulatory hurdles and numerous possibilities of fraud and deceit, it’s also one of the toughest to participate in. The distributed ledger capabilities of the blockchain utilizing an appropriate consensus algorithm are touted as the way forward for the industry which is traditionally regarded as conservative in its attitude to change. + +Real estate has always been a very conservative industry in terms of its myriad operations. Somewhat rightfully so as well. A major economic crisis such as the 2008 financial crisis or the great depression from the early half of the 20th century managed to destroy the industry and its participants. However, like most products of economic value, the real estate industry is resilient and this resilience is rooted in its conservative nature. + +The global real estate market comprises an asset class worth **$228 trillion dollars** [1]. Give or take. Other investment assets such as stocks, bonds, and shares combined are only worth **$170 trillion**. Obviously, any and all transactions implemented in such an industry is naturally carefully planned and meticulously executed, for the most part. For the most part, because real estate is also notorious for numerous instances of fraud and devastating loses which ensue them. The industry because of the very conservative nature of its operations is also tough to navigate. It’s heavily regulated with complex laws creating an intertwined web of nuances that are just too difficult for an average person to understand fully. This makes entry and participation near impossible for most people. If you’ve ever been involved in one such deal, you’ll know how heavy and long the paper trail was. + +This hard reality is now set to change, albeit a slow and gradual transformation. The very reasons the industry has stuck to its hardy tested roots all this while can finally give way to its modern-day counterpart. The backbone of the real estate industry has always been its paper records. Land deeds, titles, agreements, rental insurance, proofs, and declarations etc., are just the tip of the iceberg here. If you’ve noticed the pattern here, this should be obvious, the distributed ledger technology that is blockchain, fits in perfectly with the needs here. Forget paper records, conventional database systems are also points of major failure. They can be modified by multiple participants, is not tamper proof or un-hackable, has a complicated set of ever-changing regulatory parameters making auditing and verifying data a nightmare. The blockchain perfectly solves all of these issues and more. + +Starting with a trivial albeit an important example to show just how bad the current record management practices are in the real estate sector, consider the **Title Insurance business** [2], [3]. Title Insurance is used to hedge against the possibility of the land’s titles and ownership records being inadmissible and hence unenforceable. An insurance product such as this is also referred to as an indemnity cover. It is by law required in many cases that properties have title insurance, especially when dealing with property that has changed hands multiple times over the years. Mortgage firms might insist on the same as well when they back real estate deals. The fact that a product of this kind has existed since the 1850s and that it does business worth at least **$1.5 trillion a year in the US alone** is a testament to the statement at the start. A revolution in terms of how these records are maintained is imperative to have in this situation and the blockchain provides a sustainable solution. Title fraud averages around $100k per case on average as per the **American Land Title Association** and 25% of all titles involved in transactions have an issue regarding their documents[4]. The blockchain allows for setting up an immutable permanent database that will track the property itself, recording each and every transaction or investment that has gone into it. Such a ledger system will make life easier for everyone involved in the real estate industry including one-time home buyers and make financial products such as Title Insurance basically irrelevant. Converting a physical asset such as real estate to a digital asset like this is unconventional and is extant only in theory at the moment. However, such a change is imminent sooner rather than later[5]. + +Among the areas in which blockchain will have the most impact within real estate is as highlighted above in maintaining a transparent and secure title management system for properties. A blockchain based record of the property can contain information about the property, its location, history of ownership, and any related public record of the same[6]. This will permit closing real estate deals fast and obliviates the need for 3rd party monitoring and oversight. Tasks such as real estate appraisal and tax calculations become matters of tangible objective parameters rather than subjective measures and guesses because of reliable historical data which is publicly verifiable. **UBITQUITY** is one such platform that offers customized blockchain-based solutions to enterprise customers. The platform allows customers to keep track of all property details, payment records, mortgage records and even allows running smart contracts that’ll take care of taxation and leasing automatically[7]. + +This brings us to the second biggest opportunity and use case of blockchains in real estate. Since the sector is highly regulated by numerous 3rd parties apart from the counterparties involved in the trade, due-diligence and financial evaluations can be significantly time-consuming. These processes are predominantly carried out using offline channels and paperwork needs to travel for days before a final evaluation report comes out. This is especially true for corporate real estate deals and forms a bulk of the total billable hours charged by consultants. In case the transaction is backed by a mortgage, duplication of these processes is unavoidable. Once combined with digital identities for the people and institutions involved along with the property, the current inefficiencies can be avoided altogether and transactions can take place in a matter of seconds. The tenants, investors, institutions involved, consultants etc., could individually validate the data and arrive at a critical consensus thereby validating the property records for perpetuity[8]. This increases the accuracy of verification manifold. Real estate giant **RE/MAX** has recently announced a partnership with service provider **XYO Network Partners** for building a national database of real estate listings in Mexico. They hope to one day create one of the largest (as of yet) decentralized real estate title registry in the world[9]. + +However, another significant and arguably a very democratic change that the blockchain can bring about is with respect to investing in real estate. Unlike other investment asset classes where even small household investors can potentially participate, real estate often requires large hands-down payments to participate. Companies such as **ATLANT** and **BitOfProperty** tokenize the book value of a property and convert them into equivalents of a cryptocurrency. These tokens are then put for sale on their exchanges similar to how stocks and shares are traded. Any cash flow that the real estate property generates afterward is credited or debited to the token owners depending on their “share” in the property[4]. + +However, even with all of that said, Blockchain technology is still in very early stages of adoption in the real estate sector and current regulations are not exactly defined for it to be either[8]. Concepts such as distributed applications, distributed anonymous organizations, smart contracts etc., are unheard of in the legal domain in many countries. A complete overhaul of existing regulations and guidelines once all the stakeholders are well educated on the intricacies of the blockchain is the most pragmatic way forward. Again, it’ll be a slow and gradual change to go through, however a much-needed one nonetheless. The next article of the series will look at how **“Smart Contracts”** , such as those implemented by companies such as UBITQUITY and XYO are created and executed in the blockchain. + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/blockchain-2-0-blockchain-in-real-estate/ + +作者:[EDITOR][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/editor/ +[b]: https://github.com/lujun9972 +[1]: https://www.ostechnix.com/blockchain-2-0-redefining-financial-services/ From bc44686ee83593ad9df305092bf22345784a1eeb Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 20 Mar 2019 12:16:10 +0800 Subject: [PATCH 352/796] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190319=20How=20?= =?UTF-8?q?To=20Set=20Up=20a=20Firewall=20with=20GUFW=20on=20Linux=20sourc?= =?UTF-8?q?es/tech/20190319=20How=20To=20Set=20Up=20a=20Firewall=20with=20?= =?UTF-8?q?GUFW=20on=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...To Set Up a Firewall with GUFW on Linux.md | 365 ++++++++++++++++++ 1 file changed, 365 insertions(+) create mode 100644 sources/tech/20190319 How To Set Up a Firewall with GUFW on Linux.md diff --git a/sources/tech/20190319 How To Set Up a Firewall with GUFW on Linux.md b/sources/tech/20190319 How To Set Up a Firewall with GUFW on Linux.md new file mode 100644 index 0000000000..26b9850109 --- /dev/null +++ b/sources/tech/20190319 How To Set Up a Firewall with GUFW on Linux.md @@ -0,0 +1,365 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Set Up a Firewall with GUFW on Linux) +[#]: via: (https://itsfoss.com/set-up-firewall-gufw) +[#]: author: (Sergiu https://itsfoss.com/author/sergiu/) + +How To Set Up a Firewall with GUFW on Linux +====== + +**UFW (Uncomplicated Firewall)** is a simple to use firewall utility with plenty of options for most users. It is an interface for the **iptables** , which is the classic (and harder to get comfortable with) way to set up rules for your network. + +**Do you really need a firewall for desktop?** + +![][1] + +A **[firewall][2]** is a way to regulate the incoming and outgoing traffic on your network. A well-configured firewall is crucial for the security of servers. + +But what about normal, desktop users? Do you need a firewall on your Linux system? Most likely you are connected to internet via a router linked to your internet service provider (ISP). Some routers already have built-in firewall. On top of that, your actual system is hidden behind NAT. In other words, you probably have a security layer when you are on your home network. + +Now that you know you should be using a firewall on your system, let’s see how you can easily install and configure a firewall on Ubuntu or any other Linux distribution. + +### Setting Up A Firewall With GUFW + +**[GUFW][3]** is a graphical utility for managing [Uncomplicated Firewall][4] ( **UFW** ). In this guide, I’ll go over configuring a firewall using **GUFW** that suits your needs, going over the different modes and rules. + +But first, let’s see how to install GUFW. + +#### Installing GUFW on Ubuntu and other Linux + +GUFW is available in all major Linux distributions. I advise using your distribution’s package manager for installing GUFW. + +If you are using Ubuntu, make sure you have the Universe Repository enabled. To do that, open up a terminal (default hotkey**:** CTRL+ALT+T) and enter: + +``` +sudo add-apt-repository universe +sudo apt update -y +``` + +Now you can install GUFW with this command: + +``` +sudo apt install gufw -y +``` + +That’s it! If you prefer not touching the terminal, you can install it from the Software Center as well. + +Open Software Center and search for **gufw** and click on the search result. + +![Search for gufw in software center][5] + +Go ahead and click **Install**. + +![Install GUFW from the Software Center][6] + +To open **gufw** , go to your menu and search for it. + +![Start GUFW][7] + +This will open the firewall application and you’ll be greeted by a “ **Getting Started** ” section. + +![GUFW Interface and Welcome Screen][8] + +#### Turn on the firewall + +The first thing to notice about this menu is the **Status** toggle. Pressing this button will turn on/off the firewall ( **default:** off), applying your preferences (policies and rules). + +![Turn on the firewall][9] + +If turned on, the shield icon turn from grey to colored. The colors, as noted later in this article, reflect your policies. This will also make the firewall **automatically start** on system startup. + +**Note:** _**Home** will be turned **off** by default. The other profiles (see next section) will be turned **on.**_ + +#### Understanding GUFW and its profiles + +As you can see in the menu, you can select different **profiles**. Each profile comes with different **default policies**. What this means is that they offer different behaviors for incoming and outgoing traffic. + +The **default profiles** are: + + * Home + * Public + * Office + + + +You can select another profile by clicking on the current one ( **default: Home** ). + +![][10] + +Selecting one of them will modify the default behavior. Further down, you can change Incoming and Outgoing traffic preferences. + +By default, both in **Home** and in **Office** , these policies are **Deny Incoming** and **Allow Outgoing**. This enables you to use services such as http/https without letting anything get in ( **e.g.** ssh). + +For **Public** , they are **Reject Incoming** and **Allow Outgoing**. **Reject** , similar to **deny** , doesn’t let services in, but also sends feedback to the user/service that tried accessing your machine (instead of simply dropping/hanging the connection). + +Note + +If you are an average desktop user, you can stick with the default profiles. You’ll have to manually change the profiles if you change the network. + +So if you are travelling, set the firewall on public profile and the from here forwards, firewall will be set in public mode on each reboot. + +#### Configuring firewall rules and policies [for advanced users] + +All profiles use the same rules, only the policies the rules build upon will differ. Changing the behavior of a policy ( **Incoming/Outgoing** ) will apply the changes to the selected profile. + +Note that the policies can only be changed while the firewall is active (Status: ON). + +Profiles can easily be added, deleted and renamed from the **Preferences** menu. + +##### Preferences + +In the top bar, click on **Edit**. Select **Preferences**. + +![Open Preferences Menu in GUFW][11] + +This will open up the **Preferences** menu. + +![][12] + +Let’s go over the options you have here! + +**Logging** means exactly what you would think: how much information does the firewall write down in the log files. + +The options under **Gufw** are quite self-explanatory. + +In the section under **Profiles** is where we can add, delete and rename profiles. Double-clicking on a profile will allow you to **rename** it. Pressing **Enter** will complete this process and pressing **Esc** will cancel the rename. + +![][13] + +To **add** a new profile, click on the **+** under the list of profiles. This will add a new profile. However, it won’t notify you about it. You’ll also have to scroll down the list to see the profile you created (using the mouse wheel or the scroll bar on the right side of the list). + +**Note:** _The newly added profile will **Deny Incoming** and **Allow Outgoing** traffic._ + +![][14] + +Clicking a profile highlight that profile. Pressing the **–** button will **delete** the highlighted profile. + +![][15] + +**Note:** _You can’t rename/remove the currently selected profile_. + +You can now click on **Close**. Next, I’ll go into setting up different **rules**. + +##### Rules + +Back to the main menu, somewhere in the middle of the screen you can select different tabs ( **Home, Rules, Report, Logs)**. We already covered the **Home** tab (that’s the quick guide you see when you start the app). + +![][16] + +Go ahead and select **Rules**. + +![][17] + +This will be the bulk of your firewall configuration: networking rules. You need to understand the concepts UFW is based on. That is **allowing, denying, rejecting** and **limiting** traffic. + +**Note:** _In UFW, the rules apply from top to bottom (the top rules take effect first and on top of them are added the following ones)._ + +**Allow, Deny, Reject, Limit:**These are the available policies for the rules you’ll add to your firewall. + +Let’s see exactly what each of them means: + + * **Allow:** allows any entry traffic to a port + * **Deny:** denies any entry traffic to a port + * **Reject:** denies any entry traffic to a port and informs the requester about the rejection + * **Limit:** denies entry traffic if an IP address has attempted to initiate 6 or more connections in the last 30 seconds + + + +##### Adding Rules + +There are three ways to add rules in GUFW. I’ll present all three methods in the following section. + +**Note:** _After you added the rules, changing their order is a very tricky process and it’s easier to just delete them and add them in the right order._ + +But first, click on the **+** at the bottom of the **Rules** tab. + +![][18] + +This should open a pop-up menu ( **Add a Firewall Rule** ). + +![][19] + +At the top of this menu, you can see the three ways you can add rules. I’ll guide you through each method i.e. **Preconfigured, Simple, Advanced**. Click to expand each section. + +**Preconfigured Rules** + +This is the most beginner-friendly way to add rules. + +The first step is choosing a policy for the rule (from the ones detailed above). + +![][20] + +The next step is to choose the direction the rule will affect ( **Incoming, Outgoing, Both** ). + +![][21] + +The **Category** and **Subcategory** choices are plenty. These narrow down the **Applications** you can select + +Choosing an **Application** will set up a set of ports based on what is needed for that particular application. This is especially useful for apps that might operate on multiple ports, or if you don’t want to bother with manually creating rules for handwritten port numbers. + +If you wish to further customize the rule, you can click on the **orange arrow icon**. This will copy the current settings (Application with it’s ports etc.) and take you to the **Advanced** rule menu. I’ll cover that later in this article. + +For this example, I picked an **Office Database** app: **MySQL**. I’ll deny all incoming traffic to the ports used by this app. +To create the rule, click on **Add**. + +![][22] + +You can now **Close** the pop-up (if you don’t want to add any other rules). You can see that the rule has been successfully added. + +![][23] + +The ports have been added by GUFW, and the rules have been automatically numbered. You may wonder why are there two new rules instead of just one; the answer is that UFW automatically adds both a standard **IP** rule and an **IPv6** rule. + +**Simple Rules** + +Although setting up preconfigured rules is nice, there is another easy way to add a rule. Click on the **+** icon again and go to the **Simple** tab. + +![][24] + +The options here are straight forward. Enter a name for your rule and select the policy and the direction. I’ll add a rule for rejecting incoming SSH attempts. + +![][25] + +The **Protocols** you can choose are **TCP, UDP** or **Both**. + +You must now enter the **Port** for which you want to manage the traffic. You can enter a **port number** (e.g. 22 for ssh), a **port range** with inclusive ends separated by a **:** ( **colon** ) (e.g. 81:89) or a **service name** (e.g. ssh). I’ll use **ssh** and select **both TCP and UDP** for this example. As before, click on **Add** to completing the creation of your rule. You can click the **red arrow icon** to copy the settings to the **Advanced** rule creation menu. + +![][26] + +If you select **Close** , you can see that the new rule (along with the corresponding IPv6 rule) has been added. + +![][27] + +**Advanced Rules** + +I’ll now go into how to set up more advanced rules, to handle traffic from specific IP addresses and subnets and targeting different interfaces. + +Let’s open up the **Rules** menu again. Select the **Advanced** tab. + +![][28] + +By now, you should already be familiar with the basic options: **Name, Policy, Direction, Protocol, Port**. These are the same as before. + +![][29] + +**Note:** _You can choose both a receiving port and a requesting port._ + +What changes is that now you have additional options to further specialize our rules. + +I mentioned before that rules are automatically numbered by GUFW. With **Advanced** rules you specify the position of your rule by entering a number in the **Insert** option. + +**Note:** _Inputting **position 0** will add your rule after all existing rules._ + +**Interface** let’s you select any network interface available on your machine. By doing so, the rule will only have effect on traffic to and from that specific interface. + +**Log** changes exactly that: what will and what won’t be logged. + +You can also choose IPs for the requesting and for the receiving port/service ( **From** , **To** ). + +All you have to do is specify an **IP address** (e.g. 192.168.0.102) or an entire **subnet** (e.g. 192.168.0.0/24 for IPv4 addresses ranging from 192.168.0.0 to 192.168.0.255). + +In my example, I’ll set up a rule to allow all incoming TCP SSH requests from systems on my subnet to a specific network interface of the machine I’m currently running. I’ll add the rule after all my standard IP rules, so that it takes effect on top of the other rules I have set up. + +![][30] + +**Close** the menu. + +![][31] + +The rule has been successfully added after the other standard IP rules. + +##### Edit Rules + +Clicking a rule in the rules list will highlight it. Now, if you click on the **little cog icon** at the bottom, you can **edit** the highlighted rule. + +![][32] + +This will open up a menu looking something like the **Advanced** menu I explained in the last section. + +![][33] + +**Note:** _Editing any options of a rule will move it to the end of your list._ + +You can now ether select on **Apply** to modify your rule and move it to the end of the list, or hit **Cancel**. + +##### Delete Rules + +After selecting (highlighting) a rule, you can also click on the **–** icon. + +![][34] + +##### Reports + +Select the **Report** tab. Here you can see services that are currently running (along with information about them, such as Protocol, Port, Address and Application name). From here, you can **Pause Listening Report (Pause Icon)** or **Create a rule from a highlighted service from the listening report (+ Icon)**. + +![][35] + +##### Logs + +Select the **Logs** tab. Here is where you’ll have to check for any errors are suspicious rules. I’ve tried creating some invalid rules to show you what these might look like when you don’t know why you can’t add a certain rule. In the bottom section, there are two icons. Clicking the **first icon copies the logs** to your clipboard and clicking the **second icon** **clears the log**. + +![][36] + +### Wrapping Up + +Having a firewall that is properly configured can greatly contribute to your Ubuntu experience, making your machine safer to use and allowing you to have full control over incoming and outgoing traffic. + +I have covered the different uses and modes of **GUFW** , going into how to set up different rules and configure a firewall to your needs. I hope that this guide has been helpful to you. + +If you are a beginner, this should prove to be a comprehensive guide; even if you are more versed in the Linux world and maybe getting your feet wet into servers and networking, I hope you learned something new. + +Let us know in the comments if this article helped you and why did you decide a firewall would improve your system! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/set-up-firewall-gufw + +作者:[Sergiu][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/sergiu/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/firewall-linux.png?resize=800%2C450&ssl=1 +[2]: https://en.wikipedia.org/wiki/Firewall_(computing) +[3]: http://gufw.org/ +[4]: https://en.wikipedia.org/wiki/Uncomplicated_Firewall +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/ubuntu_software_gufw-1.jpg?ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/ubuntu_software_install_gufw.jpg?ssl=1 +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/show_applications_gufw.jpg?ssl=1 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw.jpg?ssl=1 +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_toggle_status.jpg?ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_select_profile-1.jpg?ssl=1 +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_open_preferences.jpg?ssl=1 +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_preferences.png?fit=800%2C585&ssl=1 +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_rename_profile.png?fit=800%2C551&ssl=1 +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_add_profile.png?ssl=1 +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_delete_profile.png?ssl=1 +[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_home_tab.png?ssl=1 +[17]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_rules_tab.png?ssl=1 +[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_add_rule.png?ssl=1 +[19]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_add_rules_menu.png?ssl=1 +[20]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_preconfigured_rule_policy.png?ssl=1 +[21]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_preconfigured_rule_direction.png?ssl=1 +[22]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_preconfigured_add_rule.png?ssl=1 +[23]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_preconfigured_rule_added.png?ssl=1 +[24]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_add_simple_rules_menu.png?ssl=1 +[25]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_simple_rule_name_policy_direction.png?ssl=1 +[26]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_add_simple_rule.png?ssl=1 +[27]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_simple_rule_added.png?ssl=1 +[28]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_add_advanced_rules_menu.png?ssl=1 +[29]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_advanced_rule_basic_options.png?ssl=1 +[30]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_add_advanced_rule.png?ssl=1 +[31]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_advanced_rule_added.png?ssl=1 +[32]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_edit_highlighted_rule.png?ssl=1 +[33]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_edit_rule_menu.png?ssl=1 +[34]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_delete_rule.png?ssl=1 +[35]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_report_tab.png?ssl=1 +[36]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/03/gufw_log_tab-1.png?ssl=1 +[37]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/03/firewall-linux.png?fit=800%2C450&ssl=1 From d034ad6b01f3e2ba9303c542966d536fd5ff36e0 Mon Sep 17 00:00:00 2001 From: zhangxiangping Date: Wed, 20 Mar 2019 15:33:29 +0800 Subject: [PATCH 353/796] 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 354/796] 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 支持使用 `