From 6e2fd557f6c412e021bc476ec8326faaeeb4a2cc Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Mon, 17 Dec 2018 13:37:28 +0800 Subject: [PATCH 001/322] Translating How to Update Ubuntu. --- ...untu -Terminal - GUI Methods- It-s FOSS.md | 174 ++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md diff --git a/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md b/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md new file mode 100644 index 0000000000..3a4332c365 --- /dev/null +++ b/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md @@ -0,0 +1,174 @@ +[#]: collector: (lujun9972) +[#]: translator: (LazyWolfLin) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Update Ubuntu [Terminal & GUI Methods] It's FOSS) +[#]: via: (https://itsfoss.com/update-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何更新Ubuntu [终端及GUI方式] It's FOSS +====== + +**这篇教程将向你展示如何更新服务器版本或者桌面版本的Ubuntu。它还解释了更新和升级之间的区别以及你应该了解的有关于Ubuntu Linux中的更新的一些其他内容。** + +如果你是一个新手并已经体验Ubuntu数天或几周,你可能想知道如何更新你的[Ubuntu][1]系统以获取安全补丁,错误修复和应用升级。 + +更新 Ubuntu 非常简单。我并不夸张的说。它简单得只要运行两个命令。让我来告诉你更多更新细节。 + +Please note that the tutorial is valid for Ubuntu 18.04, 16.04 or any other version. The command line way is also valid for Ubuntu-based distributions like Linux Mint, Linux Lite, elementary OS etc. + +### Update Ubuntu via Command Line + +![How to Update Ubuntu][2] + +On the desktop, open the terminal. You can find it in the menu or use the Ctrl+Alt+T [keyboard shortcut][3]. If you are logged on to an [Ubuntu server][4], you already have access to a terminal. + +In the terminal, you just have to use the following command: + +``` +sudo apt update && sudo apt upgrade -y +``` + +It will ask for password and you can use your account’s password. You won’t see the anything on the screen while typing so keep on typing your password and hit enter. + +Now let me explain the above command. + +Actually, it’s not a single command. It’s a combination of two commands. The && is a way to combine two commands in a way that the second command runs only when the previous command ran successfully. + +The ‘-y’ in the end automatically enters yes when the command ‘apt upgrade’ ask for your confirmation before installing the updates. + +Note that you can also use the two commands separately, one by one: + +``` +sudo apt update +sudo apt upgrade +``` + +It will take a little longer because you have to wait for one command to finish and then enter the second command. + +#### Explanation: sudo apt update + +This command updates the local database of available packages. If you won’t run this command, the local database won’t be updated and your system will not know if there are any new versions available. + +This is why when you run the sudo apt update, you’ll see lots of URLs in the output. The command fetches the package information from the respective repositories (the URLs you see in the output). + +![Updating Ubuntu Linux][5] + +At the end of the command, it tells you how many packages can be upgraded. You can see these packages by running the following command: + +``` +apt list --upgradable +``` + +**Additional Reading:** Read this article to learn [what is Ign, Hit and Get in the apt update command output][6]. + +#### Explanation: sudo apt upgrade + +This command matches the versions of installed packages with the local database. It collects all of them and then it will list all of the packages that have a newer version available. At this point, it will ask if you want to upgrade (the installed packages to the newer version). + +![Update Ubuntu Linux via Command Line][7] + +You can type ‘yes’, ‘y’ or just press enter to confirm the installation of updates. + +So the bottom line is that the sudo apt update checks for the availability of new versions while as the sudo apt upgrade actually performs the update. + +The term update might be confusing as you might expect the apt update command to update the system by installing the updates but that doesn’t happen. + +### Update Ubuntu via GUI [For Desktop Users] + +If you are using Ubuntu as a desktop, you don’t have to go to terminal just for updating the system. You can still use the command line but it’s optional for you. + +In the menu, look for ‘Software Updater’ and run it. + +![Run Software Updater in Ubuntu][8] + +It will check if there are updates available for your system. + +![Checking if updates are available for Ubuntu][9] + +If there are updates available, it will give provide you with options to install the updates. + +![Install Updates via Update Manager in Ubuntu][10] + +Click on Install Now, it may ask for your password. + +![Installing Updates in Ubuntu Linux via GUI][11] + +Once you enter your password, it will start installing the updates. + +![Updating Ubuntu via GUI][12] + +In some cases, you may need to reboot the system for the installed updates to work properly. You’ll be notified at the end of the update if you need to restart the system. + +![Updating Ubuntu via GUI][12] + +You can choose to restart later if you don’t want to reboot your system straightaway. + +![Installing updates via GUI in Ubuntu][13] + +Tip: If the software updater returns an error, you should use the command ‘sudo apt update’ in the terminal. The last few lines of the output will contain the actual error message. You can search on the internet for that error and fix the problem. + +### Few things to keep in mind abou updating Ubuntu + +You just learned how to update your Ubuntu system. If you are interested, you should also know these few things around Ubuntu updates. + +#### Clean up after an update + +Your system will have some unnecessary packages that won’t be required after the updates. You can remove such packages and [free up some space][14] using this command: + +``` +sudo apt autoremove +``` + +#### Live patching kernel in Ubuntu Server to avoid rebooting + +In case of a Linux kernel updates, you’ll have to restart the system after the update. This is an issue when you don’t want downtime for your server. + +[Live patching][15] feature allows the patching of Linux kernel while the kernel is still running. In other words, you don’t have to reboot your system. + +If you manage servers, you may want to [enable live patching in Ubuntu][16]. + +#### Version upgrades are different + +The updates discussed here is to keep your Ubuntu install fresh and updated. It doesn’t cover the [version upgrades][17] (for example upgrading Ubuntu 16.04 to 18.04). + +[Ubuntu version][18] upgrades are entirely a different thing. It updates the entire operating system core. You need to make proper backups before starting this lengthy process. + +### Conclusion + +I hope you liked this tutorial on updating the Ubuntu system and you learned a few new things. + +If you have any questions, please fee free to ask. If you are an experienced Linux users and have some tip that can make this tutorial more useful, please share it with the rest of us. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/update-ubuntu/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.ubuntu.com/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/how-to-update-ubuntu.png?resize=800%2C450&ssl=1 +[3]: https://itsfoss.com/ubuntu-shortcuts/ +[4]: https://www.ubuntu.com/download/server +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/update-ubunt-1.jpeg?resize=800%2C357&ssl=1 +[6]: https://itsfoss.com/apt-get-linux-guide/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/update-ubunt-2.jpeg?ssl=1 +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/update-ubuntu-via-GUI-1.jpeg?resize=800%2C250&ssl=1 +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/update-ubuntu-via-GUI-2.jpeg?resize=800%2C250&ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/update-ubuntu-GUI-3.jpeg?resize=800%2C365&ssl=1 +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/install-update-ubuntu-1.jpg?resize=800%2C450&ssl=1 +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/installing-updates-ubuntu.jpg?ssl=1 +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/installing-updates-ubuntu-2.jpeg?ssl=1 +[14]: https://itsfoss.com/free-up-space-ubuntu-linux/ +[15]: https://www.ubuntu.com/livepatch +[16]: https://www.cyberciti.biz/faq/howto-live-patch-ubuntu-linux-server-kernel-without-rebooting/ +[17]: https://itsfoss.com/upgrade-ubuntu-version/ +[18]: https://itsfoss.com/how-to-know-ubuntu-unity-version/ From 73aa9a68a321fc81b3d1f6e7ca0aeb876a43a31a Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Tue, 18 Dec 2018 14:05:23 +0800 Subject: [PATCH 002/322] Translating How to Update Ubuntu. --- ...untu -Terminal - GUI Methods- It-s FOSS.md | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md b/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md index 3a4332c365..b0f0751d81 100644 --- a/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md +++ b/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md @@ -7,7 +7,7 @@ [#]: via: (https://itsfoss.com/update-ubuntu/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -如何更新Ubuntu [终端及GUI方式] It's FOSS +如何更新 Ubuntu [终端及GUI方式] It's FOSS ====== **这篇教程将向你展示如何更新服务器版本或者桌面版本的Ubuntu。它还解释了更新和升级之间的区别以及你应该了解的有关于Ubuntu Linux中的更新的一些其他内容。** @@ -16,38 +16,38 @@ 更新 Ubuntu 非常简单。我并不夸张的说。它简单得只要运行两个命令。让我来告诉你更多更新细节。 -Please note that the tutorial is valid for Ubuntu 18.04, 16.04 or any other version. The command line way is also valid for Ubuntu-based distributions like Linux Mint, Linux Lite, elementary OS etc. +请注意,本教程适用于 Ubuntu 18.04,16.04 或任何其他版本。命令行方式也适用于基于 Ubuntu 的发行版如 Linux Mint,Linux Lite,elementary OS 等。 -### Update Ubuntu via Command Line +### 通过命令行更新 Ubuntu -![How to Update Ubuntu][2] +![如何更新 Ubuntu][2] -On the desktop, open the terminal. You can find it in the menu or use the Ctrl+Alt+T [keyboard shortcut][3]. If you are logged on to an [Ubuntu server][4], you already have access to a terminal. +在桌面上,打开终端。你可以在菜单里找到它或者使用 Ctrl+Alt+T [快捷键][3]。如果你登陆到一台 [Ubuntu 服务器][4],那你已经在访问一个终端了。 -In the terminal, you just have to use the following command: +在终端里,你只需要使用以下命令: ``` sudo apt update && sudo apt upgrade -y ``` -It will ask for password and you can use your account’s password. You won’t see the anything on the screen while typing so keep on typing your password and hit enter. +它将询问密码,而你可以使用你账号的密码。输入时,你将不会看到任何内容在屏幕上,所以请继续输入你的密码并按回车键。 -Now let me explain the above command. +现在,我来解释下上面的命令。 -Actually, it’s not a single command. It’s a combination of two commands. The && is a way to combine two commands in a way that the second command runs only when the previous command ran successfully. +事实上,这不是一条命令。它由两条命令组成。符号 `&&` 是合并两条命令的一个方法,第二条命令仅在前一条命令执行成功时执行。 -The ‘-y’ in the end automatically enters yes when the command ‘apt upgrade’ ask for your confirmation before installing the updates. +当命令 `apt upgrade` 要求你在安装更新前确认时,末尾的参数 `-y` 会自动输入 yes。 -Note that you can also use the two commands separately, one by one: +请注意,你也可以逐条使用这两条命令: ``` sudo apt update sudo apt upgrade ``` -It will take a little longer because you have to wait for one command to finish and then enter the second command. +这将花费更长的时间,因为你必须等待第一条命令执行完成后才能输入第二条命令。 -#### Explanation: sudo apt update +#### 说明:sudo apt update This command updates the local database of available packages. If you won’t run this command, the local database won’t be updated and your system will not know if there are any new versions available. @@ -63,7 +63,7 @@ apt list --upgradable **Additional Reading:** Read this article to learn [what is Ign, Hit and Get in the apt update command output][6]. -#### Explanation: sudo apt upgrade +#### 说明:sudo apt upgrade This command matches the versions of installed packages with the local database. It collects all of them and then it will list all of the packages that have a newer version available. At this point, it will ask if you want to upgrade (the installed packages to the newer version). @@ -75,7 +75,7 @@ So the bottom line is that the sudo apt update checks for the availability of ne The term update might be confusing as you might expect the apt update command to update the system by installing the updates but that doesn’t happen. -### Update Ubuntu via GUI [For Desktop Users] +### 通过 GUI 更新 Ubuntu[适用于桌面用户] If you are using Ubuntu as a desktop, you don’t have to go to terminal just for updating the system. You can still use the command line but it’s optional for you. @@ -109,11 +109,11 @@ You can choose to restart later if you don’t want to reboot your system straig Tip: If the software updater returns an error, you should use the command ‘sudo apt update’ in the terminal. The last few lines of the output will contain the actual error message. You can search on the internet for that error and fix the problem. -### Few things to keep in mind abou updating Ubuntu +### 更新 Ubuntu 时要记住几件事 You just learned how to update your Ubuntu system. If you are interested, you should also know these few things around Ubuntu updates. -#### Clean up after an update +#### 更新后清理 Your system will have some unnecessary packages that won’t be required after the updates. You can remove such packages and [free up some space][14] using this command: @@ -121,7 +121,7 @@ Your system will have some unnecessary packages that won’t be required after t sudo apt autoremove ``` -#### Live patching kernel in Ubuntu Server to avoid rebooting +#### 在 Ubuntu Server 中热修复内核以避免重启 In case of a Linux kernel updates, you’ll have to restart the system after the update. This is an issue when you don’t want downtime for your server. @@ -129,13 +129,13 @@ In case of a Linux kernel updates, you’ll have to restart the system after the If you manage servers, you may want to [enable live patching in Ubuntu][16]. -#### Version upgrades are different +#### 版本升级是不同的 The updates discussed here is to keep your Ubuntu install fresh and updated. It doesn’t cover the [version upgrades][17] (for example upgrading Ubuntu 16.04 to 18.04). [Ubuntu version][18] upgrades are entirely a different thing. It updates the entire operating system core. You need to make proper backups before starting this lengthy process. -### Conclusion +### 总结 I hope you liked this tutorial on updating the Ubuntu system and you learned a few new things. From f0c2d70ee9c8ef9d37103a27a1f05120615d1d25 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 18 Dec 2018 19:37:13 +0800 Subject: [PATCH 003/322] PRF:20171111 A CEOs Guide to Emacs.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 部分 --- .../tech/20171111 A CEOs Guide to Emacs.md | 88 ++++++++----------- 1 file changed, 39 insertions(+), 49 deletions(-) diff --git a/translated/tech/20171111 A CEOs Guide to Emacs.md b/translated/tech/20171111 A CEOs Guide to Emacs.md index 5b25f37313..6d14ad7a8e 100644 --- a/translated/tech/20171111 A CEOs Guide to Emacs.md +++ b/translated/tech/20171111 A CEOs Guide to Emacs.md @@ -1,57 +1,58 @@ 一位 CEO 的 Emacs 指南 -============================================================ +=========== -几年前,不,是几十年前,我就在用 Emacs。不论是码代码、编写文档,还是管理邮件和日程,我都用这个编辑器或者是说操作系统,而且我还乐此不疲。多年过去了,我也转向了其他更新,更好的工具。结果,我已经忘了如何在不用鼠标的情况下来浏览文件。大约三个月前,我意识到我在应用程序和计算机之间切换上耗费了大量的时间,于是就决定再试一次 Emacs。这是个很正确的决定,原因有以下几个。其中包括了 `.emacs` 和 Dropbox 的技巧,可以让你建立一个良好的,可移植的环境。 +几年前,不,是几十年前,我就在用 Emacs。不论是码代码、编写文档,还是管理邮件和日程,我都用这个编辑器或者是说操作系统,而且我还乐此不疲。许多年过去了,我也转向了其他更新、更好的工具。结果,我已经忘了如何在不用鼠标的情况下来浏览文件。大约三个月前,我意识到我在应用程序和计算机之间切换上耗费了大量的时间,于是就决定再试一次 Emacs。这是个很正确的决定,原因有以下几个。其中包括了 `.emacs` 和 Dropbox 的技巧,可以让你建立一个良好的、可移植的环境。 -对于那先还没用过 Emacs 的人来说,你可能会讨厌它,但也可能喜欢上它。它有点像一个房子大小的 Rube Goldberg 机器,乍一看,它具备烤面包机的所有功能。这听起来不像是一种认可,但关键短语是“乍一看”。一旦你了解了Emacs,你就会意识到它其实是一种可以作为发动机的热核烤面包机。好吧,你想对文字做什么都可以。当考虑到计算寿命在很大程度上与文本有关时,这是一个相当大胆的声明,真的很大胆。 +对于那些还没用过 Emacs 的人来说,你可能会讨厌它,但也可能喜欢上它。它有点像一个房子大小的鲁布·戈德堡机械Rube Goldberg machine,乍一看,它具备烤面包机的所有功能。这听起来不像是一种认可,但关键短语是“乍一看”。一旦你了解了 Emacs,你就会意识到它其实是一种可以作为发动机的热核烤面包机……好吧,你可以用来对文字做什么都可以。当考虑到你的计算生活在很大程度上与文本有关时,这是一个相当大胆的声明,真的很大胆。 -也许对我来说更重要的是,它是我曾经使用过的一个应用程序,并让我觉得我真正的拥有它,而不是把我塑造成一个匿名的“用户”,就好像位于 [Soma][30] 或 Redmond 附近某个高档办公室的产品营销部门把钱作为明确的目标一样。现代生产力和创作应用程序(如文件或 `IDE`)就像碳纤维赛车,他们装备得很好,也很完整。而Emacs 就像一盒经典的 [Campagnolo][31] 零件和一个漂亮的拖钢框架,缺少曲柄臂和刹车杆,你必须在网上某个小众文化中找到它们。第二点就是它会给你带来无尽的快乐或烦恼,这取决于你自己,而且会一直持续到你生命的最后一天。我是那种在找到一堆老古董或用 `Emacs Lisp` 配置编辑器时同样感到高兴的人,具体情况因人而异。 +也许对我来说更重要的是,它是我曾经使用过的一个应用程序,并让我觉得我真正的拥有它,而不是把我塑造成一个匿名的“用户”,就好像位于 [Soma][30](LCTT 译注:旧金山的一个街区)或雷蒙德(LCTT 译注:微软总部所在地)附近某个高档办公室的产品营销部门把钱作为明确的目标一样。现代生产力和创作应用程序(如 Pages 或 IDE)就像碳纤维赛车,它们装备得很好,也很齐全。而 Emacs 就像一盒经典的 [Campagnolo][31] (LCTT 译注:世界上最好的三个公路自行车套件系统品牌之一)零件和一个漂亮的自行车牵引式钢框架,但缺少曲柄臂和刹车杆,你必须在网上某个小众文化中找到它们。第一点是它是更快更完整的。第二点就是它会给你带来无尽的快乐或烦恼,这取决于你自己,而且会一直持续到你生命的最后一天。我是那种在找到一堆老古董或用 `Emacs Lisp` 配置编辑器时同样感到高兴的人,具体情况因人而异。 -![1933 steel bicycle](https://blog.fugue.co/assets/images/bicycle.jpg) -一辆我还在骑的1933年产的钢制自行车。你可以从查看框架管差别: [https://www.youtube.com/watch?v=khJQgRLKMU0][6]. +![1933 steel bicycle](https://www.fugue.co/hubfs/Imported_Blog_Media/bicycle-1.jpg) -这可能给人一种 Emacs 已经过气或过时的印象。但它不是,它是强大和永恒的,只要你耐心地去理解它的一些规则。他的规则很另类,也很奇怪,但其中的逻辑却引人注目,且很有魅力。对于我来说, Emacs 更像是未来而不是过去。就像牵引式钢框架在未来几十年里将会变得好用和舒适,而神奇的碳纤维自行车将会被扔进垃圾场,在撞击中粉碎一样,Emacs 也将会作为一种在最新的流行应用早已被遗忘的时候的好用的工具继续存在这。 +*一辆我还在骑的1933年产的钢制自行车。你可以看看框架管差别: [https://www.youtube.com/watch?v=khJQgRLKMU0][6]* -如果通过编辑 `Lisp` 代码来构建自己的个人工作环境,并将这种非常适合自己的环境移植到任何计算机的想法吸引了你,那么你可能会爱上 Emacs。如果你喜欢很潮、很炫的,又不想投入太多时间和精力的情况下就能直接工作的话,那么它可能不适合你。我已经不再写代码了(除了 `Ludwig` 和 `Emacs Lisp`),但是 `Fugue` 的很多工程师都使用 Emacs 来提高码代码的效率。我公司有 30% 的工程师用 Emacs, 40% 用 `IDE` 和 30% 的用 vim。但这篇文章是关于 CEO 和其他[聪明的老板][32](PHB[1][7])的 Emacs 指南,所以我将解释或者说辩解我为什么喜欢它以及我如何使用它。同时我也希望我能介绍清楚从而让你能有个良好的体验,而不是花上几个小时去 Google。 +这可能给人一种 Emacs 已经过气或过时的印象。但它不是,它是强大和永恒的,只要你耐心地去理解它的一些规则。它的规则很另类,也很奇怪,但其中的逻辑却引人注目,且很有魅力。对于我来说, Emacs 更像是未来而不是过去。就像牵引式钢框架在未来几十年里将会变得好用和舒适,而神奇的碳纤维自行车将会被扔进垃圾场,在撞击中粉碎一样,Emacs 也将会作为一种在最新的流行应用早已被遗忘的时候的好用的工具继续存在这里。 -### 最后的优点 +如果通过编辑 Lisp 代码来构建自己的个人工作环境,并将这种非常适合自己的环境移植到任何计算机的想法吸引了你,那么你可能会爱上 Emacs。如果你喜欢很潮、很炫的,又不想投入太多时间和精力的情况下就能直接工作的话,那么它可能不适合你。我已经不再写代码了(除了 Ludwig 和 Emacs Lisp),但是 Fugue 的很多工程师都使用 Emacs 来提高码代码的效率。我公司有 30% 的工程师用 Emacs,40% 用 IDE 和 30% 的用 vim。但这篇文章是关于 CEO 和其他[聪明的老板][32]Pointy-Haired Bosses(PHB[^1] )(以及,其它好奇的人)的 Emacs 指南,所以我将解释或者说辩解我为什么喜欢它以及我如何使用它。同时我也希望我能介绍清楚从而让你能有个良好的体验,而不是花上几个小时去 Google。 -使用 Emacs 带来的长期优势是让生活更轻松。与最后的收获相比,最开始的付出完全值得。想想这些: +### 恒久优势 -### 无需上下文切换 +使用 Emacs 带来的长期优势是让生活更轻松。与最后的收获相比,最开始的付出完全值得。想想这些: -`Org` 模式本身就值得花时间,但如果你像我一样,你通常要处理十几份左右的文件 —— 从博客帖子到会议需要做什么的清单,再到员工评论。在现代计算世界中,这通常意味着要使用多个应用程序,所有这些应用程序都有不同的用户界面,保存方式、排序和搜索方式。结果就是你需要不断转换思维环境,记住细节。我讨厌上下文切换,因为它是一种强加到我身上的方式,原因是破坏了接口模型[2][8],并且我讨厌记住计算机的命令,这本该是计算机要记住的东西。在单个环境下,Emacs 对 PHB 甚至比对于程序员更有用,因为程序员更多时候只需要专注于一个程序。转换思维环境的成本比通常看起来的要高。操作系统和应用程序供应商已经构建了各种接口,以分散我们对这一现实的注意力。如果你是技术人员,通过快捷键(`M-:`)来访问功能强大的[语言解释器][33]会方便的多[3][9]。 +#### 无需上下文切换 -许多应用程序可以全天全屏并用于编辑文本。Emacs 是惟一的,因为它既是编辑器也是 `Emacs Lisp` 解释器。从本质上说,你工作时只要用电脑上的一两个键就能完成。如果你对编程略知一二,就能发现这一位置你可以在 Emacs 中做 _任何事情_。一旦你在内存中有了这些命令,你的电脑就可以在你工作时几乎实时地为你提供高效的运转。你不会想用 `Emacs Lisp` 来重建 Excel,只要用简单的一两行代码就能实现 Excel 中大多数的功能。如果我需要处理数字,我更有可能转到 scratch 缓冲区,编写一些代码,而不是打开电子表格。即便是我有一封多行的邮件要写,我通常也会先在 Emacs 中写完,然后再复制粘贴到邮件客户端中。当你可以流畅的书写时,为什么要去切换呢?你可以先从一两个简单的计算开始,随着时间的推移,你可以很容易的在 Emacs 中添加你所需要处理的计算。这在应用程序中可能是独一无二的,同时还提供了让为其他的人创造的丰富特性。还记得 Isaac Asimov 书中那些神奇的终端吗[4][10]? Emacs 是我所遇到的最接近他们的东西。我决定不再用什么应用程序来做这个或那个。相反,我只是工作。拥有一个伟大的工具并致力于此,这才是真正的动力和效率。 +Org 模式本身就值得花时间,但如果你像我一样,你通常要处理十几份左右的文件 —— 从博客帖子到会议需要做什么的清单,再到员工评估。在现代计算世界中,这通常意味着要使用多个应用程序,所有这些应用程序都有不同的用户界面、保存方式、排序和搜索方式。结果就是你需要不断转换思维环境,记住细节。我讨厌上下文切换,因为它是一种强加到我身上的方式,原因是破坏了界面模型[^2] ,并且我讨厌记住本该是计算机要为我记住的东西。在单个环境下,Emacs 对 PHB 甚至比对于程序员更有用,因为程序员更多时候只需要专注于一个程序。转换思维环境的成本比通常看起来的要高。操作系统和应用程序厂商已经构建了各种界面,以分散我们对这一现实的注意力。如果你是技术人员,通过快捷键(`M-:`)来访问功能强大的[语言解释器][33]会方便的多[^3] 。 -### 在安静中创造事情 +许多应用程序可以全天全屏地用于编辑文本。Emacs 是惟一的,因为它既是编辑器也是 Emacs Lisp 解释器。从本质上说,你工作时只要用电脑上的一两个键就能完成。如果你对编程略知一二,就能发现这意味着你可以在 Emacs 中做 _任何事情_。一旦你在内存中有了这些命令,你的电脑就可以在你工作时几乎实时地为你提供高效的运转。你不会想用 Emacs Lisp 来重建 Excel,只要用简单的一两行代码就能实现 Excel 中大多数的功能。如果我需要处理数字,我更有可能转到 scratch 缓冲区,编写一些代码,而不是打开电子表格。即便是我有一封多行的邮件要写,我通常也会先在 Emacs 中写完,然后再复制粘贴到邮件客户端中。当你可以流畅的书写时,为什么要去切换呢?你可以先从一两个简单的算术开始,随着时间的推移,你可以很容易的在 Emacs 中添加你所需要处理的计算。这在应用程序中可能是独一无二的,同时还提供了让为其他的人创造的丰富特性。还记得艾萨克·阿西莫夫书中那些神奇的终端吗? Emacs 是我所遇到的最接近它们的东西[^4] 。我决定不再用什么应用程序来做这个或那个。相反,我只是工作。拥有一个伟大的工具并致力于此,这才是真正的动力和效率。 + +#### 在安静中创造事情 拥有我所发现的最好的文本编辑功能的最终结果是什么?有一群人在做各种各样有用的补充吗?拥有 `Lisp` 键盘的全部功能?这就是我用 Emacs 来完成所有的创作性工作,处理音乐和图片除外。 -我的办公桌上有两个显示器。其中一块竖屏是将 Emacs 全天全屏显示,另一个显示浏览器,用来搜索和阅读,通常也会打开一个终端。我将日历、邮件等保存在 OS X 的另一个桌面上,当我使用 Emacs 时,这个桌面是隐藏的,同时我也会关掉所有通知。这样就能让我专注于我手头上在做的事了。我发现,在更现代的 UI 应用程序中,消除干扰几乎是不可能的,因为这些应用程序努力提供帮助并使其易于使用。我不需要经常被提醒该如何操作,我已经做了成千上万次了,我真正需要的是一张干净整洁的白纸用来思考。也许因为年龄和自己的“恶习”,我不太喜欢处在嘈杂的环境中,但我认为这值得一试。看看在你电脑环境中有一些真正的宁静是怎样的。当然,现在很多应用程序都有隐藏界面的模式,谢天谢地,苹果和微软现在都有了真正意义上的全屏模式。但是,没有并没有应用程序可以强大到足以“处理”大多数事务。除非你整天写代码,或者像写一本书一样处理很长的文档,否则你仍然会面临其他应用程序的干扰。而且,大多数现代应用程序似乎同时显得自视甚高,缺乏功能和可用性[5][11]。比其 office 应用程序,我更讨厌在线版的应用程序。 +我的办公桌上有两个显示器。其中一块竖屏是将 Emacs 全天全屏显示,另一个显示浏览器,用来搜索和阅读,通常也会打开一个终端。我将日历、邮件等保存在 OS X 的另一个桌面上,当我使用 Emacs 时,这个桌面是隐藏的,同时我也会关掉所有通知。这样就能让我专注于我手头上在做的事了。我发现,在更现代的 UI 应用程序中,消除干扰几乎是不可能的,因为这些应用程序努力提供帮助并使其易于使用。我不需要经常被提醒该如何操作,我已经做了成千上万次了,我真正需要的是一张干净整洁的白纸用来思考。也许因为年龄和自己的“恶习”,我不太喜欢处在嘈杂的环境中,但我认为这值得一试。看看在你电脑环境中有一些真正的宁静是怎样的。当然,现在很多应用程序都有隐藏界面的模式,谢天谢地,苹果和微软现在都有了真正意义上的全屏模式。但是,没有并没有应用程序可以强大到足以“处理”大多数事务。除非你整天写代码,或者像写一本书一样处理很长的文档,否则你仍然会面临其他应用程序的干扰。而且,大多数现代应用程序似乎同时显得自视甚高,缺乏功能和可用性[^5] 。比其 office 应用程序,我更讨厌在线版的应用程序。 ![1933 steel bicycle](https://blog.fugue.co/assets/images/desktop.jpg) 我的桌面布局, Emacs 在左边 但是交流呢?创造和交流之间的差别很大。当我为两者留出不同的时间时,我的效率会更高。在 `Fugue` 中使用了 `Slack`,痛并快乐着。我把它和我的日历、电子邮件放在一个即时通讯的桌面上,这样,当我正在做事时,我很高兴地能够忽略所有的聊天。仅仅是风投或董事会董事的一次懈怠,或一封电子邮件,就能让我立刻丢掉手头工作。但是,大多数事情通常可以等上一两个小时。 -### 带上一切,并保留着 +#### 带上一切,并保留着 第三个原因是,我发现 Emacs 比其它的环境更有优势的是你可以很容易的用它来处理事务。我的意思是,你所需要的只是通过 `Dropbox` 类似的网站同步一两个目录,而不是让大量的应用程序以它们自己的方式进行交互和同步。然后,你可以在任何地方,任何环境下工作了,因为你已经精心制作了适合目的套件了。我在 OS X,Windows,或有时在 Linux 都是这样做的。它非常简单可靠。这种功能很有用,以至于我害怕处理页面、Google Docs、Office 或其他类型的文件和应用程序,这些文件和应用程序会迫使我回到文件系统或云中的某个地方去寻找。 -永久存储在计算机上的限制是文件格式。假设人类已经解决了存储[6][12]的问题,随着时间的推移,我们面临的问题是我们能否够继续访问我们创建的信息。文本文件是最持久的计算格式。你可以用 Emacs 轻松地打开 1970 年的文本文件。然而对于办公应用程序却并非如此。同时文本文件要比 Office 应用程序数据文件小得多,也要好的多。作为一个数码背包迷,作为一个在脑子里一闪而过就会做很多小笔记的人,拥有一个简单、轻便、永久、随时可用的东西对我来说很重要。 +永久存储在计算机上的限制是文件格式。假设人类已经解决了存储[^6] 的问题,随着时间的推移,我们面临的问题是我们能否够继续访问我们创建的信息。文本文件是最持久的计算格式。你可以用 Emacs 轻松地打开 1970 年的文本文件。然而对于办公应用程序却并非如此。同时文本文件要比 Office 应用程序数据文件小得多,也要好的多。作为一个数码背包迷,作为一个在脑子里一闪而过就会做很多小笔记的人,拥有一个简单、轻便、永久、随时可用的东西对我来说很重要。 如果你准备尝试 Emacs,请继续阅读!下面的部分不会取代完整的教程,但是在完成阅读时,就可以操作了。 ### 学会驾驭 Emacs —— 一个专业的配置 -所有这些强大、精神上的平静和安宁的代价是,Emacs 有一个陡峭的学习曲线,它的一切都与你以前所习惯的不同。一开始,这会让你觉得你是在浪费时间在一个过时和奇怪的应用程序上,就好像现代世界已经过去了。这有点像你只开过车,却要你去学骑自行车[7][13]。 +所有这些强大、精神上的平静和安宁的代价是,Emacs 有一个陡峭的学习曲线,它的一切都与你以前所习惯的不同。一开始,这会让你觉得你是在浪费时间在一个过时和奇怪的应用程序上,就好像现代世界已经过去了。这有点像你只开过车,却要你去学骑自行车[^7] 。 -### 该选哪个 Emacs +#### 该选哪个 Emacs -我用的是 GNU 中 OS X 和 Windows 的通用版本的 Emacs。你可以在 [][34][http://emacsformacos.com/][35] 获取 OS X 版本,在[][36][http://www.gnu.org/software/emacs/][37]获取 Windows 版本。市面上还有很多其他版本,尤其是 Mac 版本,但我发现,要做一些功能强大的东西(包括 `Lisp` 和许多模式),学习曲线要比实际操作低得多。下载,然后我们就可以开始了[8][14]! +我用的是 GNU 中 OS X 和 Windows 的通用版本的 Emacs。你可以在 [][34][http://emacsformacos.com/][35] 获取 OS X 版本,在[][36][http://www.gnu.org/software/emacs/][37]获取 Windows 版本。市面上还有很多其他版本,尤其是 Mac 版本,但我发现,要做一些功能强大的东西(包括 `Lisp` 和许多模式),学习曲线要比实际操作低得多。下载,然后我们就可以开始了[^8] ! -### 首先,学会浏览 +#### 首先,学会浏览 在本文中,我将约定 Emacs 中的键和组合。`C` 表示 `Control` 键,`M` 表示 `meta`(通常是 `Alt` 或 `Option` 键),以及用于组合键的连字符。因此,`C-h t` 表示同时按下 `Control` 和 `h` 键,然后释放,再按下 `t`。这个组快捷键会指向一个教程,这是你首先要做的一件事。 @@ -59,11 +60,11 @@ Emacs 附带的教程很值得去看。对于真正缺乏耐心的人,我将介绍一些重要的命令,但那个教程非常有用。记住:用 `C-h t` 进入教程。 -### 学会复制和粘贴 +#### 学会复制和粘贴 你可以叫 Emacs 设为 `CUA` 模式,这将会以熟悉的方式工作来操作复制粘贴,但是原生的 Emacs 方法更好,而且你一旦学会了它,就很容易。你可以使用 `Shift` 这样的浏览命令来标记区域(如选择)。所以 `C-F` 是选中管标前的一个字符,等等。亦可以用 `M-w` 来复制,用 `C-w` 剪切,然后用 `C-y` 粘贴。这些实际上叫做删除和召回,但它非常类似于剪切和粘贴。在删除的环中有些小技巧,但是现在,你只需要关注剪切、复制和粘贴。如果你在这开始摸索, `C-x u` 是撤销。 -### 下一步,学会用 `Ido` 模式 +#### 下一步,学会用 `Ido` 模式 相信我,`Ido` 会让文件的工作变得很简单。通常,你在 Emacs 中处理文件不需要使用一个单独分开的查找或文件资源管理器的窗口。相反的,你可以用编辑器的命令来创建、打开和保存文件。如果没有 `Ido` 的话,这将有点麻烦,所以我建议你在学习其他之前安装好它。 `Ido` 是 Emacs 的 22 版时开发出来的,但是需要对你的 `.emacs` 文件做一些调整,来确保它一直开启着。这是个配置环境的好理由。 @@ -85,7 +86,7 @@ home `Ido` 模式是 Emacs 自带的,所以你不需要在你的 `lisp` 目录中放 `.el` 文件,但你仍然需要添加上面代码,因为下面的介绍会使用到它. -### 符号链接是你的好伙伴 +#### 符号链接是你的好伙伴 等等,这里写的 `.emacs` 和 `.emacs.d` 都是存放在你的主目录下,但我们把他们放到了 Dropbox 的某些愚蠢的文件夹!对,这就让你的环境在任何地方都很容易使用。把所有东西都保存在 Dropbox 上,并链接到 `.emacs` 和 `.emacs.d`,以及主目录 `~`。在 OS X 上,使用 `ln -s` 命令非常简单,但在 Windows 上却很麻烦。幸运的是,Emacs 提供了一种简单的方法来替代 Windows 上的符号链接,Windows 的 `HOME` 环境变量。转到 Windows 的环境变量(Windows 10,你可以按 Windows 键然后输入 “环境变量” 来搜索,这是 Windows 10 最好的一部分了),在你的帐户下创建一个指向你在 Dropbox 中 Emacs 的文件家的 `HOME` 环境变量。如果你想方便地浏览 Dropbox 之外的本地文件,你可能想在你的实际主目录下建立一个到 Dropbox 下 Emacs 主目录的符号链接。 @@ -113,7 +114,7 @@ home 其中 `[RET]` 是我使用 `Ido` 模式的自动补全而按下的回车键。所以,这只需要按 12 个键,如果你习惯了的话, 这将比打开查找或文件资源管理器再用鼠标点要节省 _很_ 多时间。 `Ido` 模式很有用, 这真的是操作 Emacs 的一种实用的模式。下面让我们去探索一些其他对完成工作很有帮助的模式吧。 -### 字体及风格 +#### 字体及风格 我推荐在 Emacs 中使用很棒的字体系列。它们可以使用不同的括号、0和其他字符进行自定义。你可以在字体文件本身中构建额外的行间距。我推荐 1\.5 倍的行间距,并在代码和数据中使用它们适应比例的字体。写作中我用 `Serif` 字体,它有一种紧凑但时髦的感觉。你可以在 [http://input.fontbureau.com/][40] 上找到它们,在那里你可以根据自己的喜好进行定制。你可以使用 Emacs 中的菜单手动设置字体,但这会将代码保存到你的 `.emacs` 文件中,如果您使用多个设备,您可能需要一些不同的设置。我我将我的 `.emacs` 设置位根据使用的机器的名称,并配置适当的屏幕机字体。代码如下: @@ -142,7 +143,7 @@ home (if (fboundp 'menu-bar-mode) (menu-bar-mode 1)) ``` -### Org 模式 +#### Org 模式 我基本上 `Org` 模式下处理工作的。它是我创作文档、记笔记、列任务清单以及 90% 其他工作的首选环境。`Org` 最初是由一个在会议中使用笔记本电脑的家伙构想出来的,它是笔记和待办事项列表的组合工具。我反对在会议中使用笔记本电脑,自己也不使用,所以我的用法与他的有些不同。对我来说,`Org` 主要是一种处理结构中内容的方式。在 `Org` 模式中有标题和副标题等,它们的作用就像一个大纲。`Org` 允许你展开或隐藏文本内容,还可以重新排列文本。这非常很符合我的想法,而且我发现用这种方式使用它是一种乐趣。 @@ -159,7 +160,7 @@ home 我有一个总是在缓冲区中打开的 `stuff.org` 文件。我把它当作记事本。`Org` 使得提取待办事项和有期限的事情变得很容易。当你在内联 `Lisp` 代码并在需要计算它时,它特别有用。拥有包含内容的代码非常方便。同样,你可以使用 Emacs 访问实际的计算机,这是一种解放。 -#### 用 `Org` 模式进行发布 +##### 用 `Org` 模式进行发布 我关心的是文档的外观和格式。我我刚开始工作时是个设计师,而且我认为信息可以,也应该表现得清晰和美丽。`Org` 对将 `LaTeX` 生成 PDF 支持的很好, `LaTeX` 有自己的学习曲线,但是做简单的事情非常简单。 @@ -187,9 +188,9 @@ home 这个文件是一个使用该配置输出为 PDF 的实例。这就是开箱即用的 `LaTeX` 一样。在我看来这还不错,但是字体很无聊,而且有点奇怪。此外,如果你使用标准格式,人们会认为他们正在阅读的东西是或假装是一篇学术论文。别怪我没提醒你。 -### `Ace Jump` 模式 +#### `Ace Jump` 模式 -如果你想使用的话,这是个辅助而不是主要功能。它的工作原理有点像 Jef Raskin 的 `Leap` 功能[9][15]。 按下 `C-c` `C-SPC`,然后输入要跳转到单词的第一个字母。它会高亮显示所有以该字母开头的单词,并将其替换为字母表中的字母。您只需键入所需位置的字母,光标就会跳转到该位置。我自己经常用这个作为导航键或搜索。将 `.el` 文件下到你的 `Lisp` 目录下,并在 `.emacs` 文件添加如下代码: +如果你想使用的话,这是个辅助而不是主要功能。它的工作原理有点像 Jef Raskin 的 `Leap` 功能[^9] 。 按下 `C-c` `C-SPC`,然后输入要跳转到单词的第一个字母。它会高亮显示所有以该字母开头的单词,并将其替换为字母表中的字母。您只需键入所需位置的字母,光标就会跳转到该位置。我自己经常用这个作为导航键或搜索。将 `.el` 文件下到你的 `Lisp` 目录下,并在 `.emacs` 文件添加如下代码: ``` ;; set up ace-jump-mode @@ -202,27 +203,16 @@ home 这篇文章已经够详细了,你能在其中的到你所想要的。我很想了解除编程(或编程)之外你对 Emacs 的使用,以及这是否有用。在我使用 Emacs 的过程中,可能存在一些自作聪明的想法,如果你能指出它们,我将感激不尽。之后,我可能会写一些更新来引入其他特性或模式。我很确定我将会向你展示如何在 Emacs 和 `Ludwig` 模式下使用 `Fugue`,因为我会将它发展成比代码突出显示更有用的东西。把你的想法发到 [@fugueHQ][41] 上。 -* * * -#### 附注 - -1. [^][16] If you are now a PHB of some sort, but were never technical, Emacs likely isn’t for you. There may be a handful of folks for whom Emacs will form a path into the more technical aspects of computing, but this is probably a small population. It’s helpful to know how to use a Unix or Windows terminal, to have edited a dotfile or two, and to have written some code at some point in your life for Emacs to make much sense. - -2. [^][17] [][18][http://archive.wired.com/wired/archive/2.08/tufte.html][19] - -3. [^][20] I mainly use this to perform calculations while writing. For example, I was writing an offer letter to a new employee and wanted to calculate how many options to include in the offer. Since I have a variable defined in my `.emacs` for outstanding-shares, I can simply type `M-: (* .001 outstanding-shares)`and get a tenth of a point without opening a calculator or spreadsheet. I keep  _lots_ of numbers in variables like this so I can avoid context switching. - -4. [^][21] The missing piece of this is the web. There is an Emacs web browser called eww that will allow you to browse in Emacs. I actually use this, as it is both a great ad-blocker and removes most of the poor choices in readability from the web designer's hands. It's a bit like Reading Mode in Safari. Unfortunately, most websites have lots of annoying cruft and navigation that translates poorly into text. - -5. [^][22] Usability is often confused with learnability. Learnability is how difficult it is to learn a tool. Usability is how useful the tool is. Often, these are at odds, such as with the mouse and menus. Menus are highly learnable, but have poor usability, so there have been keyboard shortcuts from the earliest days. Raskin was right on many points where he was ignored about GUIs in general. Now, OSes are putting things like decent search onto a keyboard shortcut. On OS X and Windows, my default method of navigation is search. Ubuntu's search is badly broken, as is the rest of its GUI. - -6. [^][23] AWS S3 has effectively solved file storage for as long as we have the Internet. Trillions of objects are stored in S3 and they've never lost one of them. Most every service out there that offers cloud storage is built on S3 or imitates it. No one has the scale of S3, so I keep important stuff there, via Dropbox. - -7. [^][24] By now, you might be thinking "what is it with this guy and bicycles?" ... I love them on every level. They are the most mechanically efficient form of transportation ever invented. They can be objects of real beauty. And, with some care, they can last a lifetime. I had Rivendell Bicycle Works build a frame for me back in 2001 and it still makes me happy every time I look at it. Bicycles and UNIX are the two best inventions I've interacted with. Well, they and Emacs. - -8. [^][25] This is not a tutorial for Emacs. It comes with one and it's excellent. I do walk through some of the things that I find most important to getting a useful Emacs setup, but this is not a replacement in any way. - -9. [^][26] Jef Raskin designed the Canon Cat computer in the 1980s after falling out with Steve Jobs on the Macintosh project, which he originally led. The Cat had a document-centric interface (as all computers should) and used the keyboard in innovative ways that you can now imitate with Emacs. If I could have a modern, powerful Cat with a giant high-res screen and Unix underneath, I'd trade my Mac for it right away. [][27][https://youtu.be/o_TlE_U_X3c?t=19s][28] +[^1]: If you are now a PHB of some sort, but were never technical, Emacs likely isn’t for you. There may be a handful of folks for whom Emacs will form a path into the more technical aspects of computing, but this is probably a small population. It’s helpful to know how to use a Unix or Windows terminal, to have edited a dotfile or two, and to have written some code at some point in your life for Emacs to make much sense. +[^2]: http://archive.wired.com/wired/archive/2.08/tufte.html +[^3]: I mainly use this to perform calculations while writing. For example, I was writing an offer letter to a new employee and wanted to calculate how many options to include in the offer. Since I have a variable defined in my `.emacs` for outstanding-shares, I can simply type `M-: (* .001 outstanding-shares)`and get a tenth of a point without opening a calculator or spreadsheet. I keep  _lots_ of numbers in variables like this so I can avoid context switching. +[^4]: The missing piece of this is the web. There is an Emacs web browser called eww that will allow you to browse in Emacs. I actually use this, as it is both a great ad-blocker and removes most of the poor choices in readability from the web designer's hands. It's a bit like Reading Mode in Safari. Unfortunately, most websites have lots of annoying cruft and navigation that translates poorly into text. +[^5]: Usability is often confused with learnability. Learnability is how difficult it is to learn a tool. Usability is how useful the tool is. Often, these are at odds, such as with the mouse and menus. Menus are highly learnable, but have poor usability, so there have been keyboard shortcuts from the earliest days. Raskin was right on many points where he was ignored about GUIs in general. Now, OSes are putting things like decent search onto a keyboard shortcut. On OS X and Windows, my default method of navigation is search. Ubuntu's search is badly broken, as is the rest of its GUI. +[^6]: AWS S3 has effectively solved file storage for as long as we have the Internet. Trillions of objects are stored in S3 and they've never lost one of them. Most every service out there that offers cloud storage is built on S3 or imitates it. No one has the scale of S3, so I keep important stuff there, via Dropbox. +[^7]: By now, you might be thinking "what is it with this guy and bicycles?" ... I love them on every level. They are the most mechanically efficient form of transportation ever invented. They can be objects of real beauty. And, with some care, they can last a lifetime. I had Rivendell Bicycle Works build a frame for me back in 2001 and it still makes me happy every time I look at it. Bicycles and UNIX are the two best inventions I've interacted with. Well, they and Emacs. +[^8]: This is not a tutorial for Emacs. It comes with one and it's excellent. I do walk through some of the things that I find most important to getting a useful Emacs setup, but this is not a replacement in any way. +[^9]: Jef Raskin designed the Canon Cat computer in the 1980s after falling out with Steve Jobs on the Macintosh project, which he originally led. The Cat had a document-centric interface (as all computers should) and used the keyboard in innovative ways that you can now imitate with Emacs. If I could have a modern, powerful Cat with a giant high-res screen and Unix underneath, I'd trade my Mac for it right away. [][27][https://youtu.be/o_TlE_U_X3c?t=19s][28] -------------------------------------------------------------------------------- From 5b9c7454137a8a6639bad8a9dad3f08eac8f530d Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Wed, 19 Dec 2018 13:40:24 +0800 Subject: [PATCH 004/322] Translating How to Update Ubuntu. --- ...untu -Terminal - GUI Methods- It-s FOSS.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md b/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md index b0f0751d81..00864bffa9 100644 --- a/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md +++ b/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md @@ -49,31 +49,31 @@ sudo apt upgrade #### 说明:sudo apt update -This command updates the local database of available packages. If you won’t run this command, the local database won’t be updated and your system will not know if there are any new versions available. +这条命令更新了可用软件包的本地数据库。如果你没运行这条命令,本地数据库将不会更新而你的系统将不会知道是否又可用的新版本。 -This is why when you run the sudo apt update, you’ll see lots of URLs in the output. The command fetches the package information from the respective repositories (the URLs you see in the output). +这就是为什么当你运行 `sudo apt update`,你会在输出中看到大量的 URLs。这条命令从对应的储存库(你在输出中看到的 URLs)中获取软件包信息。 -![Updating Ubuntu Linux][5] +![更新 Ubuntu Linux][5] -At the end of the command, it tells you how many packages can be upgraded. You can see these packages by running the following command: +在命令的末尾,它告诉你有多少个软件包可以被更新。你可以使用下列命令查看这些软件包: ``` apt list --upgradable ``` -**Additional Reading:** Read this article to learn [what is Ign, Hit and Get in the apt update command output][6]. +**补充阅读:** 阅读这篇文章了解[命令 `apt update` 的输出中的 Ign,Hit 和 Get 是什么][6]。 #### 说明:sudo apt upgrade -This command matches the versions of installed packages with the local database. It collects all of them and then it will list all of the packages that have a newer version available. At this point, it will ask if you want to upgrade (the installed packages to the newer version). +这条命令将已安装的软件包版本与本地数据库进行匹配。它收集全部信息,然后列出所有具有更新版本的软件包。此时,它会询问您是否要升级(已安装的软件包更新到新版本)。 -![Update Ubuntu Linux via Command Line][7] +![通过命令行更新 Ubuntu Linux][7] -You can type ‘yes’, ‘y’ or just press enter to confirm the installation of updates. +你可以键入 `yes`,`y` 或者只敲回车键去确认安装这些更新。 -So the bottom line is that the sudo apt update checks for the availability of new versions while as the sudo apt upgrade actually performs the update. +所以总的来说,`sudo apt update` 会检查可用的新版本,而 `sudo apt upgrade` 实际上会执行更新。 -The term update might be confusing as you might expect the apt update command to update the system by installing the updates but that doesn’t happen. +命令 `update` 可能会令人困惑,因为你可能期望通过命令 `apt update` 安装更新来更新系统,但这并不会发生。 ### 通过 GUI 更新 Ubuntu[适用于桌面用户] From 7b7ec40b94c86f3bef61a01487c87cee78f90a70 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 19 Dec 2018 15:12:29 +0800 Subject: [PATCH 005/322] PRF:20171111 A CEOs Guide to Emacs.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 部分 --- .../tech/20171111 A CEOs Guide to Emacs.md | 69 ++++++++++--------- 1 file changed, 38 insertions(+), 31 deletions(-) diff --git a/translated/tech/20171111 A CEOs Guide to Emacs.md b/translated/tech/20171111 A CEOs Guide to Emacs.md index 6d14ad7a8e..9ddbab89d2 100644 --- a/translated/tech/20171111 A CEOs Guide to Emacs.md +++ b/translated/tech/20171111 A CEOs Guide to Emacs.md @@ -13,7 +13,7 @@ 这可能给人一种 Emacs 已经过气或过时的印象。但它不是,它是强大和永恒的,只要你耐心地去理解它的一些规则。它的规则很另类,也很奇怪,但其中的逻辑却引人注目,且很有魅力。对于我来说, Emacs 更像是未来而不是过去。就像牵引式钢框架在未来几十年里将会变得好用和舒适,而神奇的碳纤维自行车将会被扔进垃圾场,在撞击中粉碎一样,Emacs 也将会作为一种在最新的流行应用早已被遗忘的时候的好用的工具继续存在这里。 -如果通过编辑 Lisp 代码来构建自己的个人工作环境,并将这种非常适合自己的环境移植到任何计算机的想法吸引了你,那么你可能会爱上 Emacs。如果你喜欢很潮、很炫的,又不想投入太多时间和精力的情况下就能直接工作的话,那么它可能不适合你。我已经不再写代码了(除了 Ludwig 和 Emacs Lisp),但是 Fugue 的很多工程师都使用 Emacs 来提高码代码的效率。我公司有 30% 的工程师用 Emacs,40% 用 IDE 和 30% 的用 vim。但这篇文章是关于 CEO 和其他[聪明的老板][32]Pointy-Haired Bosses(PHB[^1] )(以及,其它好奇的人)的 Emacs 指南,所以我将解释或者说辩解我为什么喜欢它以及我如何使用它。同时我也希望我能介绍清楚从而让你能有个良好的体验,而不是花上几个小时去 Google。 +如果通过编辑 Lisp 代码来构建自己的个人工作环境,并将这种非常适合自己的环境移植到任何计算机的想法吸引了你,那么你可能会爱上 Emacs。如果你喜欢很潮、很炫的,又不想投入太多时间和精力的情况下就能直接工作的话,那么它可能不适合你。我已经不再写代码了(除了 Ludwig 和 Emacs Lisp),但是 Fugue 公司的很多工程师都使用 Emacs 来提高码代码的效率。我公司有 30% 的工程师用 Emacs,40% 用 IDE 和 30% 的用 vim。但这篇文章是关于 CEO 和其他[聪明的老板][32]Pointy-Haired Bosses(PHB[^1] )(以及,其它好奇的人)的 Emacs 指南,所以我将解释或者说辩解我为什么喜欢它以及我如何使用它。同时我也希望我能介绍清楚从而让你能有个良好的体验,而不是花上几个小时去 Google。 ### 恒久优势 @@ -27,48 +27,49 @@ Org 模式本身就值得花时间,但如果你像我一样,你通常要处 #### 在安静中创造事情 -拥有我所发现的最好的文本编辑功能的最终结果是什么?有一群人在做各种各样有用的补充吗?拥有 `Lisp` 键盘的全部功能?这就是我用 Emacs 来完成所有的创作性工作,处理音乐和图片除外。 +拥有我所发现的最好的文本编辑功能的最终结果是什么?有一群人在做各种各样有用的补充吗?发挥了 Lisp 键盘的全部威力了吗?我用 Emacs 来完成所有的创作性工作,处理音乐和图片除外。 -我的办公桌上有两个显示器。其中一块竖屏是将 Emacs 全天全屏显示,另一个显示浏览器,用来搜索和阅读,通常也会打开一个终端。我将日历、邮件等保存在 OS X 的另一个桌面上,当我使用 Emacs 时,这个桌面是隐藏的,同时我也会关掉所有通知。这样就能让我专注于我手头上在做的事了。我发现,在更现代的 UI 应用程序中,消除干扰几乎是不可能的,因为这些应用程序努力提供帮助并使其易于使用。我不需要经常被提醒该如何操作,我已经做了成千上万次了,我真正需要的是一张干净整洁的白纸用来思考。也许因为年龄和自己的“恶习”,我不太喜欢处在嘈杂的环境中,但我认为这值得一试。看看在你电脑环境中有一些真正的宁静是怎样的。当然,现在很多应用程序都有隐藏界面的模式,谢天谢地,苹果和微软现在都有了真正意义上的全屏模式。但是,没有并没有应用程序可以强大到足以“处理”大多数事务。除非你整天写代码,或者像写一本书一样处理很长的文档,否则你仍然会面临其他应用程序的干扰。而且,大多数现代应用程序似乎同时显得自视甚高,缺乏功能和可用性[^5] 。比其 office 应用程序,我更讨厌在线版的应用程序。 +我的办公桌上有两个显示器。其中一块竖屏是将 Emacs 全天全屏显示,另一个显示浏览器,用来搜索和阅读,通常也会打开一个终端。我将日历、邮件等放在 OS X 的另一个桌面上,当我使用 Emacs 时,这个桌面是隐藏的,同时我也会关掉所有通知。这样就能让我专注于我手头上在做的事了。我发现,在更现代的 UI 应用程序中,消除干扰几乎是不可能的,因为这些应用程序致力于提供帮助和易用性。我不需要经常被提醒该如何操作,我已经做了成千上万次了,我真正需要的是一张干净整洁的白纸用来思考。也许因为年龄和自己的“恶习”,我不太喜欢处在嘈杂的环境中,但我认为这值得一试。看看在你电脑环境中有一些真正的宁静是怎样的。当然,现在很多应用程序都有隐藏界面的模式,谢天谢地,苹果和微软现在都有了真正意义上的全屏模式。但是,没有并没有应用程序可以强大到足以“处理”大多数事务。除非你整天写代码,或者像写一本书一样处理很长的文档,否则你仍然会面临其他应用程序的干扰。而且,大多数现代应用程序似乎同时显得自视甚高,缺乏功能和可用性[^5] 。比起 office 应用程序,我更讨厌其在线版。 -![1933 steel bicycle](https://blog.fugue.co/assets/images/desktop.jpg) -我的桌面布局, Emacs 在左边 +![](https://www.fugue.co/hubfs/Imported_Blog_Media/desktop-1.jpg) -但是交流呢?创造和交流之间的差别很大。当我为两者留出不同的时间时,我的效率会更高。在 `Fugue` 中使用了 `Slack`,痛并快乐着。我把它和我的日历、电子邮件放在一个即时通讯的桌面上,这样,当我正在做事时,我很高兴地能够忽略所有的聊天。仅仅是风投或董事会董事的一次懈怠,或一封电子邮件,就能让我立刻丢掉手头工作。但是,大多数事情通常可以等上一两个小时。 +*我的桌面布局, Emacs 在左边* -#### 带上一切,并保留着 +但是交流呢?创造和交流之间的差别很大。当我为两者留出不同的时间段时,我的效率会更高。我们 Fugue 公司使用 Slack,痛并快乐着。我把它和我的日历、电子邮件放在一个即时通讯的桌面上,这样,当我正在做事时,我很高兴地能够忽略所有的聊天。只要一个 Slackstorm 或一封风投或董事会董事的电子邮件,就能让我立刻丢掉手头工作。但是,大多数事情通常可以等上一两个小时。 -第三个原因是,我发现 Emacs 比其它的环境更有优势的是你可以很容易的用它来处理事务。我的意思是,你所需要的只是通过 `Dropbox` 类似的网站同步一两个目录,而不是让大量的应用程序以它们自己的方式进行交互和同步。然后,你可以在任何地方,任何环境下工作了,因为你已经精心制作了适合目的套件了。我在 OS X,Windows,或有时在 Linux 都是这样做的。它非常简单可靠。这种功能很有用,以至于我害怕处理页面、Google Docs、Office 或其他类型的文件和应用程序,这些文件和应用程序会迫使我回到文件系统或云中的某个地方去寻找。 +#### 包罗万象,永久长青 -永久存储在计算机上的限制是文件格式。假设人类已经解决了存储[^6] 的问题,随着时间的推移,我们面临的问题是我们能否够继续访问我们创建的信息。文本文件是最持久的计算格式。你可以用 Emacs 轻松地打开 1970 年的文本文件。然而对于办公应用程序却并非如此。同时文本文件要比 Office 应用程序数据文件小得多,也要好的多。作为一个数码背包迷,作为一个在脑子里一闪而过就会做很多小笔记的人,拥有一个简单、轻便、永久、随时可用的东西对我来说很重要。 +第三个原因是,我发现 Emacs 比其它的环境更有优势的是你可以很容易的用它来处理事务。我的意思是,你所需要的只是通过 Dropbox 类似的网站同步一两个目录,而不是让大量的应用程序以它们自己的方式进行交互和同步。然后,你可以在任何你已经精心打造了适合你的目的的套件的环境中工作了。我在 OS X、Windows,或有时在 Linux 都是这样做的。它非常简单可靠。这种功能很有用,以至于我害怕处理 Pages、Google Docs、Office 或其他类型的文件和应用程序,这些文件和应用程序会迫使我回到文件系统或云中的某个地方去寻找。 + +限制在计算机上永久存储的因素是文件格式。假设人类已经解决了存储问题[^6] ,随着时间的推移,我们面临的问题是我们能否够继续访问我们创建的信息。文本文件是最长青的计算格式。你可以用 Emacs 轻松地打开 1970 年的文本文件。然而对于 Office 应用程序却并非如此。同时文本文件要比 Office 应用程序数据文件小得多,也要好的多。作为一个数码背包迷,作为一个在脑子里一闪而过就会做很多小笔记的人,拥有一个简单、轻便、永久、随时可用的东西对我来说很重要。 如果你准备尝试 Emacs,请继续阅读!下面的部分不会取代完整的教程,但是在完成阅读时,就可以操作了。 ### 学会驾驭 Emacs —— 一个专业的配置 -所有这些强大、精神上的平静和安宁的代价是,Emacs 有一个陡峭的学习曲线,它的一切都与你以前所习惯的不同。一开始,这会让你觉得你是在浪费时间在一个过时和奇怪的应用程序上,就好像现代世界已经过去了。这有点像你只开过车,却要你去学骑自行车[^7] 。 +所有这些强大、精神上的平静和安宁的代价是,Emacs 有一个陡峭的学习曲线,它的一切都与你以前所习惯的不同。一开始,这会让你觉得你是在浪费时间在一个过时和奇怪的应用程序上,就好像穿越到过去。这有点像你只开过车,却要你去学骑自行车[^7] 。 #### 该选哪个 Emacs -我用的是 GNU 中 OS X 和 Windows 的通用版本的 Emacs。你可以在 [][34][http://emacsformacos.com/][35] 获取 OS X 版本,在[][36][http://www.gnu.org/software/emacs/][37]获取 Windows 版本。市面上还有很多其他版本,尤其是 Mac 版本,但我发现,要做一些功能强大的东西(包括 `Lisp` 和许多模式),学习曲线要比实际操作低得多。下载,然后我们就可以开始了[^8] ! +我用的是来自 GNU 的 OS X 和 Windows 的通用版本的 Emacs。你可以在 [http://emacsformacos.com/][35] 获取 OS X 版本,在 [http://www.gnu.org/software/emacs/][37] 获取 Windows 版本。市面上还有很多其他版本,尤其是 Mac 版本,但我发现,要做一些功能强大的东西(涉及到 Lisp 和许多模式),学习曲线要比实际操作低得多。下载,然后我们就可以开始了[^8] ! -#### 首先,学会浏览 +#### 首先,学会导航 -在本文中,我将约定 Emacs 中的键和组合。`C` 表示 `Control` 键,`M` 表示 `meta`(通常是 `Alt` 或 `Option` 键),以及用于组合键的连字符。因此,`C-h t` 表示同时按下 `Control` 和 `h` 键,然后释放,再按下 `t`。这个组快捷键会指向一个教程,这是你首先要做的一件事。 +在本文中,我将使用 Emacs 的按键和组合键约定。`C` 表示 `Control` 键,`M` 表示 `meta`(通常是 `Alt` 或 `Option` 键),以及用于组合键的连字符。因此,`C-h t` 表示同时按下 `Control` 和 `h` 键,然后释放,再按下 `t`。这个组合快捷键会指向一个教程,这是你首先要做的一件事。 -不要使用方向键或鼠标。它们可以工作,但是你应该给自己一周的时间来使用 Emacs 教程中的原生命令。一旦你这些命令变为了肌肉记忆,你可能就会乐在其中,无论到哪里,你都会非常想念它们。Emacs 教程在介绍它们方面做得很好,但是我将进行总结,所以您不需要阅读全部内容。最无聊的是,不用方向键,用 `C-b` 向前移动,用 `C-f` 向后移动,上一行用 `C-p`,下一行用 `C-n`。你可能会想:“我用方向键就很好,为什么还要这样做?” 有几个原因。首先,你不需要从主键盘区将你的手移开。第二,使用 `Alt`(或用 Emacs 的说法 `Meta`)键来向前或向后移动一个单词。显而易见这样更方便。第三,如果想重复某个命令,可以在命令前面加上一个数字。在编辑文档时,我经常使用这种方法,通过估计向前多少个单词或向上或线下移动多少行,然后按下 `C-9 C-p` 或 `M-5 M-b` 之类的快捷键。其他真正重要的浏览命令基于开头用 `a` 和结尾用 `e`。在行中使用 `C-a|e`,在句中使用 `M-a|e`。为了让句中的命令正常工作,需要在句号后增加两个空格,这同时提供了一个有用的特性,并消除了脑中的[希伯列][38]。如果需要将文档导出到单个空间[发布环境][39],可以编写一个宏来执行此操作。 +不要使用方向键或鼠标。它们可以工作,但是你应该给自己一周的时间来使用 Emacs 教程中的原生的导航命令。一旦你这些命令变为了肌肉记忆,你可能就会乐在其中,无论到哪里,你都会非常想念它们。这个 Emacs 教程在介绍它们方面做得很好,但是我将进行总结,所以您不需要阅读全部内容。最无聊的是,不用方向键,用 `C-b` 向前移动,用 `C-f` 向后移动,上一行用 `C-p`,下一行用 `C-n`。你可能会想:“我用方向键就很好,为什么还要这样做?” 有几个原因。首先,你不需要从主键盘区将你的手移开。第二,使用 `Alt`(或用 Emacs 的说法 `Meta`)键来向前或向后在单词间移动。显而易见这样更方便。第三,如果想重复某个命令,可以在命令前面加上一个数字。在编辑文档时,我经常使用这种方法,通过估计向后移动多少个单词或向上或向下移动多少行,然后按下 `C-9 C-p` 或 `M-5 M-b` 之类的快捷键。其它真正重要的导航命令基于开头用 `a` 和结尾用 `e`。在行中使用 `C-a|e`,在句中使用 `M-a|e`。为了让句中的命令正常工作,需要在句号后增加两个空格,这同时提供了一个有用的特性,并消除了脑中一个过时的[观点][38]。如果需要将文档导出到单个空间[发布环境][39],可以编写一个宏来执行此操作。 -Emacs 附带的教程很值得去看。对于真正缺乏耐心的人,我将介绍一些重要的命令,但那个教程非常有用。记住:用 `C-h t` 进入教程。 +Emacs 所附带的教程很值得去看。对于真正缺乏耐心的人,我将介绍一些重要的命令,但那个教程非常有用。记住:用 `C-h t` 进入教程。 #### 学会复制和粘贴 -你可以叫 Emacs 设为 `CUA` 模式,这将会以熟悉的方式工作来操作复制粘贴,但是原生的 Emacs 方法更好,而且你一旦学会了它,就很容易。你可以使用 `Shift` 这样的浏览命令来标记区域(如选择)。所以 `C-F` 是选中管标前的一个字符,等等。亦可以用 `M-w` 来复制,用 `C-w` 剪切,然后用 `C-y` 粘贴。这些实际上叫做删除和召回,但它非常类似于剪切和粘贴。在删除的环中有些小技巧,但是现在,你只需要关注剪切、复制和粘贴。如果你在这开始摸索, `C-x u` 是撤销。 +你可以把 Emacs 设为 CUA 模式,这将会以熟悉的方式工作来操作复制粘贴,但是原生的 Emacs 方法更好,而且你一旦学会了它,就很容易。你可以使用 `Shift` 和导航命令来标记区域(如同选择)。所以 `C-F` 是选中光标前的一个字符,等等。亦可以用 `M-w` 来复制,用 `C-w` 剪切,然后用 `C-y` 粘贴。这些实际上叫做删除killing召回yanking,但它非常类似于剪切和粘贴。在删除中有些小技巧,但是现在,你只需要关注剪切、复制和粘贴。如果你开始尝试了,那么 `C-x u` 是撤销。 -#### 下一步,学会用 `Ido` 模式 +#### 下一步,学会用 Ido 模式 -相信我,`Ido` 会让文件的工作变得很简单。通常,你在 Emacs 中处理文件不需要使用一个单独分开的查找或文件资源管理器的窗口。相反的,你可以用编辑器的命令来创建、打开和保存文件。如果没有 `Ido` 的话,这将有点麻烦,所以我建议你在学习其他之前安装好它。 `Ido` 是 Emacs 的 22 版时开发出来的,但是需要对你的 `.emacs` 文件做一些调整,来确保它一直开启着。这是个配置环境的好理由。 +相信我,Ido 会让文件的工作变得很简单。通常,你在 Emacs 中处理文件不需要使用一个单独的访达或文件资源管理器的窗口。相反的,你可以用编辑器的命令来创建、打开和保存文件。如果没有 Ido 的话,这将有点麻烦,所以我建议你在学习其他之前安装好它。 Ido 是 Emacs 的 22 版时开始出现的,但是需要对你的 `.emacs` 文件做一些调整,来确保它一直开启着。这是个配置环境的好理由。 -Emacs 中的大多数功能都表现在模式上。要安装制定的模式,需要做两件事。嗯,一开始你需要做一些额外的事情,但这些只需要做一次,然后再做这两件事。那么,额外的事情是你需要一个单独的位置来放置所有 `Emacs Lisp` 文件,并且你需要告诉 Emacs 这个位置在哪。我建议你在 Dropbox 上创建一个单独的目录,那是你 Emacs 主目录。在这里,你需要创建一个 `.emacs` 文件和 `.emacs.d` 目录。在 `.emacs.d` 目录下,创建一个 `lisp` 的目录。就像这样: +Emacs 中的大多数功能都表现在模式上。要安装指定的模式,需要做两件事。嗯,一开始你需要做一些额外的事情,但这些只需要做一次,然后再做这两件事。那么,这件额外的事情是你需要一个单独的位置来放置所有 Emacs Lisp 文件,并且你需要告诉 Emacs 这个位置在哪。我建议你在 Dropbox 上创建一个单独的目录,那是你 Emacs 主目录。在这里,你需要创建一个 `.emacs` 文件和 `.emacs.d` 目录。在 `.emacs.d` 目录下,创建一个 `lisp` 的目录。就像这样: ``` home @@ -80,21 +81,23 @@ home -lisp ``` -你可以将那些像模式的 `.el` 文件放到 `home/.emacs.d/lis` 目录下,然后在你的 `.emacs` 文件中添加以下代码来指明该路径: +你可以将那些比如模式的 `.el` 文件放到 `home/.emacs.d/lisp` 目录下,然后在你的 `.emacs` 文件中添加以下代码来指明该路径: -`(add-to-list 'load-path "~/.emacs.d/lisp/")` +``` +(add-to-list 'load-path "~/.emacs.d/lisp/") +``` -`Ido` 模式是 Emacs 自带的,所以你不需要在你的 `lisp` 目录中放 `.el` 文件,但你仍然需要添加上面代码,因为下面的介绍会使用到它. +Ido 模式是 Emacs 自带的,所以你不需要在你的 `lisp` 目录中放这个 `.el` 文件,但你仍然需要添加上面代码,因为下面的介绍会使用到它. #### 符号链接是你的好伙伴 -等等,这里写的 `.emacs` 和 `.emacs.d` 都是存放在你的主目录下,但我们把他们放到了 Dropbox 的某些愚蠢的文件夹!对,这就让你的环境在任何地方都很容易使用。把所有东西都保存在 Dropbox 上,并链接到 `.emacs` 和 `.emacs.d`,以及主目录 `~`。在 OS X 上,使用 `ln -s` 命令非常简单,但在 Windows 上却很麻烦。幸运的是,Emacs 提供了一种简单的方法来替代 Windows 上的符号链接,Windows 的 `HOME` 环境变量。转到 Windows 的环境变量(Windows 10,你可以按 Windows 键然后输入 “环境变量” 来搜索,这是 Windows 10 最好的一部分了),在你的帐户下创建一个指向你在 Dropbox 中 Emacs 的文件家的 `HOME` 环境变量。如果你想方便地浏览 Dropbox 之外的本地文件,你可能想在你的实际主目录下建立一个到 Dropbox 下 Emacs 主目录的符号链接。 +等等,这里写的 `.emacs` 和 `.emacs.d` 都是存放在你的主目录下,但我们把它们放到了 Dropbox 的某些愚蠢的文件夹!对,这就让你的环境在任何地方都很容易使用。把所有东西都保存在 Dropbox 上,并做符号链接到 `~` 下的 `.emacs` 、`.emacs.d` 和你的主要存放文档的目录。在 OS X 上,使用 `ln -s` 命令非常简单,但在 Windows 上却很麻烦。幸运的是,Emacs 提供了一种简单的方法来替代 Windows 上的符号链接,Windows 的 `HOME` 环境变量。转到 Windows 的环境变量(Windows 10,你可以按 Windows 键然后输入 “环境变量” 来搜索,这是 Windows 10 最好的地方了),在你的帐户下创建一个指向你在 Dropbox 中 Emacs 的文件夹的 `HOME` 环境变量。如果你想方便地浏览 Dropbox 之外的本地文件,你可能想在你的实际主目录下建立一个到 Dropbox 下 Emacs 主目录的符号链接。 -至此,你已经完成了在任意机器上指向 Emacs 配置和配置文件所需的技巧。如果你买了一台新电脑,或者用别人的电脑一小时或一天,你就得到了你的整个工作环境。第一次做这个似乎有点困难,但是一旦你知道你在做什么,就只需要10分钟(最多)。 +至此,你已经完成了在任意机器上指向你的 Emacs 配置和文件所需的技巧。如果你买了一台新电脑,或者用别人的电脑一小时或一天,你就可以得到你的整个工作环境。第一次做这个似乎有点困难,但是一旦你知道你在做什么,就(最多)只需要 10 分钟。 -但我们现在是在配置 `Ido`…… +但我们现在是在配置 Ido …… -按下 `C-x` `C-f` 然后输入 `~/.emacs RET RET` 来创建 `.emacs` 文件,将下面几行添加进去: +按下 `C-x` `C-f` 然后输入 `~/.emacs` 和两次回车来创建 `.emacs` 文件,将下面几行添加进去: ``` ;; set up ido mode @@ -104,15 +107,19 @@ home (ido-mode 1) ``` -在 `.emacs` 窗口开着的时候,执行 `M-x evaluate-buffer` 命令。如果某处弄错了的话,将得到一个错误,或者你将得到 `Ido`。`Ido` 改变了在 `minibuffer` 中操作文件操方式。有一篇比较好的文档,但是我也会指出一些技巧。有效地使用 `~/`;你可以在 `minibuffer` 的任何地方输入 `~/`,它就会跳转到主目录。这就意味着,你应该让你的大部分东西就近的放在主目录下。我用 `~/org` 目录来保存所有非代码的东西,用 `~/code` 保存代码。一旦你进入到正确的目录,通常会拥有一组具有不同扩展名的文件,特别是当你使用 `Org` 模式并从中发布的话。你可以输入 `period` 和想要的扩展名,无论你的在文件名的什么位置,`Ido` 都会将选择限制在具有该扩展名的文件中。例如,我在 `Org` 模式下写这篇博客,所以该文件是: +在 `.emacs` 窗口开着的时候,执行 `M-x evaluate-buffer` 命令。如果某处弄错了的话,将得到一个错误,或者你将得到 Ido。Ido 改变了在 minibuffer 中操作文件操方式。关于这个有一篇比较好的文档,但是我也会指出一些技巧。有效地使用 `~/`;你可以在 minibuffer 的任何地方输入 `~/`,它就会跳转到主目录。这就意味着,你应该让你的大部分东西就近的放在主目录下。我用 `~/org` 目录来保存所有非代码的东西,用 `~/code` 保存代码。一旦你进入到正确的目录,通常会拥有一组具有不同扩展名的文件,特别是当你使用 Org 模式并从中发布的话。你可以输入 `.` 和想要的扩展名,无论你的在文件名的什么位置,Ido 都会将选择限制在具有该扩展名的文件中。例如,我在 Org 模式下写这篇博客,所以该文件是: -`~/org/blog/emacs.org` +``` +~/org/blog/emacs.org +``` -我偶尔也会用 `Org` 模式发布成 HTML 格式,所以我将在同一目录下得到 `emacs.html` 文件。当我想打开 `Org` 文件时,我会输入: +我偶尔也会用 Org 模式发布成 HTML 格式,所以我将在同一目录下得到 `emacs.html` 文件。当我想打开该 Org 文件时,我会输入: -`C-x C-f ~/o[RET]/bl[RET].or[RET]` +``` +C-x C-f ~/o[RET]/bl[RET].or[RET] +``` -其中 `[RET]` 是我使用 `Ido` 模式的自动补全而按下的回车键。所以,这只需要按 12 个键,如果你习惯了的话, 这将比打开查找或文件资源管理器再用鼠标点要节省 _很_ 多时间。 `Ido` 模式很有用, 这真的是操作 Emacs 的一种实用的模式。下面让我们去探索一些其他对完成工作很有帮助的模式吧。 +其中 `[RET]` 是我使用 `Ido` 模式的自动补全而按下的回车键。所以,这只需要按 12 个键,如果你习惯了的话, 这将比打开访达或文件资源管理器再用鼠标点要节省 _很_ 多时间。 Ido 模式很有用,而这只是操作 Emacs 的一种实用模式而已。下面让我们去探索一些其它对完成工作很有帮助的模式吧。 #### 字体及风格 From c12558dba34b6a2bf64a6f7a6c10fdde55dfefbc Mon Sep 17 00:00:00 2001 From: zjon Date: Fri, 21 Dec 2018 16:28:31 +0800 Subject: [PATCH 006/322] 20171012 7 Best eBook Readers for Linux has translated 20171012 7 Best eBook Readers for Linux has translated --- ...20171012 7 Best eBook Readers for Linux.md | 190 ------------------ ...20171012 7 Best eBook Readers for Linux.md | 182 +++++++++++++++++ 2 files changed, 182 insertions(+), 190 deletions(-) delete mode 100644 sources/tech/20171012 7 Best eBook Readers for Linux.md create mode 100644 translated/tech/20171012 7 Best eBook Readers for Linux.md diff --git a/sources/tech/20171012 7 Best eBook Readers for Linux.md b/sources/tech/20171012 7 Best eBook Readers for Linux.md deleted file mode 100644 index 9f69c6decb..0000000000 --- a/sources/tech/20171012 7 Best eBook Readers for Linux.md +++ /dev/null @@ -1,190 +0,0 @@ -zjon is translating -7 Best eBook Readers for Linux -====== -**Brief:** In this article, we are covering some of the best ebook readers for Linux. These apps give a better reading experience and some will even help in managing your ebooks. - -![Best eBook readers for Linux][1] - -Lately, the demand for digital books has increased as people find it more comfortable in reading a book on their handheld devices, Kindle or PC. When it comes to the Linux users, there are various ebook apps that will serve your purpose in reading and organizing your ebook collections. - -In this article, we have compiled seven best ebook readers for Linux. These ebook readers are best suited for pdf, epubs and other ebook formats. - -## Best eBook readers for Linux - -I have provided installation instructions for Ubuntu as I am using Ubuntu right now. If you use [non-Ubuntu Linux distributions][2], you can find most of these eBook applications in the software repositories of your distro. - -### 1. Calibre - -[Calibre][3] is one of the most popular eBook apps for Linux. To be honest, it's a lot more than just a simple eBook reader. It's a complete eBook solution. You can even [create professional eBooks with Calibre][4]. - -With a powerful eBook manager and easy to use interface, it features creation and editing of an eBook. Calibre supports a variety of formats and syncing with other ebook readers. It also lets you convert one eBook format to another with ease. - -The biggest drawback of Calibre is that it's too heavy on resources and that makes it a difficult choice as a standalone eBook reader. - -![Calibre][5] - -#### Features - - * Managing eBook: Calibre allows sorting and grouping eBooks by managing metadata. You can download metadata for an eBook from various sources or create and edit the existing field. - * Supports all major eBook formats: Calibre supports all major eBook formats and is compatible with various e-readers. - * File conversion: You can convert any ebook format to another one with the option of changing the book style, creating a table of content or improving margins while converting. You can convert your personal documents to an ebook too. - * Download magazines from the web: Calibre can deliver stories from various news sources or through RSS feed. - * Share and backup your library: It gives an option of hosting your eBook collection over its server which you can share with your friends or acccess from anywhere, using any device. Backup and import/export feature allows you to keep your collection safe and easy portability. - - - -#### Installation - -You can find it in the software repository of all major Linux distributions. For Ubuntu, search for it in Software Center or use he command below: - -`sudo apt-get install calibre` - -### 2. FBReader - -![FBReader: eBook reader for Linux][6] - -[FBReader][7] is an open source, lightweight, multi-platform ebook reader supporting various formats like ePub, fb2, mobi, rtf, html etc. It includes access to popular network libraries from where you can download ebooks for free or buy one. - -FBReader is highly customizable with options to choose colors, fonts, page-turning animations, bookmarks and dictionaries. - -#### Features - - * Supports a variety of file formats and devices like Android, iOS, Windows, Mac and more. - * Synchronize book collection, reading positions and bookmarks. - * Manage your library online by adding any book from your Linux desktop to all your devices. - * Web browser access to your stored collection. - * Supports storage of books in Google Drive and organizing of books by authors, series or other attributes. - - - -#### Installation - -You can install FBReader ebook reader from the official repository or by typing the below command in terminal. -``` -sudo apt-get install fbreader -``` - -Or, you can grab a .deb package from [here][8] and install it on your Debian based distributions. - -### 3. Okular - -[Okular][9] is another open source and cross-platform document viewer developed by KDE and is shipped as part of the KDE Application release. - -![Okular][10] - -#### Features - - * Okular supports various document formats like PDF, Postscript, DjVu, CHM, XPS, ePub and others. - * Supports features like commenting on PDF documents, highlighting and drawing different shapes etc. - * These changes are saved separately without modifying the original PDF file. - * Text from an eBook can be extracted to a text file and has an inbuilt text reading service called Jovie. - - - -Note: While checking the app, I did discover that the app doesn't support ePub file format in Ubuntu and its derivatives. The other distribution users can still utilize it's full potential. - -#### Installation - -Ubuntu users can install it by typing below command in Terminal : -``` -sudo apt-get install okular -``` - -### 4. Lucidor - -Lucidor is a handy e-book reader supporting epub file formats and catalogs in OPDS formats. It also features organizing the collection of e-books in local bookcase, searching and downloading from the internet and converting web feeds and web pages into e-books. - -Lucidor is XULRunner application giving you a look of Firefox with tabbed layout and behaves like it while storing data and configurations. It's the simplest ebook reader among the list and includes configurations like text justifications and scrolling options. - -![lucidor][11] - -You can look out for the definition from Wiktionary.org by selecting a word and right click > lookup word options. It also includes options to Web feeds or web pages as e-books. - -You can download and install the deb or RPM package from [here.][12] - -### 5. Bookworm - -![Bookworm eBook reader for Linux][13] - -Bookworm is another free and open source ebook reader supporting different file formats like epub, pdf, mobi, cbr and cbz. I wrote a dedicated article on features and installation for Bookworm apps, read it here: [Bookworm: A Simple yet Magnificent eBook Reader for Linux][14] - -#### Installation -``` -sudo apt-add-repository ppa:bookworm-team/bookworm -sudo apt-get update -sudo apt-get install bookworm -``` - -### 6. Easy Ebook Viewer - -[Easy Ebook Viewer][15] is another fantastic GTK Python app for reading ePub files. With features like basic chapter navigation, continuing from the last reading positions, importing from other ebook file formats, chapter jumping and more, Easy Ebook Viewer is a simple and minimalist ePub reader. - -![Easy-Ebook-Viewer][16] - -The app is still in its initial stage and has support for only ePub files. - -#### Installation - -You can install Easy Ebook Viewer by downloading the source code from [github][17] and compiling it yourself along with the dependencies. Alternatively, the following terminal commands will do the exact same job. -``` -sudo apt install git gir1.2-webkit-3.0 libwebkitgtk-3.0-0 gir1.2-gtk-3.0 python3-gi -git clone https://github.com/michaldaniel/Ebook-Viewer.git -cd Ebook-Viewer/ -sudo make install -``` - -After successful completion of the above steps, you can launch it from the Dash. - -### 7. Buka - -[Buka][18] is mostly an ebook manager with a simple and clean user interface. It currently supports PDF formats and is designed to help the user focus more on the content. With all the basic features of pdf reader, Buka lets you navigate through arrow keys, has zoom options and you can view 2 pages side by side. - -You can create separate lists of your PDF files and switch between them easily. Buka also provides a built-in translation tool but you need an active internet connection to use the feature. - -![Buka][19] - -#### Installation - -You can download an AppImage from the [official download page.][20] If you are not aware of it, read [how to use AppImage in Linux][21]. Alternatively, you can install it from the command line: -``` -sudo snap install buka -``` - -### Final Words - -Personally, I find Calibre best suited for my needs. Also, Bookworm looks promising to me and I am using it more often these days. Though, the selection of an ebook application totally depends on your preference. - -Which ebook app do you use? Let us know in the comments below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/best-ebook-readers-linux/ - -作者:[Ambarish Kumar][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://itsfoss.com/author/ambarish/ -[1]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/10/best-ebook-readers-linux-800x450.png -[2]:https://itsfoss.com/non-ubuntu-beginner-linux/ -[3]:https://www.calibre-ebook.com -[4]:https://itsfoss.com/create-ebook-calibre-linux/ -[5]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Calibre-800x603.jpeg -[6]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/10/fbreader-800x624.jpeg -[7]:https://fbreader.org -[8]:https://fbreader.org/content/fbreader-beta-linux-desktop -[9]:https://okular.kde.org/ -[10]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Okular-800x435.jpg -[11]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/lucidor-2.png -[12]:http://lucidor.org/lucidor/download.php -[13]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/08/bookworm-ebook-reader-linux-800x450.jpeg -[14]:https://itsfoss.com/bookworm-ebook-reader-linux/ -[15]:https://github.com/michaldaniel/Ebook-Viewer -[16]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Easy-Ebook-Viewer.jpg -[17]:https://github.com/michaldaniel/Ebook-Viewer.git -[18]:https://github.com/oguzhaninan/Buka -[19]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Buka2-800x555.png -[20]:https://github.com/oguzhaninan/Buka/releases -[21]:https://itsfoss.com/use-appimage-linux/ diff --git a/translated/tech/20171012 7 Best eBook Readers for Linux.md b/translated/tech/20171012 7 Best eBook Readers for Linux.md new file mode 100644 index 0000000000..89a222ea26 --- /dev/null +++ b/translated/tech/20171012 7 Best eBook Readers for Linux.md @@ -0,0 +1,182 @@ +Linux 7 个最佳电子书阅读器 +====== +**摘要:** 文章中我们涉及一些 Linux 最佳电子书阅读器。这些应用提供更佳阅读体验甚至会管理你的电子书。 + +![最佳 Linux 电子书阅读器][1] + +最近,随着人们发现在手持设备,Kindle 或者 PC 上阅读更佳舒适,对电子图书的需求有所增加。谈到 Linux 用户,有各种电子书应用满足你阅读和整理电子书的需求。 + +在本文中,我们选出了七个最佳 Linux 电子书阅读器。这些电子书阅读器最适合 pdf,epubs 和其他电子书格式。 + +## 最佳 Linux 电子书阅读器 + +我提供 Ubuntu 安装说明,因为我现在使用。如果你使用[非 Ubuntu 发行版][2],你能在你的发行版软件仓库中找到大多数这些电子书应用。 + +### 1. Calibre + +[Calibre][3] 是 Linux 最受欢迎的电子书应用。老实说,这不仅仅是一个简单的电子书阅读器。它是一个完整的电子书解决方案。你甚至能[通过 Calibre 创建私人电子][4] + +通过强大的电子书管理和易用的接口,它具有创建和编辑电子书。Calibre 支持多种格式和与其他电子书阅读器同步。它也可以让你轻松转换一种电子书格式到另一种。 + +Calibre 最大的缺点是,资源上太沉重,让它成为一个艰难的选择作为一个独立的电子阅读器。 + +![Calibre][5] + +#### 特性 + + * 管理电子书:Calibre 通过管理云数据允许存储和分组电子书。你能下载一本电子书的元数据从各种来源或创建和编辑现有的字段。 + * 支持所有主流电子书格式: Calibre 支持所有主流电子书格式并兼容多种电子阅读器。 + * 文件转换: 在转换时,你能通过改变电子书风格,创建内容表和调整边距的选项来转换任何一种电子书格式到另一种。你也能转换个人文档为电子书。 + * 从 web 下载杂志期刊:Calibre 能从各种新闻源或者通过 RSS 订阅源传递故事。 + * 分享和备份你的电子图书馆:它提供了一个选项,托管你电子书集合到它的服务端,从而你能与好友共享或用任何设备从任何地方访问。备份和导入/导出特性允许你保证你的收藏安全和方便携带。 + +#### 安装 + +你能在主流 Linux 发行版的软件库中找到它。对于 Ubuntu,在软件中心搜索它或者使用下面的命令: + +`sudo apt-get install calibre` + +### 2. FBReader + +![FBReader: Linux 电子书阅读器][6] + +[FBReader][7] 是一个开源的轻量级多平台电子书阅读器,它支持多种格式,比如 ePub,fb2,mobi,rtf,html 等。它包含一些允许访问的流行网络电子图书馆,那里你能免费或付费下载电子书。 + +#### 特性 + + * 支持多种文件格式和设备比如 Android,iOS,Windows,Mac 和更多。 + * 同步书籍收藏,阅读位置和书签。 + * 在线管理你图书馆中从你的 Linux 桌面添加到所有设备的任何书。 + * 支持 Web 浏览器允许你的存储集。 + * 支持 Google Drive 做书籍的存储和通过作者,系列或其他属性整理书籍。 + +#### 安装 + +你能从官方库或者在终端中输入一下命令安装 FBReader 电子阅读器。 +``` +sudo apt-get install fbreader +``` + +或者你能从[这里][8]抓取一个以 .deb 包并在你的基于 Debian 发行版的系统上安装它。 + +### 3. Okular + +[Okular][9] 是另一个开源的基于 KDE 开发的跨平台文档查看器,它已经作为 KDE 应用发布的一部分了。 + +![Okular][10] + +#### 特性 + + * Okular 支持多种文档格式像 PDF,Postscript,DjVu,DHM,XPS,ePub 和其他。 + * 支持在 PDF 文档中评论,高亮和绘制不通的形状等。 + * 无需修改原始 PDF 文件分别保存这些更改。 + * 电子书中的文本能被提取到一个文本文件,这个内置文本阅读服务叫 Jovie。 + +备注:检查应用的时候,我发现这个应用在 Ubuntu 和它的衍生系统不支持 ePub 文件格式。其他发行版用户仍然可以发挥它全部的潜力。 + +#### 安装 + +Ubuntu 用户可以在终端中键入下面的命令来安装它: +``` +sudo apt-get install okular +``` + +### 4. Lucidor + +Lucidor 是一个易用的支持 epub 文件格式和在 OPDS 格式中编目的电子阅读器。它也具有电子书集合在本地书柜里,搜索和下载互联网和 web 订阅和网页转换成电子书的功能。 + +Lucidor 是 XULRunner 应用程序,它向您展示了具有类火狐的选项卡式布局,和存储数据和配置时的展现。他是列表中最简单的电子阅读器,包括诸如文本说明和滚动选项之类的配置。 + +![lucidor][11] + +你可以通过选择单词并右击 > 查找单词来查找 Wiktionary.org 的定义。它也包含 web 订阅或 web 页面作为电子书的选项。 + +你能从[这里][12]下载和安装 deb 或者 RPM 包。 + +### 5. Bookworm + +![Bookworm Linux 电子阅读器][13] + +Bookworm 是另一个支持多种文件格式诸如 epub, pdf, mobi, cbr and cbz 的免费开源的电子阅读器。我写了一篇关于 Bookworm 应用程序的特性和安装的专题文章,到这里阅读: [Bookworm: 一个简单而强大的 Linux 电子阅读器][14] + +#### 安装 +``` +sudo apt-add-repository ppa:bookworm-team/bookworm +sudo apt-get update +sudo apt-get install bookworm +``` + +### 6. Easy Ebook Viewer + +[Easy Ebook Viewer][15] 是另外一个用于读取 ePub 文件的很棒的 GTK python 应用.具有基本章节导航、从上次阅读位置继续、从其他电子书文件格式导入、章节跳转等功能,Easy Ebook Viewer 是一个简单而简约的 ePub 阅读器. + +![Easy-Ebook-Viewer][16] + +这个应用仍然处于初始阶段,只支持ePub文件。 + +#### 安装 + +你可以从 [github][17] 下载源代码和自己编译以及依赖项来安装 Easy Ebook Viewer。或者,以下终端命令将执行完全相同的工作。 +``` +sudo apt install git gir1.2-webkit-3.0 libwebkitgtk-3.0-0 gir1.2-gtk-3.0 python3-gi +git clone https://github.com/michaldaniel/Ebook-Viewer.git +cd Ebook-Viewer/ +sudo make install +``` + +成功完成上述步骤后,你可以从Dash启动它。 + +### 7. Buka + +Buka 主要是一个具有简单而清爽的用户界面的电子书管理器。它目前支持 PDF 格式,旨在帮助用户更加关注内容。拥有 pdf 阅读器的所有基本特性,Buka 允许你通过箭头键导航,具有缩放选项,并且能并排查看 2 页。 + +你可以创建单独的 PDF 文件列表并轻松地在它们之间切换。Buka也提供了一个内置翻译工具,但是你需要有效的互联网连接来使用这个特性。 + +![Buka][19] + +#### 安装 + +你能从[官方下载页面][20]下载一个 AppImage。如果你不知道,请阅读[如何在 Linux 下使用 AppImage][21]。或者,你可以通过命令行安装它: +``` +sudo snap install buka +``` + +### 结束语 + +就我个人而言,我发现 Calibre 最适合我的需要。当然,Bookworm 看起来很有前途,这几天我经常使用它。不过,电子书应用的选择完全取决于你的喜好。 + +你使用哪个电子书应用呢?在下面的评论中让我们知道。 + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/best-ebook-readers-linux/ + +作者:[Ambarish Kumar][a] +译者:[zjon](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://itsfoss.com/author/ambarish/ +[1]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/10/best-ebook-readers-linux-800x450.png +[2]:https://itsfoss.com/non-ubuntu-beginner-linux/ +[3]:https://www.calibre-ebook.com +[4]:https://itsfoss.com/create-ebook-calibre-linux/ +[5]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Calibre-800x603.jpeg +[6]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/10/fbreader-800x624.jpeg +[7]:https://fbreader.org +[8]:https://fbreader.org/content/fbreader-beta-linux-desktop +[9]:https://okular.kde.org/ +[10]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Okular-800x435.jpg +[11]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/lucidor-2.png +[12]:http://lucidor.org/lucidor/download.php +[13]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/08/bookworm-ebook-reader-linux-800x450.jpeg +[14]:https://itsfoss.com/bookworm-ebook-reader-linux/ +[15]:https://github.com/michaldaniel/Ebook-Viewer +[16]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Easy-Ebook-Viewer.jpg +[17]:https://github.com/michaldaniel/Ebook-Viewer.git +[18]:https://github.com/oguzhaninan/Buka +[19]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Buka2-800x555.png +[20]:https://github.com/oguzhaninan/Buka/releases +[21]:https://itsfoss.com/use-appimage-linux/ From f61819dcf5b8b4c315deb1c7d060440b695ec21b Mon Sep 17 00:00:00 2001 From: zjon Date: Fri, 21 Dec 2018 16:33:09 +0800 Subject: [PATCH 007/322] update title updatetitle --- ...20171012 7 Best eBook Readers for Linux.md | 182 ++++++++++++++++++ ...20171012 7 Best eBook Readers for Linux.md | 2 +- 2 files changed, 183 insertions(+), 1 deletion(-) create mode 100644 sources/tech/20171012 7 Best eBook Readers for Linux.md diff --git a/sources/tech/20171012 7 Best eBook Readers for Linux.md b/sources/tech/20171012 7 Best eBook Readers for Linux.md new file mode 100644 index 0000000000..520c9c4533 --- /dev/null +++ b/sources/tech/20171012 7 Best eBook Readers for Linux.md @@ -0,0 +1,182 @@ +7 个最佳 Linux 电子书阅读器 +====== +**摘要:** 文章中我们涉及一些 Linux 最佳电子书阅读器。这些应用提供更佳阅读体验甚至会管理你的电子书。 + +![最佳 Linux 电子书阅读器][1] + +最近,随着人们发现在手持设备,Kindle 或者 PC 上阅读更佳舒适,对电子图书的需求有所增加。谈到 Linux 用户,有各种电子书应用满足你阅读和整理电子书的需求。 + +在本文中,我们选出了七个最佳 Linux 电子书阅读器。这些电子书阅读器最适合 pdf,epubs 和其他电子书格式。 + +## 最佳 Linux 电子书阅读器 + +我提供 Ubuntu 安装说明,因为我现在使用。如果你使用[非 Ubuntu 发行版][2],你能在你的发行版软件仓库中找到大多数这些电子书应用。 + +### 1. Calibre + +[Calibre][3] 是 Linux 最受欢迎的电子书应用。老实说,这不仅仅是一个简单的电子书阅读器。它是一个完整的电子书解决方案。你甚至能[通过 Calibre 创建私人电子][4] + +通过强大的电子书管理和易用的接口,它具有创建和编辑电子书。Calibre 支持多种格式和与其他电子书阅读器同步。它也可以让你轻松转换一种电子书格式到另一种。 + +Calibre 最大的缺点是,资源上太沉重,让它成为一个艰难的选择作为一个独立的电子阅读器。 + +![Calibre][5] + +#### 特性 + + * 管理电子书:Calibre 通过管理云数据允许存储和分组电子书。你能下载一本电子书的元数据从各种来源或创建和编辑现有的字段。 + * 支持所有主流电子书格式: Calibre 支持所有主流电子书格式并兼容多种电子阅读器。 + * 文件转换: 在转换时,你能通过改变电子书风格,创建内容表和调整边距的选项来转换任何一种电子书格式到另一种。你也能转换个人文档为电子书。 + * 从 web 下载杂志期刊:Calibre 能从各种新闻源或者通过 RSS 订阅源传递故事。 + * 分享和备份你的电子图书馆:它提供了一个选项,托管你电子书集合到它的服务端,从而你能与好友共享或用任何设备从任何地方访问。备份和导入/导出特性允许你保证你的收藏安全和方便携带。 + +#### 安装 + +你能在主流 Linux 发行版的软件库中找到它。对于 Ubuntu,在软件中心搜索它或者使用下面的命令: + +`sudo apt-get install calibre` + +### 2. FBReader + +![FBReader: Linux 电子书阅读器][6] + +[FBReader][7] 是一个开源的轻量级多平台电子书阅读器,它支持多种格式,比如 ePub,fb2,mobi,rtf,html 等。它包含一些允许访问的流行网络电子图书馆,那里你能免费或付费下载电子书。 + +#### 特性 + + * 支持多种文件格式和设备比如 Android,iOS,Windows,Mac 和更多。 + * 同步书籍收藏,阅读位置和书签。 + * 在线管理你图书馆中从你的 Linux 桌面添加到所有设备的任何书。 + * 支持 Web 浏览器允许你的存储集。 + * 支持 Google Drive 做书籍的存储和通过作者,系列或其他属性整理书籍。 + +#### 安装 + +你能从官方库或者在终端中输入一下命令安装 FBReader 电子阅读器。 +``` +sudo apt-get install fbreader +``` + +或者你能从[这里][8]抓取一个以 .deb 包并在你的基于 Debian 发行版的系统上安装它。 + +### 3. Okular + +[Okular][9] 是另一个开源的基于 KDE 开发的跨平台文档查看器,它已经作为 KDE 应用发布的一部分了。 + +![Okular][10] + +#### 特性 + + * Okular 支持多种文档格式像 PDF,Postscript,DjVu,DHM,XPS,ePub 和其他。 + * 支持在 PDF 文档中评论,高亮和绘制不通的形状等。 + * 无需修改原始 PDF 文件分别保存这些更改。 + * 电子书中的文本能被提取到一个文本文件,这个内置文本阅读服务叫 Jovie。 + +备注:检查应用的时候,我发现这个应用在 Ubuntu 和它的衍生系统不支持 ePub 文件格式。其他发行版用户仍然可以发挥它全部的潜力。 + +#### 安装 + +Ubuntu 用户可以在终端中键入下面的命令来安装它: +``` +sudo apt-get install okular +``` + +### 4. Lucidor + +Lucidor 是一个易用的支持 epub 文件格式和在 OPDS 格式中编目的电子阅读器。它也具有电子书集合在本地书柜里,搜索和下载互联网和 web 订阅和网页转换成电子书的功能。 + +Lucidor 是 XULRunner 应用程序,它向您展示了具有类火狐的选项卡式布局,和存储数据和配置时的展现。他是列表中最简单的电子阅读器,包括诸如文本说明和滚动选项之类的配置。 + +![lucidor][11] + +你可以通过选择单词并右击 > 查找单词来查找 Wiktionary.org 的定义。它也包含 web 订阅或 web 页面作为电子书的选项。 + +你能从[这里][12]下载和安装 deb 或者 RPM 包。 + +### 5. Bookworm + +![Bookworm Linux 电子阅读器][13] + +Bookworm 是另一个支持多种文件格式诸如 epub, pdf, mobi, cbr and cbz 的免费开源的电子阅读器。我写了一篇关于 Bookworm 应用程序的特性和安装的专题文章,到这里阅读: [Bookworm: 一个简单而强大的 Linux 电子阅读器][14] + +#### 安装 +``` +sudo apt-add-repository ppa:bookworm-team/bookworm +sudo apt-get update +sudo apt-get install bookworm +``` + +### 6. Easy Ebook Viewer + +[Easy Ebook Viewer][15] 是另外一个用于读取 ePub 文件的很棒的 GTK python 应用.具有基本章节导航、从上次阅读位置继续、从其他电子书文件格式导入、章节跳转等功能,Easy Ebook Viewer 是一个简单而简约的 ePub 阅读器. + +![Easy-Ebook-Viewer][16] + +这个应用仍然处于初始阶段,只支持ePub文件。 + +#### 安装 + +你可以从 [github][17] 下载源代码和自己编译以及依赖项来安装 Easy Ebook Viewer。或者,以下终端命令将执行完全相同的工作。 +``` +sudo apt install git gir1.2-webkit-3.0 libwebkitgtk-3.0-0 gir1.2-gtk-3.0 python3-gi +git clone https://github.com/michaldaniel/Ebook-Viewer.git +cd Ebook-Viewer/ +sudo make install +``` + +成功完成上述步骤后,你可以从Dash启动它。 + +### 7. Buka + +Buka 主要是一个具有简单而清爽的用户界面的电子书管理器。它目前支持 PDF 格式,旨在帮助用户更加关注内容。拥有 pdf 阅读器的所有基本特性,Buka 允许你通过箭头键导航,具有缩放选项,并且能并排查看 2 页。 + +你可以创建单独的 PDF 文件列表并轻松地在它们之间切换。Buka也提供了一个内置翻译工具,但是你需要有效的互联网连接来使用这个特性。 + +![Buka][19] + +#### 安装 + +你能从[官方下载页面][20]下载一个 AppImage。如果你不知道,请阅读[如何在 Linux 下使用 AppImage][21]。或者,你可以通过命令行安装它: +``` +sudo snap install buka +``` + +### 结束语 + +就我个人而言,我发现 Calibre 最适合我的需要。当然,Bookworm 看起来很有前途,这几天我经常使用它。不过,电子书应用的选择完全取决于你的喜好。 + +你使用哪个电子书应用呢?在下面的评论中让我们知道。 + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/best-ebook-readers-linux/ + +作者:[Ambarish Kumar][a] +译者:[zjon](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://itsfoss.com/author/ambarish/ +[1]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/10/best-ebook-readers-linux-800x450.png +[2]:https://itsfoss.com/non-ubuntu-beginner-linux/ +[3]:https://www.calibre-ebook.com +[4]:https://itsfoss.com/create-ebook-calibre-linux/ +[5]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Calibre-800x603.jpeg +[6]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/10/fbreader-800x624.jpeg +[7]:https://fbreader.org +[8]:https://fbreader.org/content/fbreader-beta-linux-desktop +[9]:https://okular.kde.org/ +[10]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Okular-800x435.jpg +[11]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/lucidor-2.png +[12]:http://lucidor.org/lucidor/download.php +[13]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/08/bookworm-ebook-reader-linux-800x450.jpeg +[14]:https://itsfoss.com/bookworm-ebook-reader-linux/ +[15]:https://github.com/michaldaniel/Ebook-Viewer +[16]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Easy-Ebook-Viewer.jpg +[17]:https://github.com/michaldaniel/Ebook-Viewer.git +[18]:https://github.com/oguzhaninan/Buka +[19]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Buka2-800x555.png +[20]:https://github.com/oguzhaninan/Buka/releases +[21]:https://itsfoss.com/use-appimage-linux/ diff --git a/translated/tech/20171012 7 Best eBook Readers for Linux.md b/translated/tech/20171012 7 Best eBook Readers for Linux.md index 89a222ea26..520c9c4533 100644 --- a/translated/tech/20171012 7 Best eBook Readers for Linux.md +++ b/translated/tech/20171012 7 Best eBook Readers for Linux.md @@ -1,4 +1,4 @@ -Linux 7 个最佳电子书阅读器 +7 个最佳 Linux 电子书阅读器 ====== **摘要:** 文章中我们涉及一些 Linux 最佳电子书阅读器。这些应用提供更佳阅读体验甚至会管理你的电子书。 From deda2a3e472aa3f494d9fdc630c7d60ab1037f1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Sat, 22 Dec 2018 19:45:31 +0800 Subject: [PATCH 008/322] Update and rename sources/tech/20180130 Graphics and music tools for game development.md to translated/tech/20180130 Graphics and music tools for game development.md --- ...cs and music tools for game development.md | 180 ------------------ ...cs and music tools for game development.md | 177 +++++++++++++++++ 2 files changed, 177 insertions(+), 180 deletions(-) delete mode 100644 sources/tech/20180130 Graphics and music tools for game development.md create mode 100644 translated/tech/20180130 Graphics and music tools for game development.md diff --git a/sources/tech/20180130 Graphics and music tools for game development.md b/sources/tech/20180130 Graphics and music tools for game development.md deleted file mode 100644 index db2cd04f3b..0000000000 --- a/sources/tech/20180130 Graphics and music tools for game development.md +++ /dev/null @@ -1,180 +0,0 @@ -robsean translating -Graphics and music tools for game development -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_Life_opengame.png?itok=JPxruL3k) - -In early October, our club, [Geeks and Gadgets][1] from Marshall University, participated in the inaugural [Open Jam][2], a game jam that celebrated the best of open source tools. Game jams are events where participants work as teams to develop computer games for fun. Jams tend to be very short--only three days long--and very exhausting. Opensource.com [announced][3] Open Jam in late August, and more than [three dozen games][4] were entered into the competition. - -Our club likes to create and use open source software in our projects, so Open Jam was naturally the jam we wanted to participate in. Our submission was an experimental game called [Mark My Words][5]. We used a variety of free and open source (FOSS) tools to develop it; in this article we'll discuss some of the tools we used and potential stumbling blocks to be aware of. - -### Audio tools - -#### MilkyTracker - -[MilkyTracker][6] is one of the best software packages available for composing old-style video game music. It is an example of a [music tracker][7], a powerful MOD and XM file creator with a characteristic grid-based pattern editor. We used it to compose most of the musical pieces in our game. One of the great things about this program is that it consumed much less disk space and RAM than most of our other tools. Even so, MilkyTracker is still extremely powerful. - -![](https://opensource.com/sites/default/files/u128651/mtracker.png) - -The user interface took a while to get used to, so here are some pointers for any musician who wants to try out MilkyTracker: - - * Go to Config > Misc. and set the edit mode control style to "MilkyTracker." This will give you modern keyboard shortcuts for almost everything - * Undo with Ctrl+Z - * Redo with Ctrl+Y - * Toggle pattern-edit mode with the Spacebar - * Delete the previous note with the Backspace key - * Insert a row with the Insert key - * By default, a note will continue playing until it is replaced on that channel. You can end a note explicitly by inserting a KeyOff note with the backquote (`) key - * You will have to create or find samples before you can start composing. We recommend finding [Creative Commons][8] licensed samples at websites such as [Freesound][9] or [ccMixter][10] - - - -In addition, keep the [MilkyTracker documentation page][11] handy. It contains links to numerous tutorials and manuals. A good starting point is the [MilkyTracker Guide][12] on the project's wiki. - -#### LMMS - -Two of our musicians used the versatile and modern music creation tool [LMMS][13]. It comes with a library of cool samples and effects, plus a variety of flexible plugins for generating unique sounds. The learning curve for LMMS was surprisingly low, in part due to the nice beat/bassline editor. - -![](https://opensource.com/sites/default/files/u128651/lmms_plugins.png) - -We have one suggestion for musicians trying out LMMS: Use the plugins. For [chiptune][14]-style music, we recommend [sfxr][15], [BitInvader][16], and [FreeBoy][17]. For other styles, [ZynAddSubFX][18] is a good choice. It comes with a wide range of synthesized instruments that can be altered however you see fit. - -### Graphics tools - -#### Tiled - -[Tiled][19] is a popular tilemap editor in open source game development. We used it to assemble consistent, retro-looking backgrounds for our in-game scenes. - -![](https://opensource.com/sites/default/files/u128651/tiled.png) - -Tiled can export maps as XML, JSON, or as flattened images. It is stable and cross-platform. - -One of Tiled's features, which we did not use during the jam, allows you to define and place arbitrary game objects, such as coins and powerups, onto the map. All you have to do is load the object's graphics as a tileset, then place them using Insert Tile. - -Overall, Tiled is a stellar piece of software that we recommend for any project that needs a map editor. - -#### Piskel - -[Piskel][20] is a pixel art editor whose source code is licensed under the [Apache License, Version 2.0][21]. We used Piskel for almost all our graphical assets during the jam, and we will certainly be using it in future projects as well. - -Two features of Piskel that helped us immensely during the jam are onion skin and spritesheet exporting. - -##### Onion skin - -The onion skin feature will make Piskel show a ghostly overlay of the previous and next frames of your animation as you edit, like this: - -![](https://opensource.com/sites/default/files/u128651/onionshow.gif) - -Onion skin is handy because it serves as a drawing guide and helps you maintain consistent shapes and volumes on your characters throughout the animation process. To enable it, just click the onion-shaped icon underneath the preview window on the top-right of the screen. - -![](https://opensource.com/sites/default/files/u128651/onionenable.png) - -##### Spritesheet exporting - -Piskel's ability to export animations as a spritesheet was also very helpful. A spritesheet is a single raster image that contains all the frames of an animation. For example, here is a spritesheet we exported from Piskel: - -![](https://opensource.com/sites/default/files/u128651/sprite-artist.png) - -The spritesheet consists of two frames. One frame is in the top half of the image and the other frame is in the bottom half of the image. Spritesheets greatly simplify a game's code by enabling an entire animation to be loaded from a single file. Here is an animated version of the above spritesheet: - -![](https://opensource.com/sites/default/files/u128651/sprite-artist-anim.gif) - -##### Unpiskel.py - -There were several times during the jam when we wanted to batch convert Piskel files into PNGs. Since the Piskel file format is based on JSON, we wrote a small GPLv3-licensed Python script called [unpiskel.py][22] to do the conversion. - -It is invoked like this: -``` - - -python unpiskel.py input.piskel -``` - -The script will extract the PNG data frames and layers from a Piskel file (here `input.piskel`) and store them in their own files. The files follow the pattern `NAME_XX_YY.png` where `NAME` is the truncated name of the Piskel file, `XX` is the frame number, and `YY` is the layer number. - -Because the script can be invoked from a shell, it can be used on a whole list of files. -``` -for f in *.piskel; do python unpiskel.py "$f"; done -``` - -### Python, Pygame, and cx_Freeze - -#### Python and Pygame - -We used the [Python][23] language to make our game. It is a scripting language that is commonly used for text processing and desktop app development. It can also be used for game development, as projects like [Angry Drunken Dwarves][24] and [Ren'Py][25] have shown. Both of these projects use a Python library called [Pygame][26] to display graphics and produce sound, so we decided to use this library in Open Jam, too. - -Pygame turned out to be both stable and featureful, and it was great for the arcade-style game we were creating. The library's speed was fast enough at low resolutions, but its CPU-only rendering starts to slow down at higher resolutions. This is because Pygame does not use hardware-accelerated rendering. However, the infrastructure is there for developers to take full advantage of OpenGL. - -If you're looking for a good 2D game programming library, Pygame is one to keep your eye on. Its website has [a good tutorial][27] to get started. Be sure to check it out! - -#### cx_Freeze - -Prepping our game for distribution was interesting. We knew that Windows users were unlikely to have a Python installation, and asking them to install it would have been too much. On top of that, they would have had to also install Pygame, which is not an intuitive task on Windows. - -One thing was clear: We had to put our game into a more convenient form. Many of the other Open Jam participants used the proprietary game engine Unity, which enabled their games to be played in the web browser. This made them extremely convenient to play. Convenience was one thing our game didn't have even a sliver of. But, thanks to a vibrant Python ecosystem, we had options. Tools exist to help Python programmers prepare their programs for distribution on Windows. The two that we considered were [cx_Freeze][28] and [Pygame2exe][29] (which uses [py2exe][30]). We decided on cx_Freeze because it was cross-platform. - -In cx_Freeze, you can pack a single-script game for distribution just by running a command like this in the shell: -``` -cxfreeze main.py --target-dir dist -``` - -This invocation of `cxfreeze` will take your script (here `main.py`) and the Python interpreter on your system and bundle them up into the `dist` directory. Once this is done, all you have to do is manually copy your game's data files into the `dist` directory. You will find that the `dist` directory contains an executable file that can be run to start your game. - -There is a more involved way to use cx_Freeze that allows you to automate the copying of data files, but we found the straightforward invocation of `cxfreeze` to be good enough for our needs. Thanks to this tool, we made our game a little more convenient to play. - -### Celebrating open source - -Open Jam is important because it celebrates the open source model of software development. This is an opportunity to analyze the current state of open source tools and what we need to work on in the future. Game jams are perhaps the best time for game devs to try to push their tools to the limit, to learn what must be improved for the good of future game devs. - -Open source tools enable people to explore their creativity without compromising their freedom and without investing money upfront. Although we might not become professional game developers, we were still able to get a small taste of it with our short, experimental game called [Mark My Words][5]. It is a linguistically themed game that depicts the evolution of a fictional writing system throughout its history. There were many other delightful submissions to Open Jam, and they are all worth checking out. Really, [go look][31]! - -Before closing, we would like to thank all the [club members who participated][32] and made this experience truly worthwhile. We would also like to thank [Michael Clayton][33], [Jared Sprague][34], and [Opensource.com][35] for hosting Open Jam. It was a blast. - -Now, we have some questions for readers. Are you a FOSS game developer? What are your tools of choice? Be sure to leave a comment below! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/1/graphics-music-tools-game-dev - -作者:[Charlie Murphy][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://opensource.com/users/rsg167 -[1]:http://mugeeks.org/ -[2]:https://itch.io/jam/open-jam-1 -[3]:https://opensource.com/article/17/8/open-jam-announcement -[4]:https://opensource.com/article/17/11/open-jam -[5]:https://mugeeksalpha.itch.io/mark-omy-words -[6]:http://milkytracker.titandemo.org/ -[7]:https://en.wikipedia.org/wiki/Music_tracker -[8]:https://creativecommons.org/ -[9]:https://freesound.org/ -[10]:http://ccmixter.org/view/media/home -[11]:http://milkytracker.titandemo.org/documentation/ -[12]:https://github.com/milkytracker/MilkyTracker/wiki/MilkyTracker-Guide -[13]:https://lmms.io/ -[14]:https://en.wikipedia.org/wiki/Chiptune -[15]:https://github.com/grimfang4/sfxr -[16]:https://lmms.io/wiki/index.php?title=BitInvader -[17]:https://lmms.io/wiki/index.php?title=FreeBoy -[18]:http://zynaddsubfx.sourceforge.net/ -[19]:http://www.mapeditor.org/ -[20]:https://www.piskelapp.com/ -[21]:https://github.com/piskelapp/piskel/blob/master/LICENSE -[22]:https://raw.githubusercontent.com/MUGeeksandGadgets/MarkMyWords/master/tools/unpiskel.py -[23]:https://www.python.org/ -[24]:https://www.sacredchao.net/~piman/angrydd/ -[25]:https://renpy.org/ -[26]:https://www.Pygame.org/ -[27]:http://Pygame.org/docs/tut/PygameIntro.html -[28]:https://anthony-tuininga.github.io/cx_Freeze/ -[29]:https://Pygame.org/wiki/Pygame2exe -[30]:http://www.py2exe.org/ -[31]:https://itch.io/jam/open-jam-1/entries -[32]:https://github.com/MUGeeksandGadgets/MarkMyWords/blob/3e1e8aed12ebe13acccf0d87b06d4f3bd124b9db/README.md#credits -[33]:https://twitter.com/mwcz -[34]:https://twitter.com/caramelcode -[35]:https://opensource.com/ diff --git a/translated/tech/20180130 Graphics and music tools for game development.md b/translated/tech/20180130 Graphics and music tools for game development.md new file mode 100644 index 0000000000..1cdb157bc4 --- /dev/null +++ b/translated/tech/20180130 Graphics and music tools for game development.md @@ -0,0 +1,177 @@ +用于游戏开发的图形和音乐工具 +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_Life_opengame.png?itok=JPxruL3k) + +在十月初,我们的俱乐部,来自马歇尔大学的 [Geeks and Gadgets][1] , 参加就职 [Open Jam][2], 一个游戏 jam ,庆祝最好的开源工具。游戏 jams 是参与者为娱乐像团队协作的来开发计算机游戏的事件。Jams 倾向于非常简短--仅三天时间长--并非常让人精疲力尽。Opensource.com 在八月下旬 [宣布][3] Open Jam ,更多 [three dozen games][4] 进入到竞赛中。 + +我们的俱乐部希望在我们的工程中创建和使用开放源码软件,所以 Open Jam 自然是我们想要参与的 jam 。我们的提交的文件是一个实验性的名称为 [Mark My Words][5] 的游戏。我们使用多种自由和开放源码 (FOSS) 工具来开发它;在这篇文章中,我们将讨论一些我们使用和意识到有潜在的障碍物的工具。 + +### 音频工具 + +#### MilkyTracker + +[MilkyTracker][6] 是最好的可用于构成旧样式电子游戏音乐的软件包中的一个。它是一个 [music tracker][7] 的一个示例,一个强大的带有特殊的基于网格的图形编辑器的 MOD 和 XM 文件创建器。在我们的游戏中,我们使用它来构成大多数的音乐片段。这个程序最好的特点是,它比我们其它的大多数工具消耗更少的硬盘空间和 RAM 。虽然如此,MilkyTracker 仍然非常强大。 + +![](https://opensource.com/sites/default/files/u128651/mtracker.png) + +用户界面需要一会来习惯,这里有对一些想试用MilkyTracker的音乐家的一些提示: + + * 转到 Config > Misc. ,设置 edit 模式控制样式为 "MilkyTracker." 这将给你几乎所有的现代键盘快捷方式 + * 撤销 Ctrl+Z + * 重做 Ctrl+Y + * 切换 pattern-edit 模式 空格键 + * 删除先前的注释 退格键 + * 插入一行 Insert键 + * 默认情况下,一个注释将持续作用,直到它在这频道上被替换。你可以明确地结束一个注释,通过使用一个反引号 (`) 键插入一个 KeyOff 注释 + * 在你开始谱写乐曲前,你将不得不创建或查找示例。我们建议在网站上查找 [Creative Commons][8] 协议的示例,例如 [Freesound][9] 或 [ccMixter][10] + + + +另外,保持 [MilkyTracker 文档页面][11] 在手边。它含有数不清的教程和手册的链接。一个好的开始点是在该项目 wiki 上的 [MilkyTracker 指南][12] 。 + +#### LMMS + +我们中的两个音乐家使用多用途和现代音乐创建工具 [LMMS][13] 。它带来一个绝妙的示例和效果库,加一个灵活的多种多样的插件来生成独特的声音。 The learning curve for LMMS 的学习曲线令人吃惊的低,在某种程度上是因为友好的节拍/低音线编辑器。 + +![](https://opensource.com/sites/default/files/u128651/lmms_plugins.png) + +我们对音乐家有一个建议,尝试 LMMS:使用插件。 对于 [chiptune][14]-样式音乐,我们推荐 [sfxr][15] ,[BitInvader][16] ,和 [FreeBoy][17] 。对于其它样式, [ZynAddSubFX][18] 是一个好的选择。它带来一个宽波段的可以被你任意更改的人工合成工具。 + +### 图形工具 + +#### Tiled + +在开放源码游戏开发中,[Tiled][19] 是一个流行的组件地图类(tilemap)编辑器。我们使用它为来为我们在游戏场景中组合连续的,复古的背景。 + +![](https://opensource.com/sites/default/files/u128651/tiled.png) + +Tiled 可以导出地图为 XM L,JSON ,或平坦的图像。它是稳定的和跨平台的。 + +Tiled 的特征一,在 jam 期间,我们不能使用, 允许你定义和随意的放置游戏对象,例如硬币和永久能力提升道具到地图上。你需要做的全部是加载对象的图像为一个平铺显示集,然后使用插入平铺显示放置它们。 + +一般来说,对于一些需要一个地图编辑器的工程,Tiled 是我们建议软件的一个主要的部分。 + +#### Piskel + +[Piskel][20] 是一个像素艺术编辑器,它的源文件代码是在 [Apache 协议, 版本 2.0][21] 协议下。在 jam 期间,我们对我们的大多数的图像资源使用 Piskel ,我们当然也将在未来的工程中使用它。 + +Piskel 的特征二,在 jam 的 onion skin和Spritesheet导出期间极大地帮助我们。 + +##### Onion skin + +onion skin 特征将使 Piskel 显示你编辑的动画的前一帧和后一帧的一个幽灵似的覆盖物,像这样: + +![](https://opensource.com/sites/default/files/u128651/onionshow.gif) + +Onion skin 是便于使用的,因为它适合作为一个绘制指南和在动画进程期间帮助你维护在你的角色上连续的图形和声音。为启用它,只需要在屏幕的右上方预览窗体的下面单击 onion-shaped 图标。 + +![](https://opensource.com/sites/default/files/u128651/onionenable.png) + +##### Spritesheet 导出 + +Piskel 的能力是导出动画为一个 spritesheet ,也是非常有用的。一个 spritesheet 是一个单个光栅图象,它包含一个动画的所有的帧。例如,这是一个我们从 Piskel 导出的 spritesheet : + +![](https://opensource.com/sites/default/files/u128651/sprite-artist.png) + +spritesheet 包含两幅帧。一幅帧是图像的上半部分,另一帧是图像的下半部分。Spritesheets 通过启用一个完整的动画来从单个文件加载,大大地简化一个游戏的代码。这是上面的 spritesheet 的一个动画版本: + +![](https://opensource.com/sites/default/files/u128651/sprite-artist-anim.gif) + +##### Unpiskel.py + +在 jam 期间,我们很多次想批量转换 Piskel 文件到 PNG 文件。尽管 Piskel 文件格式基于 JSON ,我们写一个小的 GPLv3 协议的称为 [unpiskel.py][22] 的 Python 脚本来做转换。 + +它像这样被引用: +``` +python unpiskel.py input.piskel +``` + +这个脚本将从一个 Piskel 文件(这里 `input.piskel`)中提取 PNG 数据帧和层,并存储它们在它们拥有的文件中。这些文件采用模式 `NAME_XX_YY.png` ,在这里 `NAME` 是 Piskel 文件的缩减名称,`XX` 是帧的编号,`YY` 是层的编号。 + +因为脚本可以从一个 shell 中引用,它可以被使用在文件的整个列表中。 +``` +for f in *.piskel; do python unpiskel.py "$f"; done +``` + +### Python, Pygame, 和 cx_Freeze + +#### Python 和 Pygame + +我们使用 [Python][23] 语言来自制作我们的游戏。它是一个脚本语言,通常被用于文本处理和桌面应用程序开发。它也可以用于游戏开发,例如工程,像 [Angry Drunken Dwarves][24] 和 [Ren'Py][25] 已经显示。这两个工程都使用一个称为 [Pygame][26] 的 Python 库来显示图形和产生声音,所以我们也决定在 Open Jam 中使用这个库。 + +Pygame 被证明是既稳定又富有特色,并且它对我们创建的街机游戏来说是优秀的。在低分辨率时,库的速度足够快的,但是在高分辨率时,它的仅 CPU 渲染开始变慢。这是因为 Pygame 不使用硬件加速渲染。然而,开发者可以充分利用 OpenGL 基础设施。 + +如果你正在寻找一个好的 2D 游戏编程库,Pygame 是值得密切注意的一个。它的网站有 [一个好的教程][27] 来开始。务必看看它! + +#### cx_Freeze + +准备发行我们的游戏是有趣的。我们知道,Windows 用户不喜欢有一个 Python 安装,并且要求他们来安装它可能很过分。除此之外,他们也可能不得不安装 Pygame ,在 Windows 上,这不是一个简单的工作。 + +有一件事很清楚:我们不得不放置我们的游戏到一个更方便的结构中。很多其他的 Open Jam 参与者使用专有的游戏引擎 Unity ,它能够使它们的游戏在网页浏览器中来玩。这使得它们非常方便地来玩。便利性是一个我们的游戏恰巧一丝的都没有的东西。但是,感谢生机勃勃的 Python 生态系统,我们有选择。在 Windows 上现有的工具帮助 Python 程序员准备发行他们的游戏。我们考虑的两个是 [cx_Freeze][28] 和 [Pygame2exe][29] (它使用 [py2exe][30])。我们下决心在 cx_Freeze 上,因为它是跨平台的。 + +在 cx_Freeze 中,你可以为发行版打包一个单个脚本游戏,只要在shell运行一个命令,像这样: +``` +cxfreeze main.py --target-dir dist +``` + +`cxfreeze` 的这个调用将拿你的脚本(这里 `main.py`) 和在你系统上的 Python 解释器,并捆绑定它们到 `dist` 目录。一旦完成它,你需要做的是手动复制你的游戏的数据文件到 `dist` 目录。你将发现,`dist` 目录包含一个可以运行来开始你的游戏的可执行文件。 + +这里有更复杂难解的方法来使用 cx_Freeze ,允许你自动地复制数据文件,但是我们发现简单的调用 `cxfreeze` 足够我们的需要。感谢这个工具,我们使我们的游戏稍微便利的运行。 + +### 庆祝开放源码 + +Open Jam 是重要的,因为它庆祝软件开发的开放源码模式。这是来分析开放源码工具的当前状态和我们在未来工作中需求的一个机会。,对于游戏开发者来设法推动它们的工具的使用范围,学习必需提高未来游戏开发者的益处,游戏 jams 或许是最好的时间。 + +开放源码工具使人们能够探索他们的创造性,而不妥协他们的自由和前期的投资。尽管我们可能不能成为专业的游戏开发者,我们仍然能获取它的一段小的体验,使用我们简短的,实验性的称为 [Mark My Words][5] 的游戏。它是一个语言学方面地的有特定主题的游戏,它描述一个小说写作系统在它历史期间的演化。Open Jam 有一些令人愉快的提交,并且它们是值得校核。真的, [去看看][31] ! + +在结束前,我们想要感谢所有的 [参加俱乐部的成员][32],使这次经历真正的有价值。我们也想要感谢 [Michael Clayton][33],[Jared Sprague][34] 和 [Opensource.com][35] 主办 open Jam。它是一次欢乐。 + +现在,我们对读者有一些问题。你是一个 FOSS 游戏开发者吗?你选择的工具是什么?务必在下面留下一个评论! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/1/graphics-music-tools-game-dev + +作者:[Charlie Murphy][a] +译者:[robsean](https://github.com/robsean) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/rsg167 +[1]:http://mugeeks.org/ +[2]:https://itch.io/jam/open-jam-1 +[3]:https://opensource.com/article/17/8/open-jam-announcement +[4]:https://opensource.com/article/17/11/open-jam +[5]:https://mugeeksalpha.itch.io/mark-omy-words +[6]:http://milkytracker.titandemo.org/ +[7]:https://en.wikipedia.org/wiki/Music_tracker +[8]:https://creativecommons.org/ +[9]:https://freesound.org/ +[10]:http://ccmixter.org/view/media/home +[11]:http://milkytracker.titandemo.org/documentation/ +[12]:https://github.com/milkytracker/MilkyTracker/wiki/MilkyTracker-Guide +[13]:https://lmms.io/ +[14]:https://en.wikipedia.org/wiki/Chiptune +[15]:https://github.com/grimfang4/sfxr +[16]:https://lmms.io/wiki/index.php?title=BitInvader +[17]:https://lmms.io/wiki/index.php?title=FreeBoy +[18]:http://zynaddsubfx.sourceforge.net/ +[19]:http://www.mapeditor.org/ +[20]:https://www.piskelapp.com/ +[21]:https://github.com/piskelapp/piskel/blob/master/LICENSE +[22]:https://raw.githubusercontent.com/MUGeeksandGadgets/MarkMyWords/master/tools/unpiskel.py +[23]:https://www.python.org/ +[24]:https://www.sacredchao.net/~piman/angrydd/ +[25]:https://renpy.org/ +[26]:https://www.Pygame.org/ +[27]:http://Pygame.org/docs/tut/PygameIntro.html +[28]:https://anthony-tuininga.github.io/cx_Freeze/ +[29]:https://Pygame.org/wiki/Pygame2exe +[30]:http://www.py2exe.org/ +[31]:https://itch.io/jam/open-jam-1/entries +[32]:https://github.com/MUGeeksandGadgets/MarkMyWords/blob/3e1e8aed12ebe13acccf0d87b06d4f3bd124b9db/README.md#credits +[33]:https://twitter.com/mwcz +[34]:https://twitter.com/caramelcode +[35]:https://opensource.com/ From fb1bdd6d48ef62ce095f5724c4bc52f4dab3c4c0 Mon Sep 17 00:00:00 2001 From: qhwdw Date: Sat, 22 Dec 2018 21:29:44 +0800 Subject: [PATCH 009/322] Translated by qhwdw --- ... 5- Moving Subkeys to a Hardware Device.md | 304 ------------------ ... 5- Moving Subkeys to a Hardware Device.md | 304 ++++++++++++++++++ 2 files changed, 304 insertions(+), 304 deletions(-) delete mode 100644 sources/tech/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md create mode 100644 translated/tech/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md diff --git a/sources/tech/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md b/sources/tech/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md deleted file mode 100644 index 8463598b4c..0000000000 --- a/sources/tech/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md +++ /dev/null @@ -1,304 +0,0 @@ -Translating by qhwdw -Protecting Code Integrity with PGP — Part 5: Moving Subkeys to a Hardware Device -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/pgp-keys.jpg?itok=aS6IWGpq) - -In this tutorial series, we're providing practical guidelines for using PGP. If you missed the previous article, you can catch up with the links below. But, in this article, we'll continue our discussion about securing your keys and look at some tips for moving your subkeys to a specialized hardware device. - -[Part 1: Basic Concepts and Tools][1] - -[Part 2: Generating Your Master Key][2] - -[Part 3: Generating PGP Subkeys][3] - -[Part 4: Moving Your Master Key to Offline Storage][4] - -### Checklist - - * Get a GnuPG-compatible hardware device (NICE) - - * Configure the device to work with GnuPG (NICE) - - * Set the user and admin PINs (NICE) - - * Move your subkeys to the device (NICE) - - - - -### Considerations - -Even though the master key is now safe from being leaked or stolen, the subkeys are still in your home directory. Anyone who manages to get their hands on those will be able to decrypt your communication or fake your signatures (if they know the passphrase). Furthermore, each time a GnuPG operation is performed, the keys are loaded into system memory and can be stolen from there by sufficiently advanced malware (think Meltdown and Spectre). - -The best way to completely protect your keys is to move them to a specialized hardware device that is capable of smartcard operations. - -#### The benefits of smartcards - -A smartcard contains a cryptographic chip that is capable of storing private keys and performing crypto operations directly on the card itself. Because the key contents never leave the smartcard, the operating system of the computer into which you plug in the hardware device is not able to retrieve the private keys themselves. This is very different from the encrypted USB storage device we used earlier for backup purposes -- while that USB device is plugged in and decrypted, the operating system is still able to access the private key contents. Using external encrypted USB media is not a substitute to having a smartcard-capable device. - -Some other benefits of smartcards: - - * They are relatively cheap and easy to obtain - - * They are small and easy to carry with you - - * They can be used with multiple devices - - * Many of them are tamper-resistant (depends on manufacturer) - - - - -#### Available smartcard devices - -Smartcards started out embedded into actual wallet-sized cards, which earned them their name. You can still buy and use GnuPG-capable smartcards, and they remain one of the cheapest available devices you can get. However, actual smartcards have one important downside: they require a smartcard reader, and very few laptops come with one. - -For this reason, manufacturers have started providing small USB devices, the size of a USB thumb drive or smaller, that either have the microsim-sized smartcard pre-inserted, or that simply implement the smartcard protocol features on the internal chip. Here are a few recommendations: - - * [Nitrokey Start][5]: Open hardware and Free Software: one of the cheapest options for GnuPG use, but with fewest extra security features - - * [Nitrokey Pro][6]: Similar to the Nitrokey Start, but is tamper-resistant and offers more security features (but not U2F, see the Fido U2F section of the guide) - - * [Yubikey 4][7]: Proprietary hardware and software, but cheaper than Nitrokey Pro and comes available in the USB-C form that is more useful with newer laptops; also offers additional security features such as U2F - - - - -Our recommendation is to pick a device that is capable of both smartcard functionality and U2F, which, at the time of writing, means a Yubikey 4. - -#### Configuring your smartcard device - -Your smartcard device should Just Work (TM) the moment you plug it into any modern Linux or Mac workstation. You can verify it by running: -``` -$ gpg --card-status - -``` - -If you didn't get an error, but a full listing of the card details, then you are good to go. Unfortunately, troubleshooting all possible reasons why things may not be working for you is way beyond the scope of this guide. If you are having trouble getting the card to work with GnuPG, please seek support via your operating system's usual support channels. - -##### PINs don't have to be numbers - -Note, that despite having the name "PIN" (and implying that it must be a "number"), neither the user PIN nor the admin PIN on the card need to be numbers. - -Your device will probably have default user and admin PINs set up when it arrives. For Yubikeys, these are 123456 and 12345678, respectively. If those don't work for you, please check any accompanying documentation that came with your device. - -##### Quick setup - -To configure your smartcard, you will need to use the GnuPG menu system, as there are no convenient command-line switches: -``` -$ gpg --card-edit -[...omitted...] -gpg/card> admin -Admin commands are allowed -gpg/card> passwd - -``` - -You should set the user PIN (1), Admin PIN (3), and the Reset Code (4). Please make sure to record and store these in a safe place -- especially the Admin PIN and the Reset Code (which allows you to completely wipe the smartcard). You so rarely need to use the Admin PIN, that you will inevitably forget what it is if you do not record it. - -Getting back to the main card menu, you can also set other values (such as name, sex, login data, etc), but it's not necessary and will additionally leak information about your smartcard should you lose it. - -#### Moving the subkeys to your smartcard - -Exit the card menu (using "q") and save all changes. Next, let's move your subkeys onto the smartcard. You will need both your PGP key passphrase and the admin PIN of the card for most operations. Remember, that [fpr] stands for the full 40-character fingerprint of your key. -``` -$ gpg --edit-key [fpr] - -Secret subkeys are available. - -pub rsa4096/AAAABBBBCCCCDDDD - created: 2017-12-07 expires: 2019-12-07 usage: C - trust: ultimate validity: ultimate -ssb rsa2048/1111222233334444 - created: 2017-12-07 expires: never usage: E -ssb rsa2048/5555666677778888 - created: 2017-12-07 expires: never usage: S -[ultimate] (1). Alice Engineer -[ultimate] (2) Alice Engineer - -gpg> - -``` - -Using --edit-key puts us into the menu mode again, and you will notice that the key listing is a little different. From here on, all commands are done from inside this menu mode, as indicated by gpg>. - -First, let's select the key we'll be putting onto the card -- you do this by typing key 1 (it's the first one in the listing, our [E] subkey): -``` -gpg> key 1 - -``` - -The output should be subtly different: -``` -pub rsa4096/AAAABBBBCCCCDDDD - created: 2017-12-07 expires: 2019-12-07 usage: C - trust: ultimate validity: ultimate -ssb* rsa2048/1111222233334444 - created: 2017-12-07 expires: never usage: E -ssb rsa2048/5555666677778888 - created: 2017-12-07 expires: never usage: S -[ultimate] (1). Alice Engineer -[ultimate] (2) Alice Engineer - -``` - -Notice the * that is next to the ssb line corresponding to the key -- it indicates that the key is currently "selected." It works as a toggle, meaning that if you type key 1 again, the * will disappear and the key will not be selected any more. - -Now, let's move that key onto the smartcard: -``` -gpg> keytocard -Please select where to store the key: - (2) Encryption key -Your selection? 2 - -``` - -Since it's our [E] key, it makes sense to put it into the Encryption slot. When you submit your selection, you will be prompted first for your PGP key passphrase, and then for the admin PIN. If the command returns without an error, your key has been moved. - -**Important:** Now type key 1 again to unselect the first key, and key 2 to select the [S] key: -``` -gpg> key 1 -gpg> key 2 -gpg> keytocard -Please select where to store the key: - (1) Signature key - (3) Authentication key -Your selection? 1 - -``` - -You can use the [S] key both for Signature and Authentication, but we want to make sure it's in the Signature slot, so choose (1). Once again, if your command returns without an error, then the operation was successful. - -Finally, if you created an [A] key, you can move it to the card as well, making sure first to unselect key 2. Once you're done, choose "q": -``` -gpg> q -Save changes? (y/N) y - -``` - -Saving the changes will delete the keys you moved to the card from your home directory (but it's okay, because we have them in our backups should we need to do this again for a replacement smartcard). - -##### Verifying that the keys were moved - -If you perform --list-secret-keys now, you will see a subtle difference in the output: -``` -$ gpg --list-secret-keys -sec# rsa4096 2017-12-06 [C] [expires: 2019-12-06] - 111122223333444455556666AAAABBBBCCCCDDDD -uid [ultimate] Alice Engineer -uid [ultimate] Alice Engineer -ssb> rsa2048 2017-12-06 [E] -ssb> rsa2048 2017-12-06 [S] - -``` - -The > in the ssb> output indicates that the subkey is only available on the smartcard. If you go back into your secret keys directory and look at the contents there, you will notice that the .key files there have been replaced with stubs: -``` -$ cd ~/.gnupg/private-keys-v1.d -$ strings *.key - -``` - -The output should contain shadowed-private-key to indicate that these files are only stubs and the actual content is on the smartcard. - -#### Verifying that the smartcard is functioning - -To verify that the smartcard is working as intended, you can create a signature: -``` -$ echo "Hello world" | gpg --clearsign > /tmp/test.asc -$ gpg --verify /tmp/test.asc - -``` - -This should ask for your smartcard PIN on your first command, and then show "Good signature" after you run gpg --verify. - -Congratulations, you have successfully made it extremely difficult to steal your digital developer identity! - -### Other common GnuPG operations - -Here is a quick reference for some common operations you'll need to do with your PGP key. - -In all of the below commands, the [fpr] is your key fingerprint. - -#### Mounting your master key offline storage - -You will need your master key for any of the operations below, so you will first need to mount your backup offline storage and tell GnuPG to use it. First, find out where the media got mounted, for example, by looking at the output of the mount command. Then, locate the directory with the backup of your GnuPG directory and tell GnuPG to use that as its home: -``` -$ export GNUPGHOME=/media/disk/name/gnupg-backup -$ gpg --list-secret-keys - -``` - -You want to make sure that you see sec and not sec# in the output (the # means the key is not available and you're still using your regular home directory location). - -##### Updating your regular GnuPG working directory - -After you make any changes to your key using the offline storage, you will want to import these changes back into your regular working directory: -``` -$ gpg --export | gpg --homedir ~/.gnupg --import -$ unset GNUPGHOME - -``` - -#### Extending key expiration date - -The master key we created has the default expiration date of 2 years from the date of creation. This is done both for security reasons and to make obsolete keys eventually disappear from keyservers. - -To extend the expiration on your key by a year from current date, just run: -``` -$ gpg --quick-set-expire [fpr] 1y - -``` - -You can also use a specific date if that is easier to remember (e.g. your birthday, January 1st, or Canada Day): -``` -$ gpg --quick-set-expire [fpr] 2020-07-01 - -``` - -Remember to send the updated key back to keyservers: -``` -$ gpg --send-key [fpr] - -``` - -#### Revoking identities - -If you need to revoke an identity (e.g., you changed employers and your old email address is no longer valid), you can use a one-liner: -``` -$ gpg --quick-revoke-uid [fpr] 'Alice Engineer ' - -``` - -You can also do the same with the menu mode using gpg --edit-key [fpr]. - -Once you are done, remember to send the updated key back to keyservers: -``` -$ gpg --send-key [fpr] - -``` - -Next time, we'll look at how Git supports multiple levels of integration with PGP. - -Learn more about Linux through the free ["Introduction to Linux" ][8]course from The Linux Foundation and edX. - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-5-moving-subkeys-hardware-device - -作者:[KONSTANTIN RYABITSEV][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.linux.com/users/mricon -[1]:https://www.linux.com/blog/learn/2018/2/protecting-code-integrity-pgp-part-1-basic-pgp-concepts-and-tools -[2]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-2-generating-and-protecting-your-master-pgp-key -[3]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-3-generating-pgp-subkeys -[4]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-4-moving-your-master-key-offline-storage -[5]:https://shop.nitrokey.com/shop/product/nitrokey-start-6 -[6]:https://shop.nitrokey.com/shop/product/nitrokey-pro-3 -[7]:https://www.yubico.com/product/yubikey-4-series/ -[8]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux diff --git a/translated/tech/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md b/translated/tech/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md new file mode 100644 index 0000000000..8dadad1193 --- /dev/null +++ b/translated/tech/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md @@ -0,0 +1,304 @@ +用 PGP 保护代码完整性(五):将子密钥移到一个硬件设备中 +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/pgp-keys.jpg?itok=aS6IWGpq) + +在本系列教程中,我们将提供一个使用 PGP 的实用指南。如果你没有看过前面的文章,你可以通过下面的链接去查看。在这篇文章中,我们将继续讨论如何保护你的密钥,谈一谈将你的子密钥移到一个专门的硬件设备中的一些技巧。 + +[第一部分:基本概念和工具][1] + +[第二部分:生成你的主密钥][2] + +[第三部分:生成 PGP 子密钥][3] + +[第四部分:将主密钥移到离线存储中][4] + +### 清单 + + * 取得一个 GnuPG 兼容的硬件设备(必要) + + * 配置 GnuPG 在设备上工作(必要) + + * 设置 user 和 admin 的 PIN(必要) + + * 移动子密钥到设备中(必要) + + + + +### 考虑事项 + +虽然现在主密钥已经不用担心泄露或失窃了,但子密钥仍然在你的 Home 目录中。任何得到它的人都能够解密你的通讯或假冒你的签名(如果他们知道密钥的密码)。并且,每次执行一个 GnuPG 操作都要将密钥加载到操作系统内存中,这将使一些更高级的恶意软件有机会得到你的密钥(想想 Meltdown 和 Spectre)。 + +完全保护密钥的最好方式就是,将它移到一个专门的硬件设备中,这种硬件设备是一个可操作的智能卡。 + +#### 智能卡的好处 + +一个智能卡包含一个加密芯片,它能够存储私钥,并且直接在智能卡内部执行秘密操作。因为密钥内容从来没有离开过智能卡,计算机操作系统并不能检索你插入的智能卡上的私钥。这与前面用于备份目的的加密 USB 存储是不同的 —— 虽然 USB 设备也是插入并解密的,但操作系统是能够去访问私钥内容的。使用外置的加密 USB 介质并不能代替智能卡设备的功能。 + +智能卡的一些其它好处: + + * 它们很便宜且易于获得 + + * 它们小巧且易于携带 + + * 它们可以用于多种设备上 + + * 它们中的很多都具有防篡改功能(取决于制造商) + + + + +#### 可用的智能卡设备 + +智能卡最初是嵌入到真实钱包大小的卡中,故而得名智能卡。你总是可以买到并使用 GnuPG 功能的智能卡,并且它们是你能得到的最便宜的可用设备之一。但是,事实上智能卡有一个很重要的缺点:它们需要一个智能卡读卡器,只有极小数的笔记本电脑上有这种读卡器。 + +由于这个原因,制造商开始推出小型 USB 设备,它的大小和 U 盘类似,内置有微型智能卡,并且在芯片上简单地实现了智能卡协议特性。下面推荐几个这样的设备: + + * [Nitrokey Start][5]:开源硬件和自由软件,可用于 GnuPG 的最便宜的选择之一,但是额外的安全特性很少。 + + * [Nitrokey Pro][6]:类似于 Nitrokey Start,它提供防篡改及更多的安全特性(但没有 U2F,具体查看指南的 U2F 节)。 + + * [Yubikey 4][7]:专利硬件和软件,但比 Nitrokey Pro 便宜,并且可以用在最新的笔记本电脑上的 USB-C 接口;也提供像 U2F 这样的额外的安全特性。 + + + + +我们推荐选一个同时具备智能卡功能和 U2F 的设备,在写这篇文章时,只能选择 Yubikey 4。 + +#### 配置智能卡设备 + +你的智能卡设备插入任何一台现代的 Linux 或 Mac 工作站上都应该能正常工作。你可以通过运行如下的命令去验证它: +``` +$ gpg --card-status + +``` + +如果你没有收到错误,有一个完整的卡列表,就表示一切正常。不幸的是,排除为什么设备不能正常工作的所有可能原因,已经超出了本指南的范围。如果你的智能卡使用 GnuPG 时有问题,请通过你的操作系统的常见支持通道寻求支持。 + +##### PIN 不一定是数字 + +注意,尽管名为 “PIN”(暗示你它必须是一个“数字”),不论是 user PIN 还是 admin PIN 都不必非要是数字。 + +当你收到一个新设备时,它可能设置有一个默认的 user 和 admin PIN,对于 Yubikeys,它分别是 123456 和 12345678。如果它们的 PIN 不是默认的,请查看设备附带的说明书。 + +##### 快速设置 + +为配置你的智能卡,你需要使用 GnuPG 菜单系统,因此这里并没有更方便的命令行开关: +``` +$ gpg --card-edit +[...omitted...] +gpg/card> admin +Admin commands are allowed +gpg/card> passwd + +``` + +你应该去设置 user PIN (1)、admin PIN (3)、和 Reset Code (4)。请确保把它们记录并保存到一个安全的地方 —— 尤其是 Admin PIN 和 Reset Code(它允许你去擦除整个智能卡内容)。你很少使用到 Admin PIN,因此如果你不记录下来,很可能会忘掉它。 + +返回到智能卡主菜单,你也可以设置其它值(比如名字、性别、登入日期、等等),但是这些都不是必需的,一旦你的智能卡丢失了,将导致额外的信息泄露。 + +#### 将子密钥移到你的智能卡中 + +退出卡菜单(使用 “q” 命令)保存所有更改。接下来,我们将你的子密钥移到智能卡中。将需要用到你的 PGP 密钥的密码,在大多数的智能卡操作中都将用到 admin PIN。记住,那个 [fpr] 表示你的密钥的完整的 40 个字符的指纹。 +``` +$ gpg --edit-key [fpr] + +Secret subkeys are available. + +pub rsa4096/AAAABBBBCCCCDDDD + created: 2017-12-07 expires: 2019-12-07 usage: C + trust: ultimate validity: ultimate +ssb rsa2048/1111222233334444 + created: 2017-12-07 expires: never usage: E +ssb rsa2048/5555666677778888 + created: 2017-12-07 expires: never usage: S +[ultimate] (1). Alice Engineer +[ultimate] (2) Alice Engineer + +gpg> + +``` + +使用 --edit-key 再次进入到菜单模式,你将注意到那个密钥清单有一点小差别。从现在开始,所有的命令都是在这个菜单模式下运行,它用 gpg> 提示符来表示。 + +首先,我们来选择移到智能卡中的密钥 —— 你可以通过键入 `key 1`(它表示选择清单中的第一个密钥)来实现: +``` +gpg> key 1 + +``` + +这个输出会有一点细微的差别: +``` +pub rsa4096/AAAABBBBCCCCDDDD + created: 2017-12-07 expires: 2019-12-07 usage: C + trust: ultimate validity: ultimate +ssb* rsa2048/1111222233334444 + created: 2017-12-07 expires: never usage: E +ssb rsa2048/5555666677778888 + created: 2017-12-07 expires: never usage: S +[ultimate] (1). Alice Engineer +[ultimate] (2) Alice Engineer + +``` + +注意与密钥对应的 ssb 行旁边的 `*` —— 它表示这是当前选定的密钥。它是可切换的,意味着如果你再次输入 `key 1`,这个 `*` 将消失,这个密钥将不再被选中。 + +现在,我们来将密钥移到智能卡中: +``` +gpg> keytocard +Please select where to store the key: + (2) Encryption key +Your selection? 2 + +``` + +由于它是我们的 [E] 密钥,把它移到加密区中是有很有意义的。当你提交了你的选择之后,将会被提示输入你的 PGP 密钥的保护密码,接下来输入智能卡的 admin PIN。如果命令没有返回错误,表示你的密钥已经被移到智能卡中了。 + +**重要:** 现在再次输入 `key 1` 去取消选中第一个密钥,并输入 `key 2` 去选择 [S] 密钥: + +``` +gpg> key 1 +gpg> key 2 +gpg> keytocard +Please select where to store the key: + (1) Signature key + (3) Authentication key +Your selection? 1 + +``` + +你可以使用 [S] 密钥同时做签名和验证,但是我们希望确保它在签名区,因此,我们选择 (1)。完成后,如果你的命令没有返回错误,表示操作已成功。 + +最后,如果你创建了一个 [A] 密钥,你也可以将它移到智能卡中,但是你需要先取消选中 `key 2`。完成后,选择 “q": +``` +gpg> q +Save changes? (y/N) y + +``` + +保存变更将把你的子密钥移到智能卡后,把你的 Home 目录中的相应子密钥删除(没有关系,因为我们的备份中还有,如果更换了智能卡,你需要再做一遍)。 + +##### 验证移动后的密钥 + +现在,如果你执行一个` --list-secret-keys` 操作,你将看到一个稍有不同的输出: +``` +$ gpg --list-secret-keys +sec# rsa4096 2017-12-06 [C] [expires: 2019-12-06] + 111122223333444455556666AAAABBBBCCCCDDDD +uid [ultimate] Alice Engineer +uid [ultimate] Alice Engineer +ssb> rsa2048 2017-12-06 [E] +ssb> rsa2048 2017-12-06 [S] + +``` + +在 ssb> 的输出中的 `>` 表示子密钥仅在智能卡上有效。如果你进入到你的密钥目录中,查看目录的内容,你将会看到那个 `.key` 文件已经被存根替换: +``` +$ cd ~/.gnupg/private-keys-v1.d +$ strings *.key + +``` + +这个输出将包含一个影子私钥,它表示那个文件仅是个存根,真正的内容在智能卡中。 + +#### 验证智能卡的功能 + +验证智能卡能否如期正常运行,你可以通过创建一个签名来验证: +``` +$ echo "Hello world" | gpg --clearsign > /tmp/test.asc +$ gpg --verify /tmp/test.asc + +``` + +首次运行这个命令时将询问你智能卡的 PIN,在你运行 `gpg —verify` 之后,它将显示 "Good signature”。 + +祝贺你,你已经成功将窃取你的开发者数字身份变得更加困难了! + +### 其它常见 GnuPG 操作 + +下面是使用你的 PGP 密钥需要做的一些常见操作的快速指南。 + +在下面的所有命令中,[fpr] 表示你的密钥指纹。 + +#### 挂载主密钥离线存储 + +下面的一些操作将需要你的主密钥,因此首先需要去挂载你的主密钥离线存储,并告诉 GnuPG 去使用它。首先,找出介质挂载路径,可以通过查看 mount 命令的输出找到它。接着,设置你的 GnuPG 目录为你的介质上备份的目录,并告诉 GnuPG 将那个目录做为它的 Home: +``` +$ export GNUPGHOME=/media/disk/name/gnupg-backup +$ gpg --list-secret-keys + +``` + +确保你在输出中看到的是 `sec` 而不是 `sec#`(这个 `#` 表示密钥不可用,仍然使用的是惯常的那个 Home 目录)。 + +##### 更新你惯常使用的那个 GnuPG 工作目录 + +在你的离线存储上做了任何更改之后,你应该将这些更改同步应用到你惯常使用的工作目录中: +``` +$ gpg --export | gpg --homedir ~/.gnupg --import +$ unset GNUPGHOME + +``` + +#### 延长密钥过期日期 + +我们创建的主密钥的默认过期日期是自创建之日起两年后。这样做都是为安全考虑,这样将使淘汰密钥最终从密钥服务器上消失。 + +延长你的密钥过期日期,从当前日期延长一年,只需要运行如下命令: +``` +$ gpg --quick-set-expire [fpr] 1y + +``` + +如果为了好记住,你也可以使用一个特定日期(比如,你的生日、1 月 1 日、或加拿大国庆日): +``` +$ gpg --quick-set-expire [fpr] 2020-07-01 + +``` + +记得将更新后的密钥发送到密钥服务器: +``` +$ gpg --send-key [fpr] + +``` + +#### 吊销身份 + +如果你需要吊销一个身份(比如,你换了雇主并且旧的邮件地址不再有效了),你可以使用一行命令搞定: +``` +$ gpg --quick-revoke-uid [fpr] 'Alice Engineer ' + +``` + +你也可以通过使用 `gpg --edit-key [fpr]` 在菜单模式下完成同样的事情。 + +完成后,记得将更新后的密钥发送到密钥服务器上: +``` +$ gpg --send-key [fpr] + +``` + +下一篇文章中,我们将谈谈 Git 如何支持 PGP 的多级别集成。 + +通过来自 Linux 基金会和 edX 的免费课程 [“Linux 入门" ][8]学习更多 Linux 知识。 + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-5-moving-subkeys-hardware-device + +作者:[KONSTANTIN RYABITSEV][a] +译者:[qhwdw](https://github.com/qhwdw) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.linux.com/users/mricon +[1]:https://www.linux.com/blog/learn/2018/2/protecting-code-integrity-pgp-part-1-basic-pgp-concepts-and-tools +[2]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-2-generating-and-protecting-your-master-pgp-key +[3]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-3-generating-pgp-subkeys +[4]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-4-moving-your-master-key-offline-storage +[5]:https://shop.nitrokey.com/shop/product/nitrokey-start-6 +[6]:https://shop.nitrokey.com/shop/product/nitrokey-pro-3 +[7]:https://www.yubico.com/product/yubikey-4-series/ +[8]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux From 094a0a8c8cc37d0748475fe4d422d4018feabf34 Mon Sep 17 00:00:00 2001 From: qhwdw Date: Sat, 22 Dec 2018 21:35:28 +0800 Subject: [PATCH 010/322] Translating by qhwdw --- ...cting Code Integrity with PGP - Part 6- Using PGP with Git.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md b/sources/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md index 0169d96ad6..d0de1b6c0f 100644 --- a/sources/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md +++ b/sources/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md @@ -1,3 +1,4 @@ +Translating by qhwdw Protecting Code Integrity with PGP — Part 6: Using PGP with Git ====== From 7d5b9e753274aab22f31187b8fd2d99ed9ca0099 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 23 Dec 2018 15:12:44 +0800 Subject: [PATCH 011/322] PRF:20181205 Bash Variables- Environmental and Otherwise.md @HankChow --- ... Variables- Environmental and Otherwise.md | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/translated/tech/20181205 Bash Variables- Environmental and Otherwise.md b/translated/tech/20181205 Bash Variables- Environmental and Otherwise.md index c6786eef15..952300bbb4 100644 --- a/translated/tech/20181205 Bash Variables- Environmental and Otherwise.md +++ b/translated/tech/20181205 Bash Variables- Environmental and Otherwise.md @@ -1,28 +1,30 @@ Bash 环境变量的那些事 ====== +> 初学者可以在此教程中了解环境变量。 + ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/wynand-van-poortvliet-40467-unsplash.jpg?itok=tr6Eb4N0) -bash 变量,尤其是讨厌的环境变量,已经是一个老生常谈的话题了。我们也更应该对它有一个详细的了解,让它为我们所用。 +bash 变量,尤其是讨厌的*环境变量*,已经是一个老生常谈的话题了。我们也更应该对它有一个详细的了解,让它为我们所用。 下面就打开终端,开始吧。 ### 环境变量 -`HOME` 除了是你脱下帽子惬意休息的地方,同时也是 Linux 中的一个变量,它是当前用户主目录的路径: +`HOME` (LCTT 译注:双关语)除了是你脱下帽子惬意休息的地方,同时也是 Linux 中的一个变量,它是当前用户主目录的路径: ``` echo $HOME ``` -以上这个命令会显示当前用户的主目录路径,通常都在 `/home/` 下。 +以上这个命令会显示当前用户的主目录路径,通常都在 `/home/` 下。 -顾名思义,一个变量的值并不是固定的。实际上,Linux 系统中每一个用户的 `HOME` 变量都是不一样的,当然你也可以这样自行更改 `HOME` 变量的值: +顾名思义,变量的值是可以根据上下文变化的。实际上,Linux 系统中每一个用户的 `HOME` 变量都是不一样的,当然你也可以这样自行更改 `HOME` 变量的值: ``` HOME=/home//Documents ``` -以上这个命令将会把 `HOME` 变量设置为 `/home//Documents` 目录。 +以上这个命令将会把 `HOME` 变量设置为你的 `Documents` 目录。 其中有三点需要留意: @@ -45,7 +47,7 @@ $ echo $PATH /usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin ``` -每两个目录之间使用冒号(`:`)分隔。如果某个应用程序的所在目录不在 `PATH` 变量中,那么运行的时候就需要声明应用程序的目录让 shell 能够找到。 +每两个目录之间使用冒号 `:` 分隔。如果某个应用程序的所在目录不在 `PATH` 变量中,那么运行的时候就需要声明应用程序的目录让 shell 能够找到。 ``` /home//bin/my_program.sh @@ -67,9 +69,9 @@ PATH=$PATH:$HOME/bin 然后 `/home//bin/` 目录就会出现在 `PATH` 变量中了。但正如之前所说,这个变更只会在当前的 shell 生效,当前的 shell 一旦关闭,环境变量的值就又恢复原状了。 -如果要让变更对当前用户持续生效,就不能在 shell 中直接执行对应的变更,而是应该将这些变更操作卸载每次启动 shell 时都会运行的文件当中。这个文件就是当前用户主目录中的 `.bashrc` 文件。文件名前面的点号表明这是一个隐藏文件,执行普通的 `ls` 命令是不会将这个文件显示出来的,但只要在 `ls` 命令中加入 `-a` 参数就可以看到这个文件了。 +如果要让变更对当前用户持续生效,就不能在 shell 中直接执行对应的变更,而是应该将这些变更操作写在每次启动 shell 时都会运行的文件当中。这个文件就是当前用户主目录中的 `.bashrc` 文件。文件名前面的点号表明这是一个隐藏文件,执行普通的 `ls` 命令是不会将这个文件显示出来的,但只要在 `ls` 命令中加入 `-a` 参数就可以看到这个文件了。 -你可以使用诸如 [kate][1]、[gedit][2]、[nano][3] 或者 [vim][4] 这些文本编辑器来打开 `.bashrc` 文件(但不要用 LibreOffice Writer,它是一个文字处理软件,跟前面几个文字编辑器并不一个量级的东西)。打开 `.bashrc` 文件之后,你会看见里面放置了一些 shell 命令,是用于为当前用户设置环境的。 +你可以使用诸如 [kate][1]、[gedit][2]、[nano][3] 或者 [vim][4] 这些文本编辑器来打开 `.bashrc` 文件(但不要用 LibreOffice Writer,它是一个文字处理软件,跟前面几个文字编辑器完全不同)。打开 `.bashrc` 文件之后,你会看见里面放置了一些 shell 命令,是用于为当前用户设置环境的。 在文件的末尾添加新行并输入以下内容: @@ -97,13 +99,13 @@ source .bashrc new_variable="Hello" ``` -然后可以用一下的方式读取到已定义变量的值: +然后可以用以下的方式读取到已定义变量的值: ``` echo $new_variable ``` -程序的正常工作离不开各种变量,例如要将某个选项设置为 on,又或者让程序找到所需的代码库,都需要使用变量。在 bash 中运行程序的时候会生成一个子 shell,这个子 shell 和执行原程序的父 shell 并不是完全一样的,只是继承了父 shell 的部分内容,而且默认是不继承父 shell 中的变量的。因为变量默认情况下是局部变量,出于安全原因,一个 shell 中的局部变量不会被另一个 shell 读取到,即使是子 shell 也不可以。 +程序的正常工作离不开各种变量,例如要将某个选项设置为打开,又或者让程序找到所需的代码库,都需要使用变量。在 bash 中运行程序的时候会生成一个子 shell,这个子 shell 和执行原程序的父 shell 并不是完全一样的,只是继承了父 shell 的部分内容,而且默认是不继承父 shell 中的变量的。因为变量默认情况下是局部变量,出于安全原因,一个 shell 中的局部变量不会被另一个 shell 读取到,即使是子 shell 也不可以。 下面举一个例子。首先定义一个变量: @@ -198,7 +200,7 @@ via: https://www.linux.com/blog/learn/2018/12/bash-variables-environmental-and-o 作者:[Paul Brown][a] 选题:[lujun9972][b] 译者:[HankChow](https://github.com/HankChow) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 43535b61e5c30e20ff0bb28a74bdff9e293590c3 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 23 Dec 2018 15:15:30 +0800 Subject: [PATCH 012/322] PUB:20181205 Bash Variables- Environmental and Otherwise.md @HankChow https://linux.cn/article-10374-1.html --- .../20181205 Bash Variables- Environmental and Otherwise.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20181205 Bash Variables- Environmental and Otherwise.md (100%) diff --git a/translated/tech/20181205 Bash Variables- Environmental and Otherwise.md b/published/20181205 Bash Variables- Environmental and Otherwise.md similarity index 100% rename from translated/tech/20181205 Bash Variables- Environmental and Otherwise.md rename to published/20181205 Bash Variables- Environmental and Otherwise.md From 37d608098239f29b1b25b9a70b8b8a930c7b2a45 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 23 Dec 2018 15:36:44 +0800 Subject: [PATCH 013/322] PRF:20180717 11 Uses for a Raspberry Pi Around the Office.md @geekpi --- ...es for a Raspberry Pi Around the Office.md | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/translated/tech/20180717 11 Uses for a Raspberry Pi Around the Office.md b/translated/tech/20180717 11 Uses for a Raspberry Pi Around the Office.md index 88e7fbd86a..e5cb91b108 100644 --- a/translated/tech/20180717 11 Uses for a Raspberry Pi Around the Office.md +++ b/translated/tech/20180717 11 Uses for a Raspberry Pi Around the Office.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (11 Uses for a Raspberry Pi Around the Office) @@ -12,9 +12,9 @@ 我知道你在想什么:树莓派只能用在修修补补、原型设计和个人爱好中。它实际不能用在业务中。 -毫无疑问,这台电脑的处理能力相对较低、易损坏的 SD 卡、缺乏电池备份以及支持的 DIY 性质,这意味着它不会是一个能在任何时候执行最关键的操作的[专业的已安装和已配置的商业服务器][1]的可行替代,。 +毫无疑问,这台电脑的处理能力相对较低、易损坏的 SD 卡、缺乏电池备份以及支持的 DIY 性质,这意味着它不会是一个能在任何时候执行最关键的操作的[专业的、已安装好、配置好的商业服务器][1]的可行替代品。 -但是它电路板便宜、功耗很小、很小几乎适合任何地方、无限灵活 - 这实际上是处理办公室一些基本任务的好方法。 +但是它电路板便宜、功耗很小、小到几乎适合任何地方、无限灵活 —— 这实际上是处理办公室一些基本任务的好方法。 而且,更好的是,已经有一些人完成了这些项目并很乐意分享他们是如何做到的。 @@ -22,11 +22,11 @@ 每次在浏览器中输入网站地址或者点击链接时,都需要将域名转换为数字 IP 地址,然后才能显示内容。 -通常这意味着向互联网上某处 DNS 服务器发出请求 - 但你可以通过本地处理来加快浏览速度。 +通常这意味着向互联网上某处 DNS 服务器发出请求 —— 但你可以通过本地处理来加快浏览速度。 你还可以分配自己的子域,以便本地访问办公室中的计算机。 -[这里是如何让这它工作。][2] +[这里了解它是如何工作的。][2] ### 厕所占用标志 @@ -34,37 +34,37 @@ 这对于那些等待的人来说很烦人,花在处理它上面的时间会耗费你在办公室的工作效率。 -我想你希望在办公室里也悬挂飞机上有的标志。 +我想你希望在办公室里也悬挂飞机上那个厕所有人的标志。 -[Occu-pi][3] 是一个更简单的解决方案,使用磁性开关和树莓派来判断螺栓何时关闭并在 Slack 频道中更新厕所在使用中 - 这意味着整个办公室的人都可以看一眼电脑或者移动设备知道是否有空闲的隔间。 +[Occu-pi][3] 是一个非常简单的解决方案,使用磁性开关和树莓派来判断螺栓何时关闭,并在 Slack 频道中更新“厕所在使用中” —— 这意味着整个办公室的人都可以看一眼电脑或者移动设备知道是否有空闲的隔间。 ### 针对黑客的蜜罐陷阱 黑客破坏了网络的第一个线索是一些事情变得糟糕,这应该会吓到大多数企业主。 -这就是可以用到蜜罐的地方:一台没有任何服务的计算机位于你的网络,将特定端口打开伪装成黑客喜欢的目标。 +这就是可以用到蜜罐的地方:一台没有任何服务的计算机位于你的网络,将特定端口打开,伪装成黑客喜欢的目标。 安全研究人员经常在网络外部部署蜜罐,以收集攻击者正在做的事情的数据。 但对于普通的小型企业来说,这些作为一种绊脚石部署在内部更有用。因为普通用户没有真正的理由想要连接到蜜罐,所以任何发生的登录尝试都是正在进行捣乱的非常好的指示。 -这可以提供对外部人员入侵的预警,并且可信赖的内部人员也没有任何好处。 +这可以提供对外部人员入侵的预警,并且也可以提供对值得信赖的内部人员的预警。 -在较大的客户端/服务器网络中,将它作为虚拟机运行可能更为实际。但是在无线路由器上运行的点对点的小型办公室/家庭办公网络中,[HoneyPi][4] 之类的东西是一个很小的防盗报警器。 +在较大的客户端/服务器网络中,将它作为虚拟机运行可能更为实用。但是在无线路由器上运行的点对点的小型办公室/家庭办公网络中,[HoneyPi][4] 之类的东西是一个很小的防盗报警器。 ### 打印服务器 -网络连接的打印机更方便。 +联网打印机更方便。 -但更换所有打印机可能会很昂贵 - 特别是如果你对它们感到满意的话。 +但更换所有打印机可能会很昂贵 —— 特别是如果你对现有的打印机感到满意的话。 [将树莓派设置为打印服务器][5]可能会更有意义。 -### 网络附加存储 (NAS) +### 网络附加存储(NAS) 将硬盘变为 NAS 是树莓派最早的实际应用之一,并且它仍然是最好的之一。 -[这是如何使用树莓派创建NAS。][6] +[这是如何使用树莓派创建 NAS。][6] ### 工单服务器 @@ -74,13 +74,13 @@ ### 数字标牌 -无论是用于活动、广告、菜单还是其他任何东西,许多企业都需要一种显示数字标牌的方式 - 而树莓派的廉价和省电使其成为一个非常有吸引力的选择。 +无论是用于活动、广告、菜单还是其他任何东西,许多企业都需要一种显示数字标牌的方式 —— 而树莓派的廉价和省电使其成为一个非常有吸引力的选择。 [这有很多可供选择的选项。] [8] ### 目录和信息亭 -[FullPageOS][9] 是一个基于 Raspbian 的 Linux 发行版,它直接引导到 Chromium 的全屏版本 - 这非常适合导购、图书馆目录等。 +[FullPageOS][9] 是一个基于 Raspbian 的 Linux 发行版,它直接引导到 Chromium 的全屏版本 —— 这非常适合导购、图书馆目录等。 ### 基本的内联网 Web 服务器 @@ -96,7 +96,7 @@ Kali Linux 是专为探测网络安全漏洞而构建的操作系统。通过将 [你可以在这里找到树莓派镜像的种子链接。][11] -绝对小心只在你自己的网络或你有权对它安全审计的网络中使用它 - 使用此方法来破解其他网络是严重的犯罪行为。 +绝对要小心只在你自己的网络或你有权对它安全审计的网络中使用它 —— 使用此方法来破解其他网络是严重的犯罪行为。 ### VPN 服务器 @@ -104,15 +104,15 @@ Kali Linux 是专为探测网络安全漏洞而构建的操作系统。通过将 你可以订阅任意数量的商业 VPN 服务,并且你可以在云中安装自己的服务,但是在办公室运行一个 VPN,这样你也可以从任何地方访问本地网络。 -对于轻度使用 - 比如偶尔的商务旅行 - 树莓派是一种强大的,节约能源的设置 VPN 服务器的方式。(首先要检查一下你的路由器是不是不支持这个功能,许多路由器是支持的。) +对于轻度使用 —— 比如偶尔的商务旅行 —— 树莓派是一种强大的,节约能源的设置 VPN 服务器的方式。(首先要检查一下你的路由器是不是不支持这个功能,许多路由器是支持的。) [这是如何在树莓派上安装 OpenVPN。][12] ### 无线咖啡机 -啊,美味:美味的饮料还是公司内工作效率的支柱。 +啊,美味:好喝的饮料是神赐之物,也是公司内工作效率的支柱。 -那么, 为什么不[将办公室的咖啡机变成可以精确控制温度和无线连接的智能咖啡机呢?][13] +那么,为什么不[将办公室的咖啡机变成可以精确控制温度和无线连接的智能咖啡机呢?][13] -------------------------------------------------------------------------------- @@ -121,7 +121,7 @@ via: https://blog.dxmtechsupport.com.au/11-uses-for-a-raspberry-pi-around-the-of 作者:[James Mawson][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -139,4 +139,4 @@ via: https://blog.dxmtechsupport.com.au/11-uses-for-a-raspberry-pi-around-the-of [10]: https://maker.pro/raspberry-pi/projects/raspberry-pi-web-server [11]: https://www.offensive-security.com/kali-linux-arm-images/ [12]: https://medium.freecodecamp.org/running-your-own-openvpn-server-on-a-raspberry-pi-8b78043ccdea -[13]: https://www.techradar.com/au/how-to/how-to-build-your-own-smart-coffee-machine \ No newline at end of file +[13]: https://www.techradar.com/au/how-to/how-to-build-your-own-smart-coffee-machine From e62b11d81ddb3ebabb66b9b537bd5544c3e3023e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 23 Dec 2018 15:37:25 +0800 Subject: [PATCH 014/322] PUB:20180717 11 Uses for a Raspberry Pi Around the Office.md @geekpi https://linux.cn/article-10375-1.html --- .../20180717 11 Uses for a Raspberry Pi Around the Office.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20180717 11 Uses for a Raspberry Pi Around the Office.md (99%) diff --git a/translated/tech/20180717 11 Uses for a Raspberry Pi Around the Office.md b/published/20180717 11 Uses for a Raspberry Pi Around the Office.md similarity index 99% rename from translated/tech/20180717 11 Uses for a Raspberry Pi Around the Office.md rename to published/20180717 11 Uses for a Raspberry Pi Around the Office.md index e5cb91b108..cb5b51fe98 100644 --- a/translated/tech/20180717 11 Uses for a Raspberry Pi Around the Office.md +++ b/published/20180717 11 Uses for a Raspberry Pi Around the Office.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10375-1.html) [#]: subject: (11 Uses for a Raspberry Pi Around the Office) [#]: via: (https://blog.dxmtechsupport.com.au/11-uses-for-a-raspberry-pi-around-the-office/) [#]: author: (James Mawson https://blog.dxmtechsupport.com.au/author/james-mawson/) From 6ab2e0d4518025ade17db9302932cfd4cb448e11 Mon Sep 17 00:00:00 2001 From: qhwdw Date: Sun, 23 Dec 2018 16:52:51 +0800 Subject: [PATCH 015/322] Translated by qhwdw --- ...y with PGP - Part 6- Using PGP with Git.md | 319 ------------------ ...y with PGP - Part 6- Using PGP with Git.md | 318 +++++++++++++++++ 2 files changed, 318 insertions(+), 319 deletions(-) delete mode 100644 sources/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md create mode 100644 translated/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md diff --git a/sources/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md b/sources/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md deleted file mode 100644 index d0de1b6c0f..0000000000 --- a/sources/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md +++ /dev/null @@ -1,319 +0,0 @@ -Translating by qhwdw -Protecting Code Integrity with PGP — Part 6: Using PGP with Git -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/global-network.jpg?itok=h_hhZc36) -In this tutorial series, we're providing practical guidelines for using PGP, including basic concepts and generating and protecting your keys. If you missed the previous articles, you can catch up below. In this article, we look at Git's integration with PGP, starting with signed tags, then introducing signed commits, and finally adding support for signed pushes. - -[Part 1: Basic Concepts and Tools][1] - -[Part 2: Generating Your Master Key][2] - -[Part 3: Generating PGP Subkeys][3] - -[Part 4: Moving Your Master Key to Offline Storage][4] - -[Part 5: Moving Subkeys to a Hardware Device][5] - -One of the core features of Git is its decentralized nature -- once a repository is cloned to your system, you have full history of the project, including all of its tags, commits and branches. However, with hundreds of cloned repositories floating around, how does anyone verify that the repository you downloaded has not been tampered with by a malicious third party? You may have cloned it from GitHub or some other official-looking location, but what if someone had managed to trick you? - -Or what happens if a backdoor is discovered in one of the projects you've worked on, and the "Author" line in the commit says it was done by you, while you're pretty sure you had [nothing to do with it][6]? - -To address both of these issues, Git introduced PGP integration. Signed tags prove the repository integrity by assuring that its contents are exactly the same as on the workstation of the developer who created the tag, while signed commits make it nearly impossible for someone to impersonate you without having access to your PGP keys. - -### Checklist - - * Understand signed tags, commits, and pushes (ESSENTIAL) - - * Configure git to use your key (ESSENTIAL) - - * Learn how tag signing and verification works (ESSENTIAL) - - * Configure git to always sign annotated tags (NICE) - - * Learn how commit signing and verification works (ESSENTIAL) - - * Configure git to always sign commits (NICE) - - * Configure gpg-agent options (ESSENTIAL) - - - - -### Considerations - -Git implements multiple levels of integration with PGP, first starting with signed tags, then introducing signed commits, and finally adding support for signed pushes. - -#### Understanding Git Hashes - -Git is a complicated beast, but you need to know what a "hash" is in order to have a good grasp on how PGP integrates with it. We'll narrow it down to two kinds of hashes: tree hashes and commit hashes. - -##### Tree hashes - -Every time you commit a change to a repository, git records checksum hashes of all objects in it -- contents (blobs), directories (trees), file names and permissions, etc, for each subdirectory in the repository. It only does this for trees and blobs that have changed with each commit, so as not to re-checksum the entire tree unnecessarily if only a small part of it was touched. - -Then it calculates and stores the checksum of the toplevel tree, which will inevitably be different if any part of the repository has changed. - -##### Commit hashes - -Once the tree hash has been created, git will calculate the commit hash, which will include the following information about the repository and the change being made: - - * The checksum hash of the tree - - * The checksum hash of the tree before the change (parent) - - * Information about the author (name, email, time of authorship) - - * Information about the committer (name, email, time of commit) - - * The commit message - - - - -##### Hashing function - -At the time of writing, git still uses the SHA1 hashing mechanism to calculate checksums, though work is under way to transition to a stronger algorithm that is more resistant to collisions. Note, that git already includes collision avoidance routines, so it is believed that a successful collision attack against git remains impractical. - -#### Annotated tags and tag signatures - -Git tags allow developers to mark specific commits in the history of each git repository. Tags can be "lightweight" \-- more or less just a pointer at a specific commit, or they can be "annotated," which becomes its own object in the git tree. An annotated tag object contains all of the following information: - - * The checksum hash of the commit being tagged - - * The tag name - - * Information about the tagger (name, email, time of tagging) - - * The tag message - - - - -A PGP-signed tag is simply an annotated tag with all these entries wrapped around in a PGP signature. When a developer signs their git tag, they effectively assure you of the following: - - * Who they are (and why you should trust them) - - * What the state of their repository was at the time of signing: - - * The tag includes the hash of the commit - - * The commit hash includes the hash of the toplevel tree - - * Which includes hashes of all files, contents, and subtrees - * It also includes all information about authorship - - * Including exact times when changes were made - - - - -When you clone a git repository and verify a signed tag, that gives you cryptographic assurance that all contents in the repository, including all of its history, are exactly the same as the contents of the repository on the developer's computer at the time of signing. - -#### Signed commits - -Signed commits are very similar to signed tags -- the contents of the commit object are PGP-signed instead of the contents of the tag object. A commit signature also gives you full verifiable information about the state of the developer's tree at the time the signature was made. Tag signatures and commit PGP signatures provide exact same security assurances about the repository and its entire history. - -#### Signed pushes - -This is included here for completeness' sake, since this functionality needs to be enabled on the server receiving the push before it does anything useful. As we saw above, PGP-signing a git object gives verifiable information about the developer's git tree, but not about their intent for that tree. - -For example, you can be working on an experimental branch in your own git fork trying out a promising cool feature, but after you submit your work for review, someone finds a nasty bug in your code. Since your commits are properly signed, someone can take the branch containing your nasty bug and push it into master, introducing a vulnerability that was never intended to go into production. Since the commit is properly signed with your key, everything looks legitimate and your reputation is questioned when the bug is discovered. - -Ability to require PGP-signatures during git push was added in order to certify the intent of the commit, and not merely verify its contents. - -#### Configure git to use your PGP key - -If you only have one secret key in your keyring, then you don't really need to do anything extra, as it becomes your default key. - -However, if you happen to have multiple secret keys, you can tell git which key should be used ([fpr] is the fingerprint of your key): -``` -$ git config --global user.signingKey [fpr] - -``` - -NOTE: If you have a distinct gpg2 command, then you should tell git to always use it instead of the legacy gpg from version 1: -``` -$ git config --global gpg.program gpg2 - -``` - -#### How to work with signed tags - -To create a signed tag, simply pass the -s switch to the tag command: -``` -$ git tag -s [tagname] - -``` - -Our recommendation is to always sign git tags, as this allows other developers to ensure that the git repository they are working with has not been maliciously altered (e.g. in order to introduce backdoors). - -##### How to verify signed tags - -To verify a signed tag, simply use the verify-tag command: -``` -$ git verify-tag [tagname] - -``` - -If you are verifying someone else's git tag, then you will need to import their PGP key. Please refer to the "Trusted Team communication" document in the same repository for guidance on this topic. - -##### Verifying at pull time - -If you are pulling a tag from another fork of the project repository, git should automatically verify the signature at the tip you're pulling and show you the results during the merge operation: -``` -$ git pull [url] tags/sometag - -``` - -The merge message will contain something like this: -``` -Merge tag 'sometag' of [url] - -[Tag message] - -# gpg: Signature made [...] -# gpg: Good signature from [...] - -``` - -#### Configure git to always sign annotated tags - -Chances are, if you're creating an annotated tag, you'll want to sign it. To force git to always sign annotated tags, you can set a global configuration option: -``` -$ git config --global tag.forceSignAnnotated true - -``` - -Alternatively, you can just train your muscle memory to always pass the -s switch: -``` -$ git tag -asm "Tag message" tagname - -``` - -#### How to work with signed commits - -It is easy to create signed commits, but it is much more difficult to incorporate them into your workflow. Many projects use signed commits as a sort of "Committed-by:" line equivalent that records code provenance -- the signatures are rarely verified by others except when tracking down project history. In a sense, signed commits are used for "tamper evidence," and not to "tamper-proof" the git workflow. - -To create a signed commit, you just need to pass the -S flag to the git commit command (it's capital -S due to collision with another flag): -``` -$ git commit -S - -``` - -Our recommendation is to always sign commits and to require them of all project members, regardless of whether anyone is verifying them (that can always come at a later time). - -##### How to verify signed commits - -To verify a single commit you can use verify-commit: -``` -$ git verify-commit [hash] - -``` - -You can also look at repository logs and request that all commit signatures are verified and shown: -``` -$ git log --pretty=short --show-signature - -``` - -##### Verifying commits during git merge - -If all members of your project sign their commits, you can enforce signature checking at merge time (and then sign the resulting merge commit itself using the -S flag): -``` -$ git merge --verify-signatures -S merged-branch - -``` - -Note, that the merge will fail if there is even one commit that is not signed or does not pass verification. As it is often the case, technology is the easy part -- the human side of the equation is what makes adopting strict commit signing for your project difficult. - -##### If your project uses mailing lists for patch management - -If your project uses a mailing list for submitting and processing patches, then there is little use in signing commits, because all signature information will be lost when sent through that medium. It is still useful to sign your commits, just so others can refer to your publicly hosted git trees for reference, but the upstream project receiving your patches will not be able to verify them directly with git. - -You can still sign the emails containing the patches, though. - -#### Configure git to always sign commits - -You can tell git to always sign commits: -``` -git config --global commit.gpgSign true - -``` - -Or you can train your muscle memory to always pass the -S flag to all git commit operations (this includes --amend). - -#### Configure gpg-agent options - -The GnuPG agent is a helper tool that will start automatically whenever you use the gpg command and run in the background with the purpose of caching the private key passphrase. This way you only have to unlock your key once to use it repeatedly (very handy if you need to sign a bunch of git operations in an automated script without having to continuously retype your passphrase). - -There are two options you should know in order to tweak when the passphrase should be expired from cache: - - * default-cache-ttl (seconds): If you use the same key again before the time-to-live expires, the countdown will reset for another period. The default is 600 (10 minutes). - - * max-cache-ttl (seconds): Regardless of how recently you've used the key since initial passphrase entry, if the maximum time-to-live countdown expires, you'll have to enter the passphrase again. The default is 30 minutes. - - - - -If you find either of these defaults too short (or too long), you can edit your ~/.gnupg/gpg-agent.conf file to set your own values: -``` -# set to 30 minutes for regular ttl, and 2 hours for max ttl -default-cache-ttl 1800 -max-cache-ttl 7200 - -``` - -##### Bonus: Using gpg-agent with ssh - -If you've created an [A] (Authentication) key and moved it to the smartcard, you can use it with ssh for adding 2-factor authentication for your ssh sessions. You just need to tell your environment to use the correct socket file for talking to the agent. - -First, add the following to your ~/.gnupg/gpg-agent.conf: -``` -enable-ssh-support - -``` - -Then, add this to your .bashrc: -``` -export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) - -``` - -You will need to kill the existing gpg-agent process and start a new login session for the changes to take effect: -``` -$ killall gpg-agent -$ bash -$ ssh-add -L - -``` - -The last command should list the SSH representation of your PGP Auth key (the comment should say cardno:XXXXXXXX at the end to indicate it's coming from the smartcard). - -To enable key-based logins with ssh, just add the ssh-add -L output to ~/.ssh/authorized_keys on remote systems you log in to. Congratulations, you've just made your ssh credentials extremely difficult to steal. - -As a bonus, you can get other people's PGP-based ssh keys from public keyservers, should you need to grant them ssh access to anything: -``` -$ gpg --export-ssh-key [keyid] - -``` - -This can come in super handy if you need to allow developers access to git repositories over ssh. Next time, we'll provide tips for protecting your email accounts as well as your PGP keys. - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-6-using-pgp-git - -作者:[KONSTANTIN RYABITSEV][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.linux.com/users/mricon -[1]:https://www.linux.com/blog/learn/2018/2/protecting-code-integrity-pgp-part-1-basic-pgp-concepts-and-tools -[2]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-2-generating-and-protecting-your-master-pgp-key -[3]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-3-generating-pgp-subkeys -[4]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-4-moving-your-master-key-offline-storage -[5]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-5-moving-subkeys-hardware-device -[6]:https://github.com/jayphelps/git-blame-someone-else diff --git a/translated/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md b/translated/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md new file mode 100644 index 0000000000..ba010bb0ec --- /dev/null +++ b/translated/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md @@ -0,0 +1,318 @@ +保护代码完整性(六):在 Git 上使用 PGP +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/global-network.jpg?itok=h_hhZc36) +在本系列教程中,我们提供了一个使用 PGP 的实用指南,包括基本概念和工具、生成和保护你的密钥。如果你错过了前面的文章,你可以查看下面的链接。在这篇文章中,我们谈一谈在 Git 中如何集成 PGP、使用签名的标签,然后介绍签名提交,最后添加签名推送的支持。 + +[第一部分:基本概念和工具][1] + +[第二部分:生成你的主密钥][2] + +[第三部分:生成 PGP 子密钥][3] + +[第四部分:将主密钥移到离线存储中][4] + +[第五部分:将子密钥移到硬件设备中][5] + +Git 的核心特性之一就是它的去中心化本质 —— 一旦仓库克隆到你的本地系统,你就拥有了项目的完整历史,包括所有的标签、提交和分支。然而由于存在着成百上千的克隆仓库,如何才能验证你下载的仓库没有被恶意的第三方做过篡改?你可以从 GitHub 或一些貌似官方的位置来克隆它们,但是如果有些人故意欺骗了你怎么办? + +或者在你参与的一些项目上发现了后门,而 "Author" 行显示是你干的,然而你很确定 [不是你干的][6],会发生什么情况? + +为解决上述问题,Git 添加了 PGP 集成。签名的标签通过确认它的内容与创建这个标签的开发者的工作站上的内容完全一致来证明仓库的完整性,而签名的提交几乎是不可能在不访问你的 PGP 密钥的情况下能够假冒你。 + +### 清单 + + * 了解签名的标签、提交、和推送(必要) + + * 配置 git 使用你的密钥(必要) + + * 学习如何签名标签和验证工作(必要) + + * 配置 git 总是签名注释的标签(推荐) + + * 学习如何签名提交和验证工作(必要) + + * 配置 git 总是签名提交(推荐) + + * 配置 gpg-agent 选项(必要) + + + + +### 考虑事项 + +Git 实现了 PGP 的多级集成,首先从签名标签开始,接着介绍签名提交,最后添加签名推送的支持。 + +#### 了解 Git 哈希 + +Git 是一个复杂的东西,为了你能够更好地掌握它如何集成 PGP,你需要了解什么是”哈希“。我们将它归纳为两种类型的哈希:树哈希和提交哈希。 + +##### 树哈希 + +每次你向仓库提交一个变更,对于仓库中的每个子目录,git 都会记录它里面所有对象的校验和哈希 —— 内容(blobs)、目录(trees)、文件名和许可等等。它只对每次提交中发生变更的树和内容做此操作,这样在只变更树的一小部分时就不必去重新计算整个树的校验和。 + +然后再计算和存储处于顶级的树的校验和,这样如果仓库的任何一部分发生变化,校验和将不可避免地发生变化。 + +##### 提交哈希 + +一旦创建了树哈希,git 将计算提交哈希,它将包含有关仓库和变更的下列信息: + + * 树哈希的校验和 + + * 变更前树哈希的校验和(父级) + + * 有关作者的信息(名字、email、创作时间) + + * 有关提交者的信息(名字、email、提交时间) + + * 提交信息 + + + + +##### 哈希函数 + +在写这篇文章时,虽然研究一种更强大的、抗碰撞的算法的工作正在进行,但 git 仍然使用的是 SHA1 哈希机制去计算校验和。注意,git 已经包含了碰撞防范程序,因此认为对 git 成功进行碰撞攻击仍然是不可行的。 + +#### 注释的标签和标签签名 + +在每个 Git 仓库中,标签允许开发者标记特定的提交。标签可以是 “轻量级的” —— 几乎只是一个特定提交上的指针,或者它们可以是 “注释的”,它成为 git 树中自己的项目。一个注释的标签对象包含所有下列的信息: + + * 成为标签的提交哈希的校验和 + + * 标签名字 + + * 关于打标签的人的信息(名字、email、打标签时间) + + * 标签信息 + + + + +一个 PGP 签名的标签是一个带有将所有这些条目封装进一个 PGP 签名的注释标签。当开发者签名他们的 git 标签时,他们实际上是向你保证了如下的信息: + + * 他们是谁(以及他们为什么应该被信任) + + * 他们在签名时的仓库状态是什么样: + + * 标签包含提交的哈希 + + * 提交哈希包含了顶级树的哈希 + + * 顶级哈希包含了所有文件、内容和子树的哈希 + * 它也包含有关作者的所有信息 + + * 包含变更发生时的精确时间 + + + + +当你克隆一个仓库并验证一个签名标签时,就是向你以密码方式保证仓库中的所有内容、包括所有它的历史,与开发者签名时在它的计算机上的仓库完全一致。 + +#### 签名的提交 + +签名的提交与签名的标签非常类似 —— 提交对象的内容是 PGP 签名过的,而不是标签对象的内容。一个提交签名也给你提供了开发者签名时,开发者树上的全部可验证信息。标签签名和提交 PGP 签名提供了有关仓库和它的完整历史的完全一致的安全保证。 + +#### 签名的推送 + +为了完整起见,在这里包含了签名的推送这一功能,因为在你使用这个功能之前,需要在接收推送的服务器上先启用它。正如我们在上面所说过的,PGP 签名一个 git 对象就是提供了开发者的 git 树当时的可验证信息,但不提供开发者对那个树意图相关的信息。 + +比如,你可以在你自己 fork 的 git 仓库的一个实验分支上尝试一个很酷的特性,为了评估它,你提交了你的工作,但是有人在你的代码中发现了一个恶意的 bug。由于你的提交是经过正确签名的,因此有人可能将包含有恶意 bug 的分支推入到 master 分支中,从而在生产系统中引入一个漏洞。由于提交是经过你的密钥正确签名的,所以一切看起来都是合理合法的,而当 bug 被发现时,你的声誉就会因此而受到影响。 + +在 `git push` 时,为了验证提交的意图而不仅仅是验证它的内容,添加了要求 PGP 推送签名的功能。 + +#### 配置 git 使用你的 PGP 密钥 + +如果在你的钥匙环上只有一个密钥,那么你就不需要再做额外的事了,因为它是你的默认密钥。 + +然而,如果你有多个密钥,那么你必须要告诉 git 去使用哪一个密钥。([fpr] 是你的密钥的指纹): +``` +$ git config --global user.signingKey [fpr] + +``` + +注意:如果你有一个不同的 gpg2 命令,那么你应该告诉 git 总是去使用它,而不是传统的版本 1 的 gpg: +``` +$ git config --global gpg.program gpg2 + +``` + +#### 如何使用签名标签 + +创建一个签名的标签,只要传递一个简单地 -s 开关给 tag 命令即可: +``` +$ git tag -s [tagname] + +``` + +我们建议始终对 git 标签签名,这样让其它的开发者确信他们使用的 git 仓库没有被恶意地修改过(比如,引入后门): + +##### 如何验证签名的标签 + +验证一个签名的标签,只需要简单地使用 verify-tag 命令即可: +``` +$ git verify-tag [tagname] + +``` + +如果你要验证其他人的 git 标签,那么就需要你导入他的 PGP 公钥。请参考 “可信任的团队沟通” 一文中关于此主题的指导。 + +##### 在拉取时验证 + +如果你从项目仓库的其它 fork 中拉取一个标签,git 将自动验证签名,并在合并操作时显示结果: +``` +$ git pull [url] tags/sometag + +``` + +合并信息将包含类似下面的内容: +``` +Merge tag 'sometag' of [url] + +[Tag message] + +# gpg: Signature made [...] +# gpg: Good signature from [...] + +``` + +#### 配置 git 始终签名注释的标签 + +很可能的是,你正在创建一个带注释的标签,你应该去签名它。强制 git 始终签名带注释的标签,你可以设置一个全局配置选项: +``` +$ git config --global tag.forceSignAnnotated true + +``` + +或者,你始终记得每次都传递一个 -s 开关: +``` +$ git tag -asm "Tag message" tagname + +``` + +#### 如何使用签名提交 + +创建一个签名提交很容易,但是将它纳入到你的工作流中却很困难。许多项目使用签名提交作为一种 "Committed-by:” 的等价行,它记录了代码来源 —— 除了跟踪项目历史外,签名很少有人去验证。在某种意义上,签名的提交用于 ”篡改证据“,而不是 git 工作流的 ”篡改证明“。 + +为创建一个签名的提交,你只需要 `git commit` 命令传递一个 -S 标志即可(由于它与另一个标志冲突,所以改为大写的 -S): +``` +$ git commit -S + +``` + +我们建议始终使用签名提交,并要求项目所有成员都这样做,这样其它人就可以验证它们(下面就讲到如何验证)。 + +##### 如何去验证签名的提交 + +验证签名的提交需要使用 verify-commit 命令: +``` +$ git verify-commit [hash] + +``` + +你也可以查看仓库日志,要求所有提交签名是被验证和显示的: +``` +$ git log --pretty=short --show-signature + +``` + +##### 在 git merge 时验证提交 + +如果项目的所有成员都签名了他们的提交,你可以在合并时强制进行签名检查(然后使用 -S 标志对合并操作本身进行签名): +``` +$ git merge --verify-signatures -S merged-branch + +``` + +注意,如果有一个提交没有签名或验证失败,将导致合并操作失败。通常情况下,技术是最容易的部分 —— 而人的因素使得项目中很难采用严格的提交验证。 + +##### 如果你的项目在补丁管理上采用邮件列表 + +如果你的项目在提交和处理补丁时使用一个邮件列表,那么一般很少使用签名提交,因为通过那种方式发送时,签名信息将会丢失。对提交进行签名仍然是非常有用的,这样引用你托管在公开 git 树的其他人就能以它作为参考,但是上游项目接收你的补丁时,仍然不能直接使用 git 去验证它们。 + +尽管,你仍然可以签名包含补丁的电子邮件。 + +#### 配置 git 始终签名提交 + +你可以告诉 git 总是签名提交: +``` +git config --global commit.gpgSign true + +``` + +或者你每次都记得给 `git commit` 操作传递一个 -S 标志(包括 —amend)。 + +#### 配置 gpg-agent 选项 + +GnuPG agent 是一个守护工具,它能在你使用 gpg 命令时随时自动启动,并运行在后台来缓存私钥的密码。这种方式让你只需要解锁一次密钥就可以重复地使用它(如果你需要在一个自动脚本中签署一组 git 操作,而不需要重复输入密钥,这种方式就很方便)。 + +为了调整缓存中的密钥过期时间,你应该知道这两个选项: + + * default-cache-ttl(秒):如果在 time-to-live 过期之前再次使用同一个密钥,这个倒计时将重置成另一个倒计时周期。缺省值是 600(10 分钟)。 + + * max-cache-ttl(秒):自首次密钥输入以后,不论最近一次使用密钥是什么时间,只要最大值的 time-to-live 倒计时过期,你将被要求再次输入密码。它的缺省值是 30 分钟。 + + + + +如果你认为这些缺省值过短(或过长),你可以编辑 ~/.gnupg/gpg-agent.conf 文件去设置你自己的值: +``` +# set to 30 minutes for regular ttl, and 2 hours for max ttl +default-cache-ttl 1800 +max-cache-ttl 7200 + +``` + +##### 额外好处:与 ssh 一起使用 gpg-agent + +如果你创建了一个 [A](验证)密钥,并将它移到了智能卡,你可以将它用到 ssh 上,为你的 ssh 会话添加一个双因子验证。为了与 agent 沟通你只需要告诉你的环境去使用正确的套接字文件即可。 + +首先,添加下列行到你的 ~/.gnupg/gpg-agent.conf 文件中: +``` +enable-ssh-support + +``` + +接着,添加下列行到你的 .bashrc 文件中: +``` +export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) + +``` + +为了让改变生效,你需要 kill 掉正在运行的 gpg-agent 进程,并重新启动一个新的登入会话: +``` +$ killall gpg-agent +$ bash +$ ssh-add -L + +``` + +最后的命令将列出代表你的 PGP Auth 密钥的 SSH(注释应该会在结束的位置显示: cardno:XXXXXXXX,表示它来自智能卡)。 + +为了启用 ssh 的基于密钥的登入,只需要在你要登入的远程系统上添加 `ssh-add -L` 的输出到 ~/.ssh/authorized_keys 中。祝贺你,这将使你的 SSH 登入凭据更难以窃取。 + +作为一个福利,你可以从公共密钥服务器上下载其它人的基于 PGP 的 ssh 公钥,这样就可以赋予他登入 ssh 的权利: +``` +$ gpg --export-ssh-key [keyid] + +``` + +如果你有让开发人员通过 ssh 来访问 git 仓库的需要,这将让你非常方便。下一篇文章,我们将提供像保护你的密钥那样保护电子邮件帐户的小技巧。 + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-6-using-pgp-git + +作者:[KONSTANTIN RYABITSEV][a] +译者:[qhwdw](https://github.com/qhwdw) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.linux.com/users/mricon +[1]:https://www.linux.com/blog/learn/2018/2/protecting-code-integrity-pgp-part-1-basic-pgp-concepts-and-tools +[2]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-2-generating-and-protecting-your-master-pgp-key +[3]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-3-generating-pgp-subkeys +[4]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-4-moving-your-master-key-offline-storage +[5]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-5-moving-subkeys-hardware-device +[6]:https://github.com/jayphelps/git-blame-someone-else From eebbca924755a5389ea83de42162505386db02f8 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sun, 23 Dec 2018 19:44:35 +0800 Subject: [PATCH 016/322] Translatng by MjSeven --- .../20180716 Users, Groups and Other Linux Beasts- Part 2.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md b/sources/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md index b164bb6cf5..b6d2552264 100644 --- a/sources/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md +++ b/sources/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md @@ -1,3 +1,4 @@ +Translating by MjSeven Users, Groups and Other Linux Beasts: Part 2 ====== ![](https://www.linux.com/blog/learn/intro-to-linux/2018/7/users-groups-and-other-linux-beasts-part-2) From fe7f9a5b237dcf71bc0ab103d715f14b114f676e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 23 Dec 2018 20:54:35 +0800 Subject: [PATCH 017/322] PRF:20171111 A CEOs Guide to Emacs.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @oneforalone 翻译辛苦了,我用了比较长的时间才算是初步校对完。希望你可以看看我的校对是否合适。此外,角注的内容,你没有翻译,这个部分也应该翻译一下。这篇是挺有 价值的文章。 --- .../tech/20171111 A CEOs Guide to Emacs.md | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/translated/tech/20171111 A CEOs Guide to Emacs.md b/translated/tech/20171111 A CEOs Guide to Emacs.md index 9ddbab89d2..d7a5f8ad0d 100644 --- a/translated/tech/20171111 A CEOs Guide to Emacs.md +++ b/translated/tech/20171111 A CEOs Guide to Emacs.md @@ -123,7 +123,7 @@ C-x C-f ~/o[RET]/bl[RET].or[RET] #### 字体及风格 -我推荐在 Emacs 中使用很棒的字体系列。它们可以使用不同的括号、0和其他字符进行自定义。你可以在字体文件本身中构建额外的行间距。我推荐 1\.5 倍的行间距,并在代码和数据中使用它们适应比例的字体。写作中我用 `Serif` 字体,它有一种紧凑但时髦的感觉。你可以在 [http://input.fontbureau.com/][40] 上找到它们,在那里你可以根据自己的喜好进行定制。你可以使用 Emacs 中的菜单手动设置字体,但这会将代码保存到你的 `.emacs` 文件中,如果您使用多个设备,您可能需要一些不同的设置。我我将我的 `.emacs` 设置位根据使用的机器的名称,并配置适当的屏幕机字体。代码如下: +我推荐在 Emacs 中使用漂亮的字体族。它们可以使用不同的括号、0 和其他字符进行自定义。你可以在字体文件本身中构建额外的行间距。我推荐 1.5 倍的行间距,并在代码和数据中使用不等宽字体。写作中我用 `Serif` 字体,它有一种紧凑但时髦的感觉。你可以在 [http://input.fontbureau.com/][40] 上找到它们,在那里你可以根据自己的喜好进行定制。你可以使用 Emacs 中的菜单手动设置字体,但这会将代码保存到你的 `.emacs` 文件中,如果您使用多个设备,您可能需要一些不同的设置。我将我的 `.emacs` 设置为根据使用的机器的名称来相应配置屏幕。代码如下: ``` ;; set up fonts for different OSes. OSX toggles to full screen. @@ -140,9 +140,9 @@ C-x C-f ~/o[RET]/bl[RET].or[RET] (set-face-attribute 'default nil :font myfont :height 104))) ``` -您应该将你的 Emacs 副本中 `system-name` 的值替换成你使用命令 `(system-name)` 得到的值。注意,在 Sampo (我的 MacBook)上,我还将 Emacs 设置为全屏。我也想在 Windows 实现这个,但是 Windows 和 Emacs 并不真正喜欢对方,当我尝试这个时,它总是不稳定。相反,我只是在启动后手动全屏。 +您应该将你的 Emacs 中的 `system-name` 的值替换成你通过 `(system-name)` 得到的值。注意,在 Sampo (我的 MacBook)上,我还将 Emacs 设置为全屏。我也想在 Windows 实现这个,但是 Windows 和 Emacs 并不真正喜欢对方,当我尝试这个时,它总是不稳定。相反,我只能在启动后手动全屏。 -我还建议去掉 Emacs 中在 90 年代获得的难看的工具栏,当时最酷的事情是在应用程序中使用工具栏。我还去掉了一些其他的 `chrome`,这样我就有了一个简单、高效的界面。把这些加到你的 `.emacs` 的文件中,来去掉工具栏和滚动条,但要保留菜单 (在 OS X 上,它将被隐藏,除非你将鼠标到屏幕顶部): +我还建议去掉 Emacs 中的上世纪 90 年代出现的难看工具栏,当时最酷的事情是在应用程序中使用工具栏。我还去掉了一些其它的“电镀层”,这样我就有了一个简单、高效的界面。把这些加到你的 `.emacs` 的文件中来去掉工具栏和滚动条,但要保留菜单(在 OS X 上,它将被隐藏,除非你将鼠标到屏幕顶部): ``` (if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1)) @@ -152,9 +152,9 @@ C-x C-f ~/o[RET]/bl[RET].or[RET] #### Org 模式 -我基本上 `Org` 模式下处理工作的。它是我创作文档、记笔记、列任务清单以及 90% 其他工作的首选环境。`Org` 最初是由一个在会议中使用笔记本电脑的家伙构想出来的,它是笔记和待办事项列表的组合工具。我反对在会议中使用笔记本电脑,自己也不使用,所以我的用法与他的有些不同。对我来说,`Org` 主要是一种处理结构中内容的方式。在 `Org` 模式中有标题和副标题等,它们的作用就像一个大纲。`Org` 允许你展开或隐藏文本内容,还可以重新排列文本。这非常很符合我的想法,而且我发现用这种方式使用它是一种乐趣。 +我基本上是在 Org 模式下处理工作的。它是我创作文档、记笔记、列任务清单以及 90% 其他工作的首选环境。Org 模式最初是由一个在会议中使用笔记本电脑的家伙构想出来的,它是笔记和待办事项列表的组合工具。我反对在会议中使用笔记本电脑,自己也不使用,所以我的用法与他的有些不同。对我来说,Org 模式主要是一种处理结构中内容的方式。在 Org 模式中有标题和副标题等,它们的作用就像一个大纲。Org 模式允许你展开或隐藏大纲树,还可以重新排列该树。这非常很符合我的想法,而且我发现用这种方式使用它是一种乐趣。 -`Org` 模式也有很多让生活愉快的小功能。例如,脚注处理非常好,`LaTeX/PDF` 输出也很好。`Org` 能够根据所有文档中的待办事项生成议程,并能很好地将它们与日期/时间联系起来。我不把它用在任何形式的外部任务上,这些任务都是在一个共享的日历上处理的,但是在创建事物和跟踪我未来需要创建的东西时,它是无价的。安装它,你只要将 `org-mode.el` 放到你的 `lisp` 目录下,然后再在你的 `.emacs` 文件中添加如下代码,如果你想要它基于文档的结构进行缩进并在打开时全部展开的话: +Org 模式也有很多让生活愉快的小功能。例如,脚注处理非常好,LaTeX/PDF 输出也很好。Org 模式能够根据所有文档中的待办事项生成议程,并能很好地将它们与日期/时间联系起来。我不把它用在任何形式的外部任务上,这些任务都是在一个共享的日历上处理的,但是在创建事物和跟踪我未来需要创建的东西时,它是无价的。安装它,你只要将 `org-mode.el` 放到你的 `lisp` 目录下,并且如果你想要它基于文档的结构进行缩进并在打开时全部展开的话,在你的 `.emacs` 文件中添加如下代码: ``` ;; set up org mode @@ -163,15 +163,15 @@ C-x C-f ~/o[RET]/bl[RET].or[RET] (setq org-directory "~/org") ``` -最后一行是让 `Org` 知道在哪里查找要包含在议程和其他事情中的文件。我把 `Org` 保存在我的主目录中,也就是说,像前面介绍的一样,它是 Dropbox 目录的一个符号链接。 +最后一行是让 Org 模式知道在哪里查找要包含在议程和其他事情中的文件。我把 Org 模式保存在我的主目录中,也就是说,像前面介绍的一样,它是 Dropbox 目录的一个符号链接。 -我有一个总是在缓冲区中打开的 `stuff.org` 文件。我把它当作记事本。`Org` 使得提取待办事项和有期限的事情变得很容易。当你在内联 `Lisp` 代码并在需要计算它时,它特别有用。拥有包含内容的代码非常方便。同样,你可以使用 Emacs 访问实际的计算机,这是一种解放。 +我有一个总是在缓冲区中打开的 `stuff.org` 文件。我把它当作记事本。Org 模式使得提取待办事项和有期限的事情变得很容易。当你能够内联 Lisp 代码并在需要计算它时,它特别有用。拥有包含内容的代码非常方便。同样,你可以使用 Emacs 访问实际的计算机,这是一种解放。 -##### 用 `Org` 模式进行发布 +##### 用 Org 模式进行发布 -我关心的是文档的外观和格式。我我刚开始工作时是个设计师,而且我认为信息可以,也应该表现得清晰和美丽。`Org` 对将 `LaTeX` 生成 PDF 支持的很好, `LaTeX` 有自己的学习曲线,但是做简单的事情非常简单。 +我关心的是文档的外观和格式化。我刚开始工作时是个设计师,而且我认为信息可以,也应该表现得清晰和美丽。Org 模式对将 LaTeX 生成 PDF 支持的很好,LaTeX 虽然也有学习曲线,但是做简单的事情非常简单。 -如果你想使用字体和样式,而不是典型的 `LaTeX` 字体和样式,你需要做些事。首先,你要用到 `XeLaTeX`,这样就可以使用普通的系统字体,而不是 `LaTeX` 的特殊字体。接下来,您需要将一下代码添加到 `.emacs` 中: +如果你想使用字体和样式,而不是典型的 LaTeX 字体和样式,你需要做些事。首先,你要用到 XeLaTeX,这样就可以使用普通的系统字体,而不是 LaTeX 的特殊字体。接下来,您需要将以下代码添加到 `.emacs` 中: ``` (setq org-latex-pdf-process @@ -179,7 +179,7 @@ C-x C-f ~/o[RET]/bl[RET].or[RET] "xelatex -interaction nonstopmode %f")) ``` -我把这个放在 `.emacs` 中 `Org` 配置部分的末尾来保持整洁。这让你在从 `Org` 发布时使用更多格式化选项。例如,我经常使用: +我把这个放在 `.emacs` 中 Org 模式配置部分的末尾来保持整洁。这让你在从 Org 模式发布时可以使用更多格式化选项。例如,我经常使用: ``` #+LaTeX_HEADER: \usepackage{fontspec} @@ -193,11 +193,11 @@ C-x C-f ~/o[RET]/bl[RET].or[RET] 这些都可以在你的 `.org` 文件中找到。我们的公司规定的正文字体是 `Maison Neue`,但你也可以在这写上任何适当的东西。我强烈反对使用 `Maison Neue`。它是一种糟糕的字体,任何人都不应该使用它。 -这个文件是一个使用该配置输出为 PDF 的实例。这就是开箱即用的 `LaTeX` 一样。在我看来这还不错,但是字体很无聊,而且有点奇怪。此外,如果你使用标准格式,人们会认为他们正在阅读的东西是或假装是一篇学术论文。别怪我没提醒你。 +这个文件是一个使用该配置输出为 PDF 的实例。这就是开箱即用的 LaTeX 一样。在我看来这还不错,但是字体很平淡,而且有点奇怪。此外,如果你使用标准格式,人们会觉得他们正在阅读的东西是、或者假装是一篇学术论文。别怪我没提醒你。 -#### `Ace Jump` 模式 +#### Ace Jump 模式 -如果你想使用的话,这是个辅助而不是主要功能。它的工作原理有点像 Jef Raskin 的 `Leap` 功能[^9] 。 按下 `C-c` `C-SPC`,然后输入要跳转到单词的第一个字母。它会高亮显示所有以该字母开头的单词,并将其替换为字母表中的字母。您只需键入所需位置的字母,光标就会跳转到该位置。我自己经常用这个作为导航键或搜索。将 `.el` 文件下到你的 `Lisp` 目录下,并在 `.emacs` 文件添加如下代码: +这是个辅助而不是主要功能,但是或许你想使用。它的工作原理有点像之前的 Jef Raskin 的 Leap 功能[^9] 。 按下 `C-c C-SPC`,然后输入要跳转到单词的第一个字母。它会高亮显示所有以该字母开头的单词,并将其替换为字母表中的字母。您只需键入所需位置的字母,光标就会跳转到该位置。我自己经常用这个作为导航键或搜索。将 `.el` 文件下到你的 `lisp` 目录下,并在 `.emacs` 文件添加如下代码: ``` ;; set up ace-jump-mode @@ -208,7 +208,7 @@ C-x C-f ~/o[RET]/bl[RET].or[RET] ### 更多 -这篇文章已经够详细了,你能在其中的到你所想要的。我很想了解除编程(或编程)之外你对 Emacs 的使用,以及这是否有用。在我使用 Emacs 的过程中,可能存在一些自作聪明的想法,如果你能指出它们,我将感激不尽。之后,我可能会写一些更新来引入其他特性或模式。我很确定我将会向你展示如何在 Emacs 和 `Ludwig` 模式下使用 `Fugue`,因为我会将它发展成比代码突出显示更有用的东西。把你的想法发到 [@fugueHQ][41] 上。 +这篇文章已经够详细了,你能在其中的到你所想要的。我很想了解除了编程之外(或用于编程)你对 Emacs 的使用情况,以及这是否有用。在我使用 Emacs 的过程中,可能存在一些自作聪明的老板式想法,如果你能指出它们,我将感激不尽。之后,我可能会写一些更新来介绍其它特性或模式。我很确定我将会向你展示如何在 Emacs 和 Ludwig 模式下使用 Fugue,因为我会将它发展成比代码高亮更有用的东西。请把你的想法发到 [@fugueHQ][41] 上。 [^1]: If you are now a PHB of some sort, but were never technical, Emacs likely isn’t for you. There may be a handful of folks for whom Emacs will form a path into the more technical aspects of computing, but this is probably a small population. It’s helpful to know how to use a Unix or Windows terminal, to have edited a dotfile or two, and to have written some code at some point in your life for Emacs to make much sense. @@ -225,9 +225,9 @@ C-x C-f ~/o[RET]/bl[RET].or[RET] via: https://blog.fugue.co/2015-11-11-guide-to-emacs.html -作者:[Josh Stella ][a] +作者:[Josh Stella][a] 译者:[oneforalone](https://github.com/oneforalone) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 9684a00296651f93a2977db69d73664e6b617c31 Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Sun, 23 Dec 2018 22:18:41 +0800 Subject: [PATCH 018/322] Translating by qhwdw --- ...de Integrity with PGP - Part 7- Protecting Online Accounts.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md b/sources/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md index 8ebb9af3f6..1c5cf7ff09 100644 --- a/sources/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md +++ b/sources/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md @@ -1,3 +1,4 @@ +Translating by qhwdw Protecting Code Integrity with PGP — Part 7: Protecting Online Accounts ====== From 1fcee3b5fe7bc5fedd9cf439938612e493d88139 Mon Sep 17 00:00:00 2001 From: alim0x Date: Sun, 23 Dec 2018 22:27:21 +0800 Subject: [PATCH 019/322] [translated]20181211 DevOps is for everyone --- .../talk/20181121 DevOps is for everyone.md | 75 ------------------- .../talk/20181121 DevOps is for everyone.md | 74 ++++++++++++++++++ 2 files changed, 74 insertions(+), 75 deletions(-) delete mode 100644 sources/talk/20181121 DevOps is for everyone.md create mode 100644 translated/talk/20181121 DevOps is for everyone.md diff --git a/sources/talk/20181121 DevOps is for everyone.md b/sources/talk/20181121 DevOps is for everyone.md deleted file mode 100644 index 256a4e9fc3..0000000000 --- a/sources/talk/20181121 DevOps is for everyone.md +++ /dev/null @@ -1,75 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (alim0x) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: subject: (DevOps is for everyone) -[#]: via: (https://opensource.com/article/18/11/how-non-engineer-got-devops) -[#]: author: (Dawn Parych https://opensource.com/users/dawnparzych) -[#]: url: ( ) - -DevOps is for everyone -====== - -A non-engineer explains why you don't need to be a developer or an operations person to fall for DevOps. - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/team-game-play-inclusive-diversity-collaboration.png?itok=8sUXV7W1) - -I've never held a job as a developer nor in operations—so what am I doing writing an article about [DevOps][1]? I've always been interested in computers and technology. I also have a passion for people, psychology, and helping others. When I first heard about DevOps, the concept piqued my interest, as it seemed to merge many of the things I was interested in, even if I don't write code. - -My first computer was a TRS-80, and I loved writing BASIC programs on it. I took the only two computer programming classes my high school offered. A few years later, I started a computer company. I made custom mailing labels, stationery, and built a database to store addresses. - -The problem was I didn't enjoy writing code. I wanted to teach and to help people, and I didn't see writing code as an opportunity to do this. Yes, technology can help people and change lives, but writing code didn't spark my passion. I need to feel excited about my work and do something I love. - - * The culture, not the code - * The journey, not the result - * Building an environment where everybody can continuously improve - * Communicating and collaborating, not working independently - - - -I found that I love DevOps. To me, DevOps is about: - -Ultimately, DevOps is about being part of a community working towards the same goal. DevOps merges psychology, people, and technology. DevOps isn't a job title; it is a philosophy for life and work. - -### Finding my people - -Almost four years ago, I attended my first [DevOpsDays][2] conference in Seattle. I felt like I had found my people. I felt welcomed and accepted, even though I work in marketing and don't have a computer science degree. I could geek out over psychology and technology. - -At DevOpsDays, I learned about the ["Three Ways" of DevOps][3]—flow, feedback, and continuous experimentation and learning—and new (to me) concepts such as Kaizen and Kaikaku. As I learned, I found myself saying things like, "I do this! I didn't know there was a name for this!" - -[Kaizen][4] is the practice of continuous improvement and learning. Small, incremental changes over time can yield significant results. I found parallels between this and Carol Dweck's idea of a [growth mindset][5]. People aren't born experts. Becoming skilled at something takes time, practice, and often failure. Recognizing incremental improvement is necessary to make sure we don't give up. - -[Kaikaku][6], on the other hand, is the notion that small changes over time sometimes won't work, and you need to make a radical or disruptive change. Quitting a job without having a new one lined up or moving to a new city can be pretty disruptive—yes, I've done both. But these radical changes can reap great rewards. I might not have learned about DevOps if I hadn't quit my job and taken some time off. Once I decided to return to work, I kept hearing about DevOps and started researching it. This led me to attend my first DevOpsDays, where I began to see all my passions come together. Since then, I have presented at five DevOpsDays and regularly write about DevOps topics. - -### Putting the Three Ways to work - -Change is hard and learning something new can be scary. The Three Ways of DevOps provide a framework for managing change. For example: How is information flowing? What is driving you to make a change? Once you know a change is needed, how do you get feedback about whether the changes you are making are the right changes? How do you know if you're making progress? Feedback is essential and should include both positive and constructive elements. The hard part is making sure the constructive elements don't outweigh the positive. - -For me, the third Way—continuous experimentation and learning—is the most important part of DevOps. Having an environment where people are free to experiment and take risks can lead to unexpected outcomes. Sometimes those outcomes are good, sometimes not so good—and that's OK. Creating an environment where it is acceptable if things don't work out encourages people to take risks. We should all strive to continuously experiment and learn something new on a regular basis. - -The Three Ways of DevOps provides a method of trying something, getting feedback, and learning from our mistakes. A few years ago, my son told me, "I don't ever want to be the best at something, because then I can't learn from my mistakes." We all make mistakes, and learning from them helps us grow and improve. We aren't willing to make mistakes if our culture doesn't support experimentation and learning. - -### Being part of the community - -I've worked in technology for over 20 years and often felt like an outsider until I found the DevOps community. If you're like me—passionate about technology but not the engineering or operations side of things—you can still be a part of DevOps, even if you work in sales, marketing, product marketing, technical writing, support, and more. DevOps is for everyone. - - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/11/how-non-engineer-got-devops - -作者:[Dawn Parych][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/dawnparzych -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/resources/devops -[2]: https://www.devopsdays.org/ -[3]: https://itrevolution.com/the-three-ways-principles-underpinning-devops/ -[4]: https://en.wikipedia.org/wiki/Kaizen -[5]: https://en.wikipedia.org/wiki/Mindset#Fixed_and_growth -[6]: https://en.wikipedia.org/wiki/Kaikaku diff --git a/translated/talk/20181121 DevOps is for everyone.md b/translated/talk/20181121 DevOps is for everyone.md new file mode 100644 index 0000000000..778656640d --- /dev/null +++ b/translated/talk/20181121 DevOps is for everyone.md @@ -0,0 +1,74 @@ +[#]: collector: (lujun9972) +[#]: translator: (alim0x) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (DevOps is for everyone) +[#]: via: (https://opensource.com/article/18/11/how-non-engineer-got-devops) +[#]: author: (Dawn Parych https://opensource.com/users/dawnparzych) +[#]: url: ( ) + +所有人的 DevOps +====== + +让一名非工程师来解释为什么你不必成为一位开发者或运维就能爱上 DevOps。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/team-game-play-inclusive-diversity-collaboration.png?itok=8sUXV7W1) + +我没有过开发或运维的工作——那怎么我在写一篇关于 [DevOps][1] 的文章?我一直都对计算机和技术有兴趣。我还对社群、心理学以及帮助他人充满热情。当我第一次听到 DevOps 时,这个概念激起了我的兴趣,因为它看起来融合了很多我感兴趣的东西,即便我是不写代码的。 + +我的第一台电脑是 TRS-80,我喜欢在上面编写 BASIC 程序。我只上过两门我的高中开设的计算机编程课程。若干年后,我创办了一家计算机公司。我定制邮件标签和信纸,并建立了一个数据库来存储地址。 + +问题是我并不能从写代码中获得享受。我想要教育和帮助人们,我没法将写代码看作这样的一个机会。是的,技术可以帮助人们并改变生活,但是写代码没有点燃我的热情。我需要对我的工作感到兴奋并做我喜欢的事情。 + + * 文化,而不是代码 + * 过程,而不是结果 + * 建立一个所有人可以持续提升的环境 + * 沟通与合作,而不是独立工作 + + +我发现我爱 DevOps。对我而言,DevOps 指的是: + +归根结底,DevOps 是指成为社区工作的一部分,实现共同的目标。DevOps 融合了心理学、社群、技术。DevOps 不是一个职位名称,它是一种生活和工作的哲学。 + +### 找到我的社群 + +快四年前,我在西雅图参加了我的第一个 [DevOps 日][2] 会议。我感觉我找到了我的社群。我觉得受到了欢迎和接受,尽管我从事营销工作而且没有计算机科学文凭。我可以从心理学和技术中寻找乐趣。 + +在 DevOps 日,我学到了 [DevOps“三步工作法”][3]——流动,反馈,持续实验和学习——以及新(对我而言)的概念,如Kaizen(改善)和Kaikaku(改革)。随着我的学习深入,我发现我在说这样的话,“我是这样做的!我都不知道这样做还有个名字!” + +[Kaizen(改善)][4]是持续改进和学习的实践。小的量变积累随着时间的推移可以引起质变。我发现它和卡罗尔.德韦克的[成长型思维][5]的想法很相似。人们不是生来就是专家。在某方面拥有经验需要花费时间,练习,以及常常还有失败。承认增量的改善对确保我们不会放弃是很有必要的。 + +另一方面,[Kaikaku(改革)][6]的概念是指,长时间的小的改变有时不能起作用,你需要做一些完全的或破坏性的改变。在没有找到下份工作前就辞职或移居新城市就足够有破坏性——是的,两者我都做过。但这些彻底的改变收获巨大。如果我没有辞职并休息一段时间,我也许不会接触到 DevOps。等我决定继续工作的时候,我一直听到 DevOps,我开始研究它。这引导我参加了我的第一个 DevOps 日,从那里我开始看到我的所有热情开始聚集。从那时起,我已经参加了五次 DevOps 日活动,并且定期撰写关于 DevOps 话题的文章。 + +### 将三步工作法用到工作中 + +改变是困难的,学习新事物可以听起来很吓人。DevOps 的三步工作法提供了一个管理改变的框架。比如:信息流动是怎样的?是什么驱动着你做出改变?一旦你认为一个改变是必需的,你如何获得这个改变是否正确的反馈?你如何知道你在取得进展?反馈是必要的,并且应该包含积极和有建设性的要素。困难的地方在于保证建设性的要素不要重于积极要素。 + +对我而言,第三步——持续实验和学习——是 DevOps 最重要的部分。有一个可以自由地实验和冒险的环境,人们可以获得意想不到的结果。有时这些结果是好的,有时不是太好——但这没事。创建一个可以接受失败结果的环境可以鼓励人们冒险。我们都应该力争定期的持续实验和学习。 + +DevOps 的三步工作法提供了一个尝试,获得反馈,以及从错误中获取经验的方法。几年前,我的儿子告诉我,“我从来就没想做到最好,因为那样我就没法从我的错误中学到东西了。”我们都会犯错,从中获得经验帮助我们成长和改善。如果我们的文化不支持尝试和学习,我们就不会愿意去犯错。 + +### 成为社区的一部分 + +我已经在技术领域工作了超过 20 年,直到我发现 DevOps 社区前,我还经常感觉自己是个外行。如果你像我一样——对技术充满热情,但不是工程和运维那方面——你仍然可以成为 DevOps 的一部分,即便你从事的是销售、营销、产品营销、技术写作、支持或其他工作。DevOps 是属于所有人的。 + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/11/how-non-engineer-got-devops + +作者:[Dawn Parych][a] +选题:[lujun9972][b] +译者:[alim0x](https://github.com/alim0x) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dawnparzych +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/resources/devops +[2]: https://www.devopsdays.org/ +[3]: https://itrevolution.com/the-three-ways-principles-underpinning-devops/ +[4]: https://en.wikipedia.org/wiki/Kaizen +[5]: https://en.wikipedia.org/wiki/Mindset#Fixed_and_growth +[6]: https://en.wikipedia.org/wiki/Kaikaku From d71dd1f80d916eb41ffb1b3372a120d441e1f534 Mon Sep 17 00:00:00 2001 From: amwps290 Date: Sun, 23 Dec 2018 22:49:09 +0800 Subject: [PATCH 020/322] Update 20181217 Take a swim at your Linux terminal with asciiquarium.md --- ...1217 Take a swim at your Linux terminal with asciiquarium.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md b/sources/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md index d8253849ea..63741b5ccd 100644 --- a/sources/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md +++ b/sources/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: ( amwps290) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 6ad5b97e7aaf3f41b96c9c212519c2c26485451c Mon Sep 17 00:00:00 2001 From: hopefully2333 <787016457@qq.com> Date: Mon, 24 Dec 2018 00:33:34 +0800 Subject: [PATCH 021/322] translated over translated over --- ... with challenge-response authentication.md | 185 ------------------ ... with challenge-response authentication.md | 182 +++++++++++++++++ 2 files changed, 182 insertions(+), 185 deletions(-) delete mode 100644 sources/tech/20181022 Improve login security with challenge-response authentication.md create mode 100644 translated/tech/20181022 Improve login security with challenge-response authentication.md diff --git a/sources/tech/20181022 Improve login security with challenge-response authentication.md b/sources/tech/20181022 Improve login security with challenge-response authentication.md deleted file mode 100644 index ff5cdba354..0000000000 --- a/sources/tech/20181022 Improve login security with challenge-response authentication.md +++ /dev/null @@ -1,185 +0,0 @@ -translating by hopefully2333 - -Improve login security with challenge-response authentication -====== - -![](https://fedoramagazine.org/wp-content/uploads/2018/10/challenge-response-816x345.png) - -### Introduction - -Today, Fedora offers multiple ways to improve the secure authentication of our user accounts. Of course it has the familiar user name and password to login. It also offers additional authentication options such as biometric, fingerprint, smart card, one-time password, and even challenge-response authentication. - -Each authentication method has clear pros and cons. That, in itself, could be a topic for a rather lengthy article. Fedora Magazine has covered a few of these options previously: - - -+ [Using the YubiKey4 with Fedora][1] -+ [Fedora 28: Better smart card support in OpenSSH][2] - - -One of the most secure methods in modern Fedora releases is offline hardware challenge-response. It’s also one of the easiest to deploy. Here’s how. - -### Challenge-response authentication - -Technically, when you provide a password, you’re responding to a user name challenge. The offline challenge response covered here requires your user name first. Next, Fedora challenges you to provide an encrypted physical hardware token. The token responds to the challenge with another encrypted key it stores via the Pluggable Authentication Modules (PAM) framework. Finally, Fedora prompts you for the password. This prevents someone from just using a found hardware token, or just using a user name and password without the correct encrypted key. - -This means that in addition to your user name and password, you must have previously registered one or more encrypted hardware tokens with the OS. And you have to provide that physical hardware token to be able to authenticate with your user name. - -Some challenge-response methods, like one time passwords (OTP), take an encrypted code key on the hardware token, and pass that key across the network to a remote authentication server. The server then tells Fedora’s PAM framework if it’s is a valid token for that user name. This is great if the authentication server(s) are on the local network. The downside is if the network connection is down or you’re working remote without a network connection, you can’t use this remote authentication method. You could be locked out of the system until you can connect through the network to the server. - -Sometimes a workplace requires use of Yubikey One Time Passwords (OTP) configuration. However, on home or personal systems you may prefer a local challenge-response configuration. Everything is local, and the method requires no remote network calls. The following process works on Fedora 27, 28, and 29. - -### Preparation - -#### Hardware token keys - -First you need a secure hardware token key. Specifically, this process requires a Yubikey 4, Yubikey NEO, or a recently released Yubikey 5 series device which also supports FIDO2. You should purchase two of them to provide a backup in case one becomes lost or damaged. You can use these keys on numerous workstations. The simpler FIDO or FIDO U2F only versions don’t work for this process, but are great for online services that use FIDO. - -#### Backup, backup, and backup - -Next, make a backup of all your important data. You may want to test the configuration in a Fedora 27/28/29 cloned VM to make sure you understand the process before setting up your personal workstation. - -#### Updating and installing - -Now make sure Fedora is up to date. Then install the required Fedora Yubikey packages via these dnf commands: - -``` -$ sudo dnf upgrade -$ sudo dnf install ykclient* ykpers* pam_yubico* -$ cd -``` - -If you’re in a VM environment, such as Virtual Box, make sure the Yubikey device is inserted in a USB port, and enable USB access to the Yubikey in the VM control. - -### Configuring Yubikey - -Verify that your user account has access to the USB Yubikey: - -``` -$ ykinfo -v -version: 3.5.0 -``` - -If the YubiKey is not detected, the following error message appears: - -``` -Yubikey core error: no yubikey present -``` - -Next, initialize each of your new Yubikeys with the following ykpersonalize command. This sets up the Yubikey configuration slot 2 with a Challenge Response using the HMAC-SHA1 algorithm, even with less than 64 characters. If you have already setup your Yubikeys for challenge-response, you don’t need to run ykpersonalize again. - -``` -ykpersonalize -2 -ochal-resp -ochal-hmac -ohmac-lt64 -oserial-api-visible -``` - -Some users leave the YubiKey in their workstation while using it, and even use challenge-response for virtual machines. However, for more security you may prefer to manually trigger the Yubikey to respond to challenge. - -To add that manual challenge button trigger, add the -ochal-btn-trig flag. This flag causes the Yubikey to flash the yubikey LED on a request. It waits for you to press the button on the hardware key area within 15 seconds to produce the response key. - -``` -$ ykpersonalize -2 -ochal-resp -ochal-hmac -ohmac-lt64 -ochal-btn-trig -oserial-api-visible -``` - -Do this for each of your new hardware keys, only once per key. Once you have programmed your keys, store the Yubikey configuration to ~/.yubico with the following command: - -``` -$ ykpamcfg -2 -v -debug: util.c:222 (check_firmware_version): YubiKey Firmware version: 4.3.4 - -Sending 63 bytes HMAC challenge to slot 2 -Sending 63 bytes HMAC challenge to slot 2 -Stored initial challenge and expected response in '/home/chuckfinley/.yubico/challenge-9992567'. -``` - -If you are setting up multiple keys for backup purposes, configure all the keys the same, and store each key’s challenge-response using the ykpamcfg utility. If you run the command ykpersonalize on an existing registered key, you must store the configuration again. - -### Configuring /etc/pam.d/sudo - -Now to verify this configuration worked, **in the same terminal window** you’ll setup sudo to require the use of the Yubikey challenge-response. Insert the following line into the /etc/pam.d/sudo file: - -``` -auth required pam_yubico.so mode=challenge-response -``` - -Insert the above auth line into the file above the auth include system-auth line. Then save the file and exit the editor. In a default Fedora 29 setup, /etc/pam.d/sudo should now look like this: - -``` -#%PAM-1.0 -auth required pam_yubico.so mode=challenge-response -auth include system-auth -account include system-auth -password include system-auth -session optional pam_keyinit.so revoke -session required pam_limits.so -session include system-auth -``` - -**Keep this original terminal window open** , and test by opening another new terminal window. In the new terminal window type: - -``` -$ sudo echo testing -``` - -You should notice the LED blinking on the key. Tap the Yubikey button and you should see a prompt for your sudo password. After you enter your password, you should see “testing” echoed in the terminal screen. - -Now test to ensure a correct failure. Start another terminal window and remove the Yubikey from the USB port. Verify that sudo no longer works without the Yubikey with this command: - -``` -$ sudo echo testing fail -``` - -You should immediately be prompted for the sudo password. Even if you enter the password, it should fail. - -### Configuring Gnome Desktop Manager - -Once your testing is complete, now you can add challenge-response support for the graphical login. Re-insert your Yubikey into the USB port. Next you’ll add the following line to the /etc/pam.d/gdm-password file: - -``` -auth required pam_yubico.so mode=challenge-response -``` - -Open a terminal window, and issue the following command. You can use another editor if desired: - -``` -$ sudo vi /etc/pam.d/gdm-password -``` - -You should see the yubikey LED blinking. Press the yubikey button, then enter the password at the prompt. - -Modify the /etc/pam.d/gdm-password file to add the new auth line above the existing line auth substack password-auth. The top of the file should now look like this: - -``` -auth [success=done ignore=ignore default=bad] pam_selinux_permit.so -auth required pam_yubico.so mode=challenge-response -auth substack password-auth -auth optional pam_gnome_keyring.so -auth include postlogin - -account required pam_nologin.so -``` - -Save the changes and exit the editor. If you use vi, the key sequence is to hit the **Esc** key, then type wq! at the prompt to save and exit. - -### Conclusion - -Now log out of GNOME. With the Yubikey inserted into the USB port, click on your user name in the graphical login. The Yubikey LED begins to flash. Touch the button, and you will be prompted for your password. - -If you lose the Yubikey, you can still use the secondary backup Yubikey in addition to your set password. You can also add additional Yubikey configurations to your user account. - -If someone gains access to your password, they still can’t login without your physical hardware Yubikey. Congratulations! You’ve now dramatically increased the security of your workstation login. - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/login-challenge-response-authentication/ - -作者:[nabooengineer][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://fedoramagazine.org/author/nabooengineer/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/using-the-yubikey4-with-fedora/ -[2]: https://fedoramagazine.org/fedora-28-better-smart-card-support-openssh/ - diff --git a/translated/tech/20181022 Improve login security with challenge-response authentication.md b/translated/tech/20181022 Improve login security with challenge-response authentication.md new file mode 100644 index 0000000000..1d227c2839 --- /dev/null +++ b/translated/tech/20181022 Improve login security with challenge-response authentication.md @@ -0,0 +1,182 @@ +通过询问-响应身份认证提高登陆安全 +====== + +![](https://fedoramagazine.org/wp-content/uploads/2018/10/challenge-response-816x345.png) + +### 介绍 + +今天,Fedora 提供了多种方式来提高我们账户的身份认证的安全性。当然,它有我们熟悉的用户名密码登陆,它也同样提供了其他的身份认证选项,比如生物识别、指纹、智能卡、一次性密码,甚至是询问-响应身份认证。 + +每种认证方式都有明确的优缺点。这点本身就可以成为一篇相当冗长的文章的主题。Fedora 杂志之前就已经介绍过了这其中的一些选项: + + ++ [Using the YubiKey4 with Fedora][1] ++ [Fedora 28: Better smart card support in OpenSSH][2] + + +在现在的 Fedora 版本中,最安全的方法之一就是离线硬件询问-响应。它也同样是最容易部署的方法之一。下面是具体方法: + +### 询问-响应认证 + +从技术上来讲,当你输入密码的时候,你就正在响应用户名询问。离线的询问、响应包含了这些部分:首先是需要你的用户名,接下来,Fedora 会要你提供一个加密的物理硬件的令牌。令牌会将另一个通过可插入式身份认证模块(PAM)框架进行存储的加密密钥来响应询问。最后,Fedora 才会提示你输入密码。这可以防止其他人仅仅使用了找到的硬件令牌,或是只使用了账户名密码而没有正确的加密密钥。 + +这意味着除了你的账户名密码之外,你必须事先在你的操作系统中注册了一个或多个加密硬件令牌。你必须保证你的物理硬件令牌能够匹配你的用户名。 + +一些询问-响应的方法,比如一次性密码(OTP),在硬件令牌上获取加密代码密钥,然后将这个密钥通过网络传输到远程身份认证服务器。然后这个服务器会告诉 Fedora 的 PAM 框架,这是否是该用户的一个有效令牌。如果身份认证服务器在本地网络上,这个方法非常好。但它的缺点是如果网络连接断开或是你在没有网的远程端工作。你会被锁在系统之外,直到你能通过网络连接到身份认证服务器。 + +有时候,生产环境会需要通过 Yubikey 使用一次性密码(OTP)设置,然而,在家庭或个人的系统上,你可能更喜欢询问-响应设置。一切都是本地的,这种方法不需要通过远程网络呼叫。下面这些过程适用于 Fedora 27、28和29. + +### 准备 + +#### 硬件令牌密钥 + +首先,你需要一个安全的硬件令牌密钥。具体来说,这个过程需要一个 Yubikey 4,Yubikey NEO,或者是最近发布的、同样支持 FIDO2 的 Yubikey 5 系列设备。你应该购买它们中的两个来有一个备份,以避免其中一个丢失或遭到损坏。你可以在不同的工作地点使用这些密钥。较为简单的 FIDO 和 FIDO U2F 版本不适用与这个过程,但是非常适合使用 FIDO 的在线服务。 + +#### 备份、备份,以及备份 + +接下来,为你所有的重要数据制作备份,你可能想在克隆在 VM 里的 Fedora 27/28/29 里测试配置,来确保你在设置你自己的个人工作环境之前理解这个过程。 + +#### 升级,然后安装 + +现在,确定你的 Fedora 是最新的,然后通过 dnf 命令安装所需要的 Fedora Yubikey 包。 + +``` +$ sudo dnf upgrade +$ sudo dnf install ykclient* ykpers* pam_yubico* +$ cd +``` + +如果你使用的是 VM 环境,例如 Virtual Box,确保 Yubikey 设备已经插进了 USB 口,然后允许 VM 控制的 USB 访问 Yubikey。 + +### 配置 Yubikey + +通过 USB Yubikey 验证你的账户: + +``` +$ ykinfo -v +version: 3.5.0 +``` + +如果 Yubikey 没有被检测到,会出现下面这些错误信息: + +``` +Yubikey core error: no yubikey present +``` + +接下来,通过下面这些 ykpersonalize 命令初始化你每个新的 Yubikeys。使用 HMAC-SHA1 算法进行询问响应,以此来设置 Yubikey 配置插槽 2。即使少于 64 个字符,如果你已经为询问响应设置好了你的 Yubikey。你就不需要再运行 ykpersonalize 了。 + +``` +ykpersonalize -2 -ochal-resp -ochal-hmac -ohmac-lt64 -oserial-api-visible +``` + +一些用户在使用的时候将 YubiKey 留在了工作环境里,甚至对虚拟机使用了询问响应。然而,为了更好的安全性,你可能会更愿意使用手动触发 YubiKey 来响应询问。 + +要添加手动询问按钮触发器,请添加 -ochal-btn-trig 标记,这个标记可以在请求中使得 Yubikey 闪烁 Yubikey LED。等待你在 15 秒内按下硬件密钥区域上的按钮来生成响应密钥。 + +``` +$ ykpersonalize -2 -ochal-resp -ochal-hmac -ohmac-lt64 -ochal-btn-trig -oserial-api-visible +``` + +为你的每个新的硬件密钥执行此操作。每个密钥执行以此,使用下面的命令将 Yubikey 配置存储到 ~/.yubico: + +``` +$ ykpamcfg -2 -v +debug: util.c:222 (check_firmware_version): YubiKey Firmware version: 4.3.4 + +Sending 63 bytes HMAC challenge to slot 2 +Sending 63 bytes HMAC challenge to slot 2 +Stored initial challenge and expected response in '/home/chuckfinley/.yubico/challenge-9992567'. +``` + +如果你要设置多个密钥用于备份。请将所有的密钥设置为相同,然后使用 ykpamcfg utility 存储每个密钥的询问-响应。如果你在一个已经存在的注册密钥上运行 ykpersonalize 命令,你就必须再次存储配置信息。 + +### 配置 /etc/pam.d/sudo + +现在要去验证配置是否有效,在相同的终端窗口中,你需要设置 sudo 来要求使用 Yubikey 的询问-响应。将下面这几行插入到 /etc/pam.d/sudo 文件中。 + +``` +auth required pam_yubico.so mode=challenge-response +``` + +将上面的 auth 行插入到 auth 文件中的 system-auth 行的上面,然后保存并退出编辑器。在默认的 Fedora 29 设置中,/etc/pam.d/sudo 应该像下面这样: + +``` +#%PAM-1.0 +auth required pam_yubico.so mode=challenge-response +auth include system-auth +account include system-auth +password include system-auth +session optional pam_keyinit.so revoke +session required pam_limits.so +session include system-auth +``` + +保持原始终端窗口打开,然后打开一个新的终端窗口进行测试,在新的终端窗口中输入: + +``` +$ sudo echo testing +``` + +你应该注意到了 key 上的 LED 在闪烁。点击 Yubikey 按钮,你应该会看见一个输入 sudo 密码的提示。在你输入你的密码之后,你应该会在终端屏幕上看见 ”testing“ 的字样。 + +现在去测试确保正常的失败,启动另一个终端窗口,并从 USB 插口中拔掉 Yubikey。使用下面这条命令验证,在没有 Yubikey 的情况下,sudo 是否会不再正常工作。 + +``` +$ sudo echo testing fail +``` +你应该立刻被提示输入 sudo 密码,即使你输入了正确密码,登陆也应该失败。 + +### 设置 Gnome 桌面管理 + +一旦你的测试完成后,你就可以为图形登陆添加询问-响应支持了。将你的 Yubikey 再次插入进 USB 插口中。然后将下面这几行添加到 /etc/pam.d/gdm-password 文件中: + +``` +auth required pam_yubico.so mode=challenge-response +``` + +打开一个终端窗口,然后运行下面这些命令。如果需要,你可以使用其他的编辑器: + +``` +$ sudo vi /etc/pam.d/gdm-password +``` + +你应该看到 yubikey 上的 LED 在闪烁,按下 yubikey 按钮,然后在提示符出输入密码。 + +修改 /etc/pam.d/gdm-password 文件,在已有的 password-auth 上添加新的 auth 行。这个文件的顶部应该像下面这样: + +``` +auth [success=done ignore=ignore default=bad] pam_selinux_permit.so +auth required pam_yubico.so mode=challenge-response +auth substack password-auth +auth optional pam_gnome_keyring.so +auth include postlogin + +account required pam_nologin.so +``` + +保存更改并退出编辑器,如果你使用的是 vi,输入键是按 Esc 键,然后在提示符出输入 wq! 来保存并退出。 + +### 结论 + +现在注销 GNOME。将 Yubikey 插入到 USB 口,在图形登陆界面上点击你的用户名。Yubikey LED 会开始闪烁。触摸那个按钮,你会被提示输入你的密码。 + +如果你丢失了 Yubikey,除了重置密码之外,你还可以使用备份的 Yubikey。你还可以给你的账户增加额外的 Yubikey 配置。 + +如果有其他人获得了你的密码,他们在没有你的物理硬件 Yubikey 的情况下,仍然不能登陆。恭喜!你已经显著提高了你的工作环境登陆的安全性了。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/login-challenge-response-authentication/ + +作者:[nabooengineer][a] +选题:[lujun9972][b] +译者:[hopefully2333](https://github.com/hopefully2333) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/nabooengineer/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/using-the-yubikey4-with-fedora/ +[2]: https://fedoramagazine.org/fedora-28-better-smart-card-support-openssh/ + From 0ee2f3d8cd5f8c5ca38a63afebb5a36ab705e880 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 24 Dec 2018 08:53:01 +0800 Subject: [PATCH 022/322] translated --- ...Locally As Virtual File System In Linux.md | 135 ----------------- ...Locally As Virtual File System In Linux.md | 136 ++++++++++++++++++ 2 files changed, 136 insertions(+), 135 deletions(-) delete mode 100644 sources/tech/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md create mode 100644 translated/tech/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md diff --git a/sources/tech/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md b/sources/tech/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md deleted file mode 100644 index ae559de4c6..0000000000 --- a/sources/tech/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md +++ /dev/null @@ -1,135 +0,0 @@ -translating---geekpi - -Dbxfs – Mount Dropbox Folder Locally As Virtual File System In Linux -====== - -![](https://www.ostechnix.com/wp-content/uploads/2018/10/dbxfs-720x340.png) - -A while ago, we summarized all the possible ways to **[mount Google drive locally][1]** as a virtual file system and access the files stored in the google drive from your Linux operating system. Today, we are going to learn to mount Dropbox folder in your local file system using **dbxfs** utility. The dbxfs is used to mount your Dropbox folder locally as a virtual filesystem in Unix-like operating systems. While it is easy to [**install Dropbox client**][2] in Linux, this approach slightly differs from the official method. It is a command line dropbox client and requires no disk space for access. The dbxfs application is free, open source and written for Python 3.5+. - -### Installing dbxfs - -The dbxfs officially supports Linux and Mac OS. However, it should work on any POSIX system that provides a **FUSE-compatible library** or has the ability to mount **SMB** shares. Since it is written for Python 3.5, it can installed using **pip3** package manager. Refer the following guide if you haven’t installed PIP yet. - -And, install FUSE library as well. - -On Debian-based systems, run the following command to install FUSE: - -``` -$ sudo apt install libfuse2 - -``` - -On Fedora: - -``` -$ sudo dnf install fuse - -``` - -Once you installed all required dependencies, run the following command to install dbxfs utility: - -``` -$ pip3 install dbxfs - -``` - -### Mount Dropbox folder locally - -Create a mount point to mount your dropbox folder in your local file system. - -``` -$ mkdir ~/mydropbox - -``` - -Then, mount the dropbox folder locally using dbxfs utility as shown below: - -``` -$ dbxfs ~/mydropbox - -``` - -You will be asked to generate an access token: - -![](https://www.ostechnix.com/wp-content/uploads/2018/10/Generate-access-token-1.png) - -To generate an access token, just navigate to the URL given in the above output from your web browser and click **Allow** to authenticate Dropbox access. You need to log in to your dropbox account to complete authorization process. - -A new authorization code will be generated in the next screen. Copy the code and head back to your Terminal and paste it into cli-dbxfs prompt to finish the process. - -You will be then asked to save the credentials for future access. Type **Y** or **N** whether you want to save or decline. And then, you need to enter a passphrase twice for the new access token. - -Finally, click **Y** to accept **“/home/username/mydropbox”** as the default mount point. If you want to set different path, type **N** and enter the location of your choice. - -[![Generate access token 2][3]][4] - -All done! From now on, you can see your Dropbox folder is locally mounted in your filesystem. - -![](https://www.ostechnix.com/wp-content/uploads/2018/10/Dropbox-in-file-manager.png) - -### Change Access Token Storage Path - -By default, the dbxfs application will store your Dropbox access token in the system keyring or an encrypted file. However, you might want to store it in a **gpg** encrypted file or something else. If so, get an access token by creating a personal app on the [Dropbox developers app console][5]. - -![](https://www.ostechnix.com/wp-content/uploads/2018/10/access-token.png) - -Once the app is created, click **Generate** button in the next button. This access token can be used to access your Dropbox account via the API. Don’t share your access token with anyone. - -![](https://www.ostechnix.com/wp-content/uploads/2018/10/Create-a-new-app.png) - -Once you created an access token, encrypt it using any encryption tools of your choice, such as [**Cryptomater**][6], [**Cryptkeeper**][7], [**CryptGo**][8], [**Cryptr**][9], [**Tomb**][10], [**Toplip**][11] and [**GnuPG**][12] etc., and store it in your preferred location. - -Next edit the dbxfs configuration file and add the following line in it: - -``` -"access_token_command": ["gpg", "--decrypt", "/path/to/access/token/file.gpg"] - -``` - -You can find the dbxfs configuration file by running the following command: - -``` -$ dbxfs --print-default-config-file - -``` - -For more details, refer dbxfs help section: - -``` -$ dbxfs -h - -``` - -As you can see, mounting Dropfox folder locally in your file system using Dbxfs utility is no big deal. As far tested, dbxfs just works fine as expected. Give it a try if you’re interested to see how it works and let us know about your experience in the comment section below. - -And, that’s all for now. Hope this was useful. More good stuff to come. Stay tuned! - -Cheers! - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/dbxfs-mount-dropbox-folder-locally-as-virtual-file-system-in-linux/ - -作者:[SK][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.ostechnix.com/author/sk/ -[1]: https://www.ostechnix.com/how-to-mount-google-drive-locally-as-virtual-file-system-in-linux/ -[2]: https://www.ostechnix.com/install-dropbox-in-ubuntu-18-04-lts-desktop/ -[3]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[4]: http://www.ostechnix.com/wp-content/uploads/2018/10/Generate-access-token-2.png -[5]: https://dropbox.com/developers/apps -[6]: https://www.ostechnix.com/cryptomator-open-source-client-side-encryption-tool-cloud/ -[7]: https://www.ostechnix.com/how-to-encrypt-your-personal-foldersdirectories-in-linux-mint-ubuntu-distros/ -[8]: https://www.ostechnix.com/cryptogo-easy-way-encrypt-password-protect-files/ -[9]: https://www.ostechnix.com/cryptr-simple-cli-utility-encrypt-decrypt-files/ -[10]: https://www.ostechnix.com/tomb-file-encryption-tool-protect-secret-files-linux/ -[11]: https://www.ostechnix.com/toplip-strong-file-encryption-decryption-cli-utility/ -[12]: https://www.ostechnix.com/an-easy-way-to-encrypt-and-decrypt-files-from-commandline-in-linux/ diff --git a/translated/tech/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md b/translated/tech/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md new file mode 100644 index 0000000000..889fb00ac8 --- /dev/null +++ b/translated/tech/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md @@ -0,0 +1,136 @@ +Dbxfs - 在 Linux 中本地挂载 Dropbox 文件夹作为虚拟文件系统 +====== + +![](https://www.ostechnix.com/wp-content/uploads/2018/10/dbxfs-720x340.png) + +不久前,我们总结了所有**[在本地挂载 Google Drive][1]**作为虚拟文件系统,并从 Linux 系统访问存储在 Google Drive 中的文件的方法。今天,我们将学习使用 **dbxfs**将 Dropbox 文件夹挂载到本地文件系统中。dbxfs 用于在类 Unix 操作系统中本地挂载 Dropbox 文件夹作为虚拟文件系统。虽然在 Linux 中很容易[**安装 Dropbox 客户端**][2],但这种方法与官方方法略有不同。它是一个命令行 dropbox 客户端,且无需磁盘空间即可访问。dbxfs 是免费、开源的,并且是用 Python 3.5+ 编写的。 + +### 安装 dbxfs + +dbxfs 官方支持 Linux 和 Mac OS。但是,它应该适用于任何提供 **FUSE 兼容库**或能够挂载 **SMB** 共享的 POSIX 系统。由于它是用 Python 3.5 编写的,因此可以使用 **pip3** 包管理器进行安装。如果尚未安装 PIP,请参阅以下指南。 + +[如何使用 pip 管理 Python 包][13] + +并且也要安装 FUSE 库。 + +在基于 Debian 的系统上,运行以下命令以安装 FUSE: + +``` +$ sudo apt install libfuse2 + +``` + +在 Fedora 上: + +``` +$ sudo dnf install fuse + +``` + +安装完所有必需的依赖项后,运行以下命令以安装 dbxfs: + +``` +$ pip3 install dbxfs + +``` + +### 在本地挂载 Dropbox 文件夹 + +创建一个挂载点以将 Dropbox 文件夹挂载到本地文件系统中。 + +``` +$ mkdir ~/mydropbox + +``` + +然后,使用 dbxfs 在本地挂载 dropbox 文件夹,如下所示: + +``` +$ dbxfs ~/mydropbox + +``` + +你将被要求生成一个访问令牌: + +![](https://www.ostechnix.com/wp-content/uploads/2018/10/Generate-access-token-1.png) + +要生成访问令牌,只需在 Web 浏览器中输入上面输出的 URL,然后单击**允许** 以授权 Dropbox 访问。你需要登录 Dropbox 帐户才能完成授权过程。 + +下一个页面将生成新的授权码。复制代码并返回终端将其粘贴到 cli-dbxfs 提示符中以完成该过程。 + +然后,系统会要求你保存凭据以供将来访问。无论你是要保存还是拒绝,输入 **Y** 或 **N**。然后,你需要为新的访问令牌输入两次密码。 + +最后,输入 **Y** 接受 **“/home/username/mydropbox”** 作为默认挂载点。如果你要设置不同的路径,输入 **N** 并输入你选择的位置。 + +[![Generate access token 2][3]][4] + +完成了!从现在开始,你可以看到你的 Dropbox 文件夹已挂载到本地文件系统中。 + +![](https://www.ostechnix.com/wp-content/uploads/2018/10/Dropbox-in-file-manager.png) + +### 更改访问令牌存储路径 + +默认情况下,dbxfs 会将 Dropbox 访问令牌存储在系统密钥环或加密文件中。但是,你可能希望将其存储在 **gpg** 加密文件或其他地方。如果是这样,请在 [Dropbox 开发者应用控制台][5]上创建个人应用来获取访问令牌。 + +![](https://www.ostechnix.com/wp-content/uploads/2018/10/access-token.png) + +创建应用后,单击下一步中的**生成**按钮。此令牌可用于通过 API 访问你的 Dropbox 帐户。不要与任何人共享你的访问令牌。 + +![](https://www.ostechnix.com/wp-content/uploads/2018/10/Create-a-new-app.png) + +创建访问令牌后,使用任何你选择的加密工具对其进行加密,例如 [**Cryptomater**][6]、[**Cryptkeeper**][7]、[**CryptGo**][8]、[**Cryptr**][9]、[**Tomb**][10]、[**Toplip**][11] 和 [**GnuPG**][12] 等,并在你喜欢的位置保存。 + +接下来编辑 dbxfs 配置文件并添加以下行: + +``` +"access_token_command": ["gpg", "--decrypt", "/path/to/access/token/file.gpg"] + +``` + +你可以通过运行以下命令找到 dbxfs 配置文件: + +``` +$ dbxfs --print-default-config-file + +``` + +有关更多详细信息,请参阅 dbxfs 帮助: + +``` +$ dbxfs -h + +``` + +如你所见,使用 dbxfs 在你的文件系统中本地挂载 Dropfox 文件夹没什么大不了的。经过测试,dbxfs 如常工作。如果你有兴趣了解它是如何工作的,请尝试一下,并在下面的评论栏告诉我们你的体验。 + +就是这些了。希望这篇文章有用。还有更多好东西。敬请期待! + +干杯! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/dbxfs-mount-dropbox-folder-locally-as-virtual-file-system-in-linux/ + +作者:[SK][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/sk/ +[1]: https://www.ostechnix.com/how-to-mount-google-drive-locally-as-virtual-file-system-in-linux/ +[2]: https://www.ostechnix.com/install-dropbox-in-ubuntu-18-04-lts-desktop/ +[3]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[4]: http://www.ostechnix.com/wp-content/uploads/2018/10/Generate-access-token-2.png +[5]: https://dropbox.com/developers/apps +[6]: https://www.ostechnix.com/cryptomator-open-source-client-side-encryption-tool-cloud/ +[7]: https://www.ostechnix.com/how-to-encrypt-your-personal-foldersdirectories-in-linux-mint-ubuntu-distros/ +[8]: https://www.ostechnix.com/cryptogo-easy-way-encrypt-password-protect-files/ +[9]: https://www.ostechnix.com/cryptr-simple-cli-utility-encrypt-decrypt-files/ +[10]: https://www.ostechnix.com/tomb-file-encryption-tool-protect-secret-files-linux/ +[11]: https://www.ostechnix.com/toplip-strong-file-encryption-decryption-cli-utility/ +[12]: https://www.ostechnix.com/an-easy-way-to-encrypt-and-decrypt-files-from-commandline-in-linux/ +[13]:https://www.ostechnix.com/manage-python-packages-using-pip/ \ No newline at end of file From 9028d7c70ec81862b3df219fa8cf66ac8ea58c17 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 24 Dec 2018 09:03:09 +0800 Subject: [PATCH 023/322] translated --- ...0181214 How To Install Rust Programming Language In Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181214 How To Install Rust Programming Language In Linux.md b/sources/tech/20181214 How To Install Rust Programming Language In Linux.md index 074c41e9f9..c39e037d6d 100644 --- a/sources/tech/20181214 How To Install Rust Programming Language In Linux.md +++ b/sources/tech/20181214 How To Install Rust Programming Language In Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 62c118328fbf2b163c1253624448c165e4cd47c8 Mon Sep 17 00:00:00 2001 From: zjon Date: Mon, 24 Dec 2018 09:54:35 +0800 Subject: [PATCH 024/322] Delete 20171012 7 Best eBook Readers for Linux.md delete 20171012 7 Best eBook Readers for Linux.md from sources dir --- ...20171012 7 Best eBook Readers for Linux.md | 182 ------------------ 1 file changed, 182 deletions(-) delete mode 100644 sources/tech/20171012 7 Best eBook Readers for Linux.md diff --git a/sources/tech/20171012 7 Best eBook Readers for Linux.md b/sources/tech/20171012 7 Best eBook Readers for Linux.md deleted file mode 100644 index 520c9c4533..0000000000 --- a/sources/tech/20171012 7 Best eBook Readers for Linux.md +++ /dev/null @@ -1,182 +0,0 @@ -7 个最佳 Linux 电子书阅读器 -====== -**摘要:** 文章中我们涉及一些 Linux 最佳电子书阅读器。这些应用提供更佳阅读体验甚至会管理你的电子书。 - -![最佳 Linux 电子书阅读器][1] - -最近,随着人们发现在手持设备,Kindle 或者 PC 上阅读更佳舒适,对电子图书的需求有所增加。谈到 Linux 用户,有各种电子书应用满足你阅读和整理电子书的需求。 - -在本文中,我们选出了七个最佳 Linux 电子书阅读器。这些电子书阅读器最适合 pdf,epubs 和其他电子书格式。 - -## 最佳 Linux 电子书阅读器 - -我提供 Ubuntu 安装说明,因为我现在使用。如果你使用[非 Ubuntu 发行版][2],你能在你的发行版软件仓库中找到大多数这些电子书应用。 - -### 1. Calibre - -[Calibre][3] 是 Linux 最受欢迎的电子书应用。老实说,这不仅仅是一个简单的电子书阅读器。它是一个完整的电子书解决方案。你甚至能[通过 Calibre 创建私人电子][4] - -通过强大的电子书管理和易用的接口,它具有创建和编辑电子书。Calibre 支持多种格式和与其他电子书阅读器同步。它也可以让你轻松转换一种电子书格式到另一种。 - -Calibre 最大的缺点是,资源上太沉重,让它成为一个艰难的选择作为一个独立的电子阅读器。 - -![Calibre][5] - -#### 特性 - - * 管理电子书:Calibre 通过管理云数据允许存储和分组电子书。你能下载一本电子书的元数据从各种来源或创建和编辑现有的字段。 - * 支持所有主流电子书格式: Calibre 支持所有主流电子书格式并兼容多种电子阅读器。 - * 文件转换: 在转换时,你能通过改变电子书风格,创建内容表和调整边距的选项来转换任何一种电子书格式到另一种。你也能转换个人文档为电子书。 - * 从 web 下载杂志期刊:Calibre 能从各种新闻源或者通过 RSS 订阅源传递故事。 - * 分享和备份你的电子图书馆:它提供了一个选项,托管你电子书集合到它的服务端,从而你能与好友共享或用任何设备从任何地方访问。备份和导入/导出特性允许你保证你的收藏安全和方便携带。 - -#### 安装 - -你能在主流 Linux 发行版的软件库中找到它。对于 Ubuntu,在软件中心搜索它或者使用下面的命令: - -`sudo apt-get install calibre` - -### 2. FBReader - -![FBReader: Linux 电子书阅读器][6] - -[FBReader][7] 是一个开源的轻量级多平台电子书阅读器,它支持多种格式,比如 ePub,fb2,mobi,rtf,html 等。它包含一些允许访问的流行网络电子图书馆,那里你能免费或付费下载电子书。 - -#### 特性 - - * 支持多种文件格式和设备比如 Android,iOS,Windows,Mac 和更多。 - * 同步书籍收藏,阅读位置和书签。 - * 在线管理你图书馆中从你的 Linux 桌面添加到所有设备的任何书。 - * 支持 Web 浏览器允许你的存储集。 - * 支持 Google Drive 做书籍的存储和通过作者,系列或其他属性整理书籍。 - -#### 安装 - -你能从官方库或者在终端中输入一下命令安装 FBReader 电子阅读器。 -``` -sudo apt-get install fbreader -``` - -或者你能从[这里][8]抓取一个以 .deb 包并在你的基于 Debian 发行版的系统上安装它。 - -### 3. Okular - -[Okular][9] 是另一个开源的基于 KDE 开发的跨平台文档查看器,它已经作为 KDE 应用发布的一部分了。 - -![Okular][10] - -#### 特性 - - * Okular 支持多种文档格式像 PDF,Postscript,DjVu,DHM,XPS,ePub 和其他。 - * 支持在 PDF 文档中评论,高亮和绘制不通的形状等。 - * 无需修改原始 PDF 文件分别保存这些更改。 - * 电子书中的文本能被提取到一个文本文件,这个内置文本阅读服务叫 Jovie。 - -备注:检查应用的时候,我发现这个应用在 Ubuntu 和它的衍生系统不支持 ePub 文件格式。其他发行版用户仍然可以发挥它全部的潜力。 - -#### 安装 - -Ubuntu 用户可以在终端中键入下面的命令来安装它: -``` -sudo apt-get install okular -``` - -### 4. Lucidor - -Lucidor 是一个易用的支持 epub 文件格式和在 OPDS 格式中编目的电子阅读器。它也具有电子书集合在本地书柜里,搜索和下载互联网和 web 订阅和网页转换成电子书的功能。 - -Lucidor 是 XULRunner 应用程序,它向您展示了具有类火狐的选项卡式布局,和存储数据和配置时的展现。他是列表中最简单的电子阅读器,包括诸如文本说明和滚动选项之类的配置。 - -![lucidor][11] - -你可以通过选择单词并右击 > 查找单词来查找 Wiktionary.org 的定义。它也包含 web 订阅或 web 页面作为电子书的选项。 - -你能从[这里][12]下载和安装 deb 或者 RPM 包。 - -### 5. Bookworm - -![Bookworm Linux 电子阅读器][13] - -Bookworm 是另一个支持多种文件格式诸如 epub, pdf, mobi, cbr and cbz 的免费开源的电子阅读器。我写了一篇关于 Bookworm 应用程序的特性和安装的专题文章,到这里阅读: [Bookworm: 一个简单而强大的 Linux 电子阅读器][14] - -#### 安装 -``` -sudo apt-add-repository ppa:bookworm-team/bookworm -sudo apt-get update -sudo apt-get install bookworm -``` - -### 6. Easy Ebook Viewer - -[Easy Ebook Viewer][15] 是另外一个用于读取 ePub 文件的很棒的 GTK python 应用.具有基本章节导航、从上次阅读位置继续、从其他电子书文件格式导入、章节跳转等功能,Easy Ebook Viewer 是一个简单而简约的 ePub 阅读器. - -![Easy-Ebook-Viewer][16] - -这个应用仍然处于初始阶段,只支持ePub文件。 - -#### 安装 - -你可以从 [github][17] 下载源代码和自己编译以及依赖项来安装 Easy Ebook Viewer。或者,以下终端命令将执行完全相同的工作。 -``` -sudo apt install git gir1.2-webkit-3.0 libwebkitgtk-3.0-0 gir1.2-gtk-3.0 python3-gi -git clone https://github.com/michaldaniel/Ebook-Viewer.git -cd Ebook-Viewer/ -sudo make install -``` - -成功完成上述步骤后,你可以从Dash启动它。 - -### 7. Buka - -Buka 主要是一个具有简单而清爽的用户界面的电子书管理器。它目前支持 PDF 格式,旨在帮助用户更加关注内容。拥有 pdf 阅读器的所有基本特性,Buka 允许你通过箭头键导航,具有缩放选项,并且能并排查看 2 页。 - -你可以创建单独的 PDF 文件列表并轻松地在它们之间切换。Buka也提供了一个内置翻译工具,但是你需要有效的互联网连接来使用这个特性。 - -![Buka][19] - -#### 安装 - -你能从[官方下载页面][20]下载一个 AppImage。如果你不知道,请阅读[如何在 Linux 下使用 AppImage][21]。或者,你可以通过命令行安装它: -``` -sudo snap install buka -``` - -### 结束语 - -就我个人而言,我发现 Calibre 最适合我的需要。当然,Bookworm 看起来很有前途,这几天我经常使用它。不过,电子书应用的选择完全取决于你的喜好。 - -你使用哪个电子书应用呢?在下面的评论中让我们知道。 - - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/best-ebook-readers-linux/ - -作者:[Ambarish Kumar][a] -译者:[zjon](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://itsfoss.com/author/ambarish/ -[1]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/10/best-ebook-readers-linux-800x450.png -[2]:https://itsfoss.com/non-ubuntu-beginner-linux/ -[3]:https://www.calibre-ebook.com -[4]:https://itsfoss.com/create-ebook-calibre-linux/ -[5]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Calibre-800x603.jpeg -[6]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/10/fbreader-800x624.jpeg -[7]:https://fbreader.org -[8]:https://fbreader.org/content/fbreader-beta-linux-desktop -[9]:https://okular.kde.org/ -[10]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Okular-800x435.jpg -[11]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/lucidor-2.png -[12]:http://lucidor.org/lucidor/download.php -[13]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/08/bookworm-ebook-reader-linux-800x450.jpeg -[14]:https://itsfoss.com/bookworm-ebook-reader-linux/ -[15]:https://github.com/michaldaniel/Ebook-Viewer -[16]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Easy-Ebook-Viewer.jpg -[17]:https://github.com/michaldaniel/Ebook-Viewer.git -[18]:https://github.com/oguzhaninan/Buka -[19]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Buka2-800x555.png -[20]:https://github.com/oguzhaninan/Buka/releases -[21]:https://itsfoss.com/use-appimage-linux/ From 30d258a85352887e90efd5e04f636340b46a4674 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 24 Dec 2018 12:38:13 +0800 Subject: [PATCH 025/322] PRF:20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md @qhwdw --- ...mputing with Open Source Cirq Framework.md | 83 +++++++++---------- 1 file changed, 40 insertions(+), 43 deletions(-) diff --git a/translated/tech/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md b/translated/tech/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md index fcbc89e77c..c1be5d0ddf 100644 --- a/translated/tech/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md +++ b/translated/tech/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md @@ -1,24 +1,25 @@ 量子计算的开源框架 Cirq 介绍 ====== + 我们即将讨论的内容正如标题所示,本文通过使用 Cirq 的一个开源视角,尝试去了解我们已经在量子计算领域取得多大的成就,和该领域的发展方向,以加快科学和技术研究。 -首先,我们将引领你进入量子计算的世界。在我们深入了解 Cirq 在未来的量子计算中扮演什么样的重要角色之前,我们将尽量向你解释其背后的基本概念。Cirq,你最近可能听说过,在这个领域中已经发生了重大新闻,在 Open Science 上的文章中,我们将去尝试找出答案。 +首先,我们将引领你进入量子计算的世界。在我们深入了解 Cirq 在未来的量子计算中扮演什么样的重要角色之前,我们将尽量向你解释其背后的基本概念。你最近可能听说过,在这个领域中有件重大新闻,就是 Cirq。在这篇开放科学栏目的文章中,我们将去尝试找出答案。 - +- [How it Works - Quantum Computing](https://www.youtube.com/WVv5OAR4Nik) -在我们开始了解量子计算之前,必须先去了解“量子”这个术语,量子是已知的 [亚原子粒子][1] 中最小的物质。[量子][2] 这个词来自拉丁语 Quantus,意思是 “有多少”,在下面的短视频链接中有描述: +在我们开始了解量子计算之前,必须先去了解“量子”这个术语,量子是已知的 [亚原子粒子][1] 中最小的物质。[量子][2]Quantum 这个词来自拉丁语 Quantus,意思是 “有多小”,在下面的短视频链接中有描述: - +- [What is a quantum Why is it significant](https://www.youtube.com/-pUOxVsxu3o) -为了易于我们理解量子计算,我们将量子计算与经典计算Classical Computing(也有译做传统计算)进行比较。经典计算是指设计用于工作的、正在使用的计算机,正如你现在用于阅读本文的设备,就是我们所谓的经典计算设备。 +为了易于我们理解量子计算,我们将量子计算Quantum Computing经典计算Classical Computing(LCTT 译注:也有译做“传统计算”)进行比较。经典计算是指今天的传统计算机如何设计工作的,正如你现在用于阅读本文的设备,就是我们所谓的经典计算设备。 ### 经典计算 -经典计算是描述计算机如何工作的另一种方式。它们通过一个二进制系统工作,即信息使用 1 或 0 来存储。经典计算机不会理解除 1 或 0 之外的任何其它东西。 +经典计算只是描述计算机如何工作的另一种方式。它们通过一个二进制系统工作,即信息使用 1 或 0 来存储。经典计算机不会理解除 1 或 0 之外的任何其它东西。 -直白来说,在计算机内部一个晶体管只能是开(1)或关(0)。我们输入的任何信息都被转换为无数个 1 和 0,所以计算机只能理解和存储 1 和 0。所有的东西都只能用无数个 1 和 0 的组合来表示。 +直白来说,在计算机内部一个晶体管只能是开(1)或关(0)。我们输入的任何信息都被转换为无数个 1 和 0,以便计算机能理解和存储。所有的东西都只能用无数个 1 和 0 的组合来表示。 - +- [Why Do Computers Use 1s and 0s Binary and Transistors Explained](https://www.youtube.com/Xpk67YzOn5w) ### 量子计算 @@ -26,39 +27,39 @@ 请注意,叠加和纠缠 [不是同一个现象][4]。 - +- [How Do Quantum Computers Work!](https://www.youtube.com/jiXuVIEg10Q) ![][5] -就像在经典计算中,我们有比特bit,在量子计算中,我们相应也有量子比特qubits(或 Quantum bits)。想了解它们二者之间的巨大差异之处,请查看这个 [页面][6],从那里的图片中可以得到答案。 +就像在经典计算中,我们有比特bit,在量子计算中,我们相应也有量子比特qubit(即 Quantum bit)。想了解它们二者之间的巨大差异之处,请查看这个 [页面][6],从那里的图片中可以得到答案。 量子计算机并不是来替代我们的经典计算机的。但是,有一些非常巨大的任务用我们的经典计算机是无法完成的,而那些正是量子计算机大显身手的好机会。下面链接的视频详细描述了上述情况,同时也描述了量子计算机的原理。 - +- [Quantum Computers Explained – Limits of Human Technology](https://www.youtube.com/JhHMJCUmq28) 下面的视频全面描述了量子计算领域到目前为止的最新进展: - +- [Quantum Computing 2018 Update](https://www.youtube.com/CeuIop_j2bI) ### 嘈杂中型量子 -根据最新更新的(2018 年 7 月 31 日)研究论文,术语 “Noisy” 是指由于对量子比特未能完全控制所产生的不准确性。正是这种不准确性严重制约了量子设备短期内实现其目标。 +根据最新更新的(2018 年 7 月 31 日)研究论文,术语 “嘈杂Noisy” 是指由于对量子比特未能完全控制所产生的不准确性。正是这种不准确性在短期内严重制约了量子设备实现其目标。 -“中型” 指的是在接下来的几年中,量子计算机将要实现的量子规模大小,届时,量子比特的数目将可能从 50 到几百个不等。50 个量子比特是一个重大的量程碑,因为它将超越现有的最强大的 [超级计算机][8] 的 [暴力][7] 模拟能力。更多信息请阅读 [这里的][9] 论文。 +“中型” 指的是在接下来的几年中,量子计算机将要实现的量子规模大小,届时,量子比特的数目将可能从 50 到几百个不等。50 个量子比特是一个重大的量程碑,因为它将超越现有的最强大的 [超级计算机][8] 的 [暴力破解][7] 所能比拟的计算能力。更多信息请阅读 [这里的][9] 论文。 随着 Cirq 出现,许多事情将会发生变化。 ### Cirq 是什么? -Cirq 是一个 python 框架,它用于创建、编辑和调用我们前面讨论的嘈杂中型量子(NISQ)。换句话说,Cirq 能够解决挑战,去改善精确度和降低量子计算中的噪声。 +Cirq 是一个 Python 框架,它用于创建、编辑和调用我们前面讨论的嘈杂中型量子(NISQ)。换句话说,Cirq 能够解决挑战,去改善精确度和降低量子计算中的噪声。 Cirq 并不需要必须有一台真实的量子计算机。Cirq 能够使用一个类似模拟器的界面去执行量子电路模拟。 -Cirq 的前进步伐越来越快了,[Zapata][10] 是使用它的首批用户之一,Zapata 是由来自哈佛大学的一群专注于量子计算的科学家在去年成立的。 +Cirq 的前进步伐越来越快了,[Zapata][10] 是使用它的首批用户之一,Zapata 是由来自哈佛大学的专注于量子计算的[一群科学家][11]在去年成立的。 ### Linux 上使用 Cirq 入门 -开源的 [Cirq 库][12] 开发者建议将它安装在像 [virtualenv][14] 这样的一个 [虚拟 python 环境][13] 中。在 Linux 上的开发者安装指南可以在 [这里][15] 找到。 +开源的 [Cirq 库][12] 开发者建议将它安装在像 [virtualenv][14] 这样的一个 [虚拟 Python 环境][13] 中。在 Linux 上的开发者安装指南可以在 [这里][15] 找到。 但我们在 Ubuntu 16.04 的系统上成功地安装和测试了 Python3 的 Cirq 库,安装步骤如下: @@ -66,43 +67,41 @@ Cirq 的前进步伐越来越快了,[Zapata][10] 是使用它的首批用户 ![Cirq Framework for Quantum Computing in Linux][16] -首先,我们需要 pip 或 pip3 去安装 Cirq。[Pip][17] 是推荐用于安装和管理 Python 包的工具。 +首先,我们需要 `pip` 或 `pip3` 去安装 Cirq。[Pip][17] 是推荐用于安装和管理 Python 包的工具。 对于 Python 3.x 版本,Pip 能够用如下的命令来安装: + ``` sudo apt-get install python3-pip - ``` Python3 包能够通过如下的命令来安装: + ``` pip3 install - ``` 我们继续去使用 Pip3 为 Python3 安装 Cirq 库: + ``` pip3 install cirq - ``` #### 启用 Plot 和 PDF 生成(可选) -可选系统的依赖没有安装的,可以使用 pip 去安装它: +可选系统的依赖没有被 Pip 安装的,可以使用如下命令去安装它: + ``` sudo apt-get install python3-tk texlive-latex-base latexmk - ``` * python3-tk 是 Python 自有的启用了绘图功能的图形库 * texlive-latex-base 和 latexmk 启动了 PDF 输出功能。 - - 最后,我们使用如下的命令和代码成功测试了 Cirq: + ``` python3 -c 'import cirq; print(cirq.google.Foxtail)' - ``` 我们得到的输出如下图: @@ -113,27 +112,27 @@ python3 -c 'import cirq; print(cirq.google.Foxtail)' 我们也配置了一个 Python IDE [PyCharm][19] 去测试同样的结果: -因为在我们的 Linux 系统上为 Python3 安装了 Cirq,我们在 IDE 中配置项目解释器路径: +因为在我们的 Linux 系统上为 Python3 安装了 Cirq,我们在 IDE 中配置项目解释器路径为: + ``` /usr/bin/python3 - ``` ![][20] -在上面的输出中,你可能注意到我们刚设置的项目解释器路径与测试程序文件(test.py)的路径显示在一起。退出代码 0 表示程序已经成功退出,没有错误。 +在上面的输出中,你可能注意到我们刚设置的项目解释器路径与测试程序文件(`test.py`)的路径显示在一起。退出代码 0 表示程序已经成功退出,没有错误。 -因此,那是一个现成的 IDE 环境,你可以导入 Cirq 库去开始使用 Python 去编程和模拟量子电路。 +因此,那是一个已经就绪的 IDE 环境,你可以导入 Cirq 库去开始使用 Python 去编程和模拟量子电路。 #### Cirq 使用入门 Criq 入门的一个好的开端就是它 GitHub 页面上的 [示例][21]。 -Cirq 的开发者在 GitHub 上已经放了学习 [教程][22]。如果你想认真地学习量子计算,他们推荐你去看一本非常好的书,它是[由 Nielsen 和 Chuang 写的名为 “量子计算和量子信息“][23]。 +Cirq 的开发者在 GitHub 上已经放置了学习 [教程][22]。如果你想认真地学习量子计算,他们推荐你去看一本非常好的书,它是[由 Nielsen 和 Chuang 写的名为 《量子计算和量子信息》][23]。 #### OpenFermion-Cirq -[OpenFermion][24] 是一个开源库,它是为了在量子计算机上模拟获取和操纵代表的费米系统(包含量子化学)。根据 [粒子物理学][26] 理论,按照 [费米— 狄拉克统计][27],费米系统与 [费米子][25] 的产生相关。 +[OpenFermion][24] 是一个开源库,它是为了在量子计算机上模拟获取和操纵代表的费米系统(包含量子化学)。根据 [粒子物理学][26] 理论,按照 [费米—狄拉克统计][27],费米系统与 [费米子][25] 的产生相关。 OpenFermion 被称为从事 [量子化学][29] 的化学家和研究人员的 [一个极好的实践工具][28]。量子化学主要专注于 [量子力学][30] 在物理模型和化学系统实验中的应用。量子化学也被称为 [分子量子力学][31]。 @@ -141,7 +140,7 @@ Cirq 的出现使 OpenFermion 通过提供程序和工具去扩展功能成为 #### Google Bristlecone -2018 年 3 月 5 日,在洛杉矶举行的一年一度的 [美国物理学会会议][33] 上,Google 发布了 [Bristlecone][32],这是他们的最新的量子处理器。这个 [基于门的超导系统][34] 为 Google 提供了一个测试平台,用以研究 [量子比特技术][37] 的 [系统错误率][35] 和 [扩展性][36] ,以及在量子 [仿真][38]、[优化][39]、和 [机器学习][40] 方面的应用。 +2018 年 3 月 5 日,在洛杉矶举行的一年一度的 [美国物理学会会议][33] 上,Google 发布了 [Bristlecone][32],这是他们的最新的量子处理器。这个 [基于门的超导系统][34] 为 Google 提供了一个测试平台,用以研究 [量子比特技术][37] 的 [系统错误率][35] 和 [扩展性][36] ,以及在量子 [仿真][38]、[优化][39] 和 [机器学习][40] 方面的应用。 Google 希望在不久的将来,能够制造出它的 [云可访问][41] 的 72 个量子比特的 Bristlecone 量子处理器。Bristlecone 将越来越有能力完成一个经典超级计算机无法在合理时间内完成的任务。 @@ -154,11 +153,9 @@ Cirq 将允许我们去: * 在设备上放置适当的门 * 并调度这个门的时刻 +### 开放科学关于 Cirq 的观点 - -### Open Science 关于 Cirq 的观点 - -我们知道 Cirq 是在 GitHub 上开源的,它除了在 Open Science 社区之外,特别是那些专注于量子研究的人们,都可以高效率地合作,通过开发新方法,去降低现有量子模型中的错误率和提升精确度,以解决目前在量子计算中所面临的挑战。 +我们知道 Cirq 是在 GitHub 上开源的,在开源科学社区之外,特别是那些专注于量子研究的人们,都可以通过高效率地合作,通过开发新方法,去降低现有量子模型中的错误率和提升精确度,以解决目前在量子计算中所面临的挑战。 如果 Cirq 不走开源模型的路线,事情可能变得更具挑战。一个伟大的创举可能就此错过,我们可能在量子计算领域止步不前。 @@ -170,7 +167,7 @@ Cirq 将允许我们去: 最后,我们看了两个示例 OpenFermion 和 Bristlecone,介绍了在量子计算中,Cirq 在开发研究中具有什么样的基本优势。最后我们以 Open Science 社区的视角对 Cirq 进行了一些精彩的思考,结束了我们的话题。 -我们希望能以一种易于理解的方式向你介绍量子计算框架 Cirq 的使用。如果你有与此相关的任何反馈,请在下面的评论区告诉我们。感谢阅读,希望我们能在 Open Science 的下一篇文章中再见。 +我们希望能以一种易于理解的方式向你介绍量子计算框架 Cirq 的使用。如果你有与此相关的任何反馈,请在下面的评论区告诉我们。感谢阅读,希望我们能在开放科学栏目的下一篇文章中再见。 -------------------------------------------------------------------------------- @@ -179,7 +176,7 @@ via: https://itsfoss.com/qunatum-computing-cirq-framework/ 作者:[Avimanyu Bandyopadhyay][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[qhwdw](https://github.com/qhwdw) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -188,7 +185,7 @@ via: https://itsfoss.com/qunatum-computing-cirq-framework/ [2]:https://en.wikipedia.org/wiki/Quantum [3]:https://www.clerro.com/guide/491/quantum-superposition-and-entanglement-explained [4]:https://physics.stackexchange.com/questions/148131/can-quantum-entanglement-and-quantum-superposition-be-considered-the-same-phenom -[5]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/08/bit-vs-qubit.jpg +[5]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/08/bit-vs-qubit.jpg?w=576&ssl=1 [6]:http://www.rfwireless-world.com/Terminology/Difference-between-Bit-and-Qubit.html [7]:https://en.wikipedia.org/wiki/Proof_by_exhaustion [8]:https://www.explainthatstuff.com/how-supercomputers-work.html @@ -199,11 +196,11 @@ via: https://itsfoss.com/qunatum-computing-cirq-framework/ [13]:https://itsfoss.com/python-setup-linux/ [14]:https://virtualenv.pypa.io [15]:https://cirq.readthedocs.io/en/latest/install.html#installing-on-linux -[16]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/08/cirq-framework-linux.jpeg +[16]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/08/cirq-framework-linux.jpeg [17]:https://pypi.org/project/pip/ -[18]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/08/cirq-test-output.jpg +[18]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/08/cirq-test-output.jpg [19]:https://itsfoss.com/install-pycharm-ubuntu/ -[20]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/08/cirq-tested-on-pycharm.jpg +[20]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/08/cirq-tested-on-pycharm.jpg [21]:https://github.com/quantumlib/Cirq/tree/master/examples [22]:https://github.com/quantumlib/Cirq/blob/master/docs/tutorial.md [23]:http://mmrc.amss.cas.cn/tlb/201702/W020170224608149940643.pdf From 8708ba3fc8c0d68f354c3c589d9d1b83eb5517e1 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 24 Dec 2018 12:38:46 +0800 Subject: [PATCH 026/322] PUB:20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md @qhwdw https://linux.cn/article-10376-1.html --- ...uction to Quantum Computing with Open Source Cirq Framework.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md (100%) diff --git a/translated/tech/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md b/published/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md similarity index 100% rename from translated/tech/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md rename to published/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md From 4f808d9693a13f8b54a964f4663290b2c768c62c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 24 Dec 2018 12:54:29 +0800 Subject: [PATCH 027/322] PRF:20181212 Aliases- DIY Shell Commands.md @HankChow --- .../20181212 Aliases- DIY Shell Commands.md | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/translated/tech/20181212 Aliases- DIY Shell Commands.md b/translated/tech/20181212 Aliases- DIY Shell Commands.md index d7d0c9d096..cbce2581af 100644 --- a/translated/tech/20181212 Aliases- DIY Shell Commands.md +++ b/translated/tech/20181212 Aliases- DIY Shell Commands.md @@ -1,9 +1,10 @@ 命令别名:定义自己的命令 ====== +> 学习如何创建别名:你可以将太长或难以记忆的命令打包成你自己构建的命令。 ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/jodi-mucha-540841-unsplash.jpg?itok=n1d1VDUV) -命令别名Alias在 Linux shell 中指的是将一些太长或者太难记的多个命令组合起来,成为一个由用户自定义构建的命令。 +命令别名Alias在 Linux shell 中指的是将一些太长或者太难记的多个命令组合起来,成为一个由用户自己构建的命令。 可以通过 `alias` 命令来创建命令别名。在 `alias` 后面跟上想要创建的别名名称、一个等号(`=`),以及希望使用这个别名来执行的命令,这样一个命令别名就创建好了。举个例子,`ls` 命令在默认情况下是不会对输出的内容进行着色的,这样就不能让用户一眼分辨出目录、文件和连接了。对此,可以创建这样一个命令别名,在输出目录内容的时候为输出内容着色: @@ -11,7 +12,7 @@ alias lc='ls --color=auto' ``` -其中 `lc` 是自定义的命令别名,代表“list with color”的意思。在创建命令别名的时候,需要先确认使用的别名是不是已经有对应的命令了,如果有的话,原本的命令就会被覆盖掉了。注意,定义命令别名的时候,`=` 两端是没有空格的。当运行 `lc` 的时候,就相当于执行了 `ls --color` 命令。 +其中 `lc` 是自定义的命令别名,代表 “list with color” 的意思。在创建命令别名的时候,需要先确认使用的别名是不是已经有对应的命令了,如果有的话,原本的命令就会被覆盖掉了。注意,定义命令别名的时候,`=` 两端是没有空格的。当运行 `lc` 的时候,就相当于执行了 `ls --color` 命令。 此后,执行 `lc` 列出目录内容的时候,就会输出带有着色的内容了。 @@ -25,9 +26,7 @@ alias lc='ls --color=auto' * `alias cp='cp -i'`:`-i` 参数代表“交互interactive”。在使用 `cp` 命令复制文件的时候,可能会无意中覆盖现有的文件,在使用了 `-i` 参数之后,`cp` 命令会在一些关键操作前向用户发出询问。 * `alias free='free -m'`:在 `free` 命令后面加上 `-m` 参数,就可以将输出的内存信息以 MiB 这个更方面阅读和计算的单位输出,而不是默认的 Byte 单位。 - - -你使用的发行版自带的命令别名可能多多少少和上面有些差别。但你都可以在命令前面加上 `\` 修饰符来使用命令的最基本形式。例如: +你使用的发行版自带的命令别名可能多多少少和上面有些差别。但你都可以在命令前面加上 `\` 修饰符来使用命令的最基本形式(而不是别名)。例如: ``` \free @@ -41,7 +40,7 @@ alias lc='ls --color=auto' 执行的就是不带有`--color=auto` 参数的 `ls`。 -如果想要持久地保存命令别名,可以在 `.bashrc` 文件中进行修改。 +如果想要持久地保存命令别名,可以在 `.bashrc` 文件中进行修改,而它[来源于我们的 /etc/skel 目录][1]。 ### 使用命令别名纠正错误 @@ -62,7 +61,7 @@ alias move='mv' 也可以在尚未完全熟悉 Linux 的时候用得顺手。 -还有一种情况,就是在经常出现输入错误的场合中做出容错,例如 Administration 这个单词就很难快速正确地输入,因此很多用户都会设置 +还有一种情况,就是在经常出现输入错误的场合中做出容错,例如,对于我来说, Administration 这个单词就很难快速正确地输入,因此很多用户都会设置类似这样的别名: ``` alias sl='ls' @@ -74,7 +73,7 @@ alias sl='ls' alias gerp='echo "You did it *again*!"; grep' ``` - `grep` 命令最基本的用途就是在文件中查找字符串,在熟悉这个命令之后,它一定是最常用的命令之一,因此输入错误导致不得不重输命令就很令人抓狂。 +`grep` 命令最基本的用途就是在文件中查找字符串,在熟悉这个命令之后,它一定是最常用的命令之一,因此输入错误导致不得不重输命令就很令人抓狂。 在上面 `gerp` 的例子中,包含的不只是一条命令,而是两条。第一条命令 `echo "You did it *again*!"` 输出了一条提醒用户拼写错误的消息,然后使用分号(`;`)把两条命令隔开,再往后才是 `grep` 这一条正确的命令。 @@ -82,16 +81,16 @@ alias gerp='echo "You did it *again*!"; grep' ``` $ gerp -R alias /etc/skel/.bashrc -You did it *again*! - alias ls='ls --color=auto' - alias grep='grep --colour=auto' - alias egrep='egrep --colour=auto' - alias fgrep='fgrep --colour=auto' +You did it *again*! + alias ls='ls --color=auto' + alias grep='grep --colour=auto' + alias egrep='egrep --colour=auto' + alias fgrep='fgrep --colour=auto' alias cp="cp -i" alias df='df -h' alias free='free -m' -alias np='nano -w PKGBUILD' -alias more=less +alias np='nano -w PKGBUILD' +alias more=less shopt -s expand_aliases ``` @@ -112,12 +111,12 @@ via: https://www.linux.com/blog/learn/2018/12/aliases-diy-shell-commands 作者:[Paul Brown][a] 选题:[lujun9972][b] 译者:[HankChow](https://github.com/HankChow) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://www.linux.com/users/bro66 [b]: https://github.com/lujun9972 -[1]: https://www.linux.com/learn/intro-to-linux/2018/7/users-groups-and-other-linux-beasts -[2]: https://www.linux.com/blog/learn/2018/12/bash-variables-environmental-and-otherwise +[1]: https://linux.cn/article-10370-1.html +[2]: https://linux.cn/article-10374-1.html From cafad9ce13f9798efe68b08260e8eb40f4574de9 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 24 Dec 2018 12:54:52 +0800 Subject: [PATCH 028/322] PUB:20181212 Aliases- DIY Shell Commands.md @HankChow https://linux.cn/article-10377-1.html --- .../tech => published}/20181212 Aliases- DIY Shell Commands.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20181212 Aliases- DIY Shell Commands.md (100%) diff --git a/translated/tech/20181212 Aliases- DIY Shell Commands.md b/published/20181212 Aliases- DIY Shell Commands.md similarity index 100% rename from translated/tech/20181212 Aliases- DIY Shell Commands.md rename to published/20181212 Aliases- DIY Shell Commands.md From 3882e486275897ba08622fb9c212fd6bd6508a4d Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Mon, 24 Dec 2018 13:33:18 +0800 Subject: [PATCH 029/322] Translating How to Update Ubuntu. --- ...untu -Terminal - GUI Methods- It-s FOSS.md | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md b/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md index 00864bffa9..85d88129e7 100644 --- a/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md +++ b/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md @@ -77,45 +77,45 @@ apt list --upgradable ### 通过 GUI 更新 Ubuntu[适用于桌面用户] -If you are using Ubuntu as a desktop, you don’t have to go to terminal just for updating the system. You can still use the command line but it’s optional for you. +如果你使用桌面版 Ubuntu,你并不需要为了更新系统而打开终端。你可以仍可以使用命令行更新,但这只是一个选择。 -In the menu, look for ‘Software Updater’ and run it. +在菜单力,找到 `Software Updater` 并运行它。 -![Run Software Updater in Ubuntu][8] +![在 Ubuntu 中运行 Software Updater][8] -It will check if there are updates available for your system. +它将检查你的系统是否有可用的更新。 -![Checking if updates are available for Ubuntu][9] +![检查 Ubuntu 是否有可用更新][9] -If there are updates available, it will give provide you with options to install the updates. +如果有可用的更新,它将给你提供安装更新的选择。 -![Install Updates via Update Manager in Ubuntu][10] +![在 Ubuntu 中通过更新管理器安装更新][10] -Click on Install Now, it may ask for your password. +现在,点击 `Install`,它可能会向你询问密码。 -![Installing Updates in Ubuntu Linux via GUI][11] +![通过 GUI 在 Ubuntu Linux 中安装更新][11] -Once you enter your password, it will start installing the updates. +一旦你输入你的密码,它将开始安装更新。 -![Updating Ubuntu via GUI][12] +![通过 GUI 更新 Ubuntu][12] -In some cases, you may need to reboot the system for the installed updates to work properly. You’ll be notified at the end of the update if you need to restart the system. +在某些情况下,你可能需要重启系统才能使已安装的更新正常工作。如果需要重启系统,你将在更新结束时收到通知。 -![Updating Ubuntu via GUI][12] +![通过 GUI 更新 Ubuntu][12] -You can choose to restart later if you don’t want to reboot your system straightaway. +如果你不希望马上重启你的系统,可以选择稍后重启。 -![Installing updates via GUI in Ubuntu][13] +![通过 GUI 在 Ubuntu 中安装更新][13] -Tip: If the software updater returns an error, you should use the command ‘sudo apt update’ in the terminal. The last few lines of the output will contain the actual error message. You can search on the internet for that error and fix the problem. +提示:如果 `software updater` 返回一个错误,你需要在终端是使用命令 `sudo apt update`。输出的最后几行将包含真正的错误信息。你可以在因特网上搜索该错误并解决问题。 ### 更新 Ubuntu 时要记住几件事 -You just learned how to update your Ubuntu system. If you are interested, you should also know these few things around Ubuntu updates. +你刚学习了如何更新你的 Ubuntu 系统。如果你感兴趣,你还需要了解一些关于 Ubuntu 更新的内容。 #### 更新后清理 -Your system will have some unnecessary packages that won’t be required after the updates. You can remove such packages and [free up some space][14] using this command: +你的系统将会有一些更新后不再需要的软件包。你可用使用这条命令删除这些软件包并[释放空间][14]: ``` sudo apt autoremove From 567491369fe42af7b7434d18e9d19a7d53573254 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 24 Dec 2018 13:43:13 +0800 Subject: [PATCH 030/322] PRF:20181022 Improve login security with challenge-response authentication.md @hopefully2333 --- ... with challenge-response authentication.md | 68 +++++++++---------- 1 file changed, 33 insertions(+), 35 deletions(-) diff --git a/translated/tech/20181022 Improve login security with challenge-response authentication.md b/translated/tech/20181022 Improve login security with challenge-response authentication.md index 1d227c2839..7b360ab755 100644 --- a/translated/tech/20181022 Improve login security with challenge-response authentication.md +++ b/translated/tech/20181022 Improve login security with challenge-response authentication.md @@ -1,36 +1,34 @@ -通过询问-响应身份认证提高登陆安全 +通过询问-响应身份认证提高桌面登录安全 ====== ![](https://fedoramagazine.org/wp-content/uploads/2018/10/challenge-response-816x345.png) ### 介绍 -今天,Fedora 提供了多种方式来提高我们账户的身份认证的安全性。当然,它有我们熟悉的用户名密码登陆,它也同样提供了其他的身份认证选项,比如生物识别、指纹、智能卡、一次性密码,甚至是询问-响应身份认证。 +今天,Fedora 提供了多种方式来提高我们账户的身份认证的安全性。当然,它有我们熟悉的用户名密码登录方式,它也同样提供了其他的身份认证选项,比如生物识别、指纹、智能卡、一次性密码,甚至是询问-响应challenge-response身份认证。 每种认证方式都有明确的优缺点。这点本身就可以成为一篇相当冗长的文章的主题。Fedora 杂志之前就已经介绍过了这其中的一些选项: +- [在 Fedora 中使用 YubiKey4][1] +- [Fedora 28:在 OpenSSH 中更好的支持智能卡][2] -+ [Using the YubiKey4 with Fedora][1] -+ [Fedora 28: Better smart card support in OpenSSH][2] - - -在现在的 Fedora 版本中,最安全的方法之一就是离线硬件询问-响应。它也同样是最容易部署的方法之一。下面是具体方法: +在现在的 Fedora 版本中,最安全的方法之一就是离线硬件询问-响应。它也同样是最容易部署的方法之一。下面是具体方法。 ### 询问-响应认证 -从技术上来讲,当你输入密码的时候,你就正在响应用户名询问。离线的询问、响应包含了这些部分:首先是需要你的用户名,接下来,Fedora 会要你提供一个加密的物理硬件的令牌。令牌会将另一个通过可插入式身份认证模块(PAM)框架进行存储的加密密钥来响应询问。最后,Fedora 才会提示你输入密码。这可以防止其他人仅仅使用了找到的硬件令牌,或是只使用了账户名密码而没有正确的加密密钥。 +从技术上来讲,当你输入密码的时候,你就正在响应用户名询问。离线的询问、响应包含了这些部分:首先是需要你的用户名,接下来,Fedora 会要你提供一个加密的物理硬件的令牌。令牌会把另一个其存储的加密密钥通过可插入式身份认证Pluggable Authentication Module模块(PAM)框架来响应询问。最后,Fedora 才会提示你输入密码。这可以防止其他人仅仅使用了找到的硬件令牌,或是只使用了账户名密码而没有正确的加密密钥。 这意味着除了你的账户名密码之外,你必须事先在你的操作系统中注册了一个或多个加密硬件令牌。你必须保证你的物理硬件令牌能够匹配你的用户名。 -一些询问-响应的方法,比如一次性密码(OTP),在硬件令牌上获取加密代码密钥,然后将这个密钥通过网络传输到远程身份认证服务器。然后这个服务器会告诉 Fedora 的 PAM 框架,这是否是该用户的一个有效令牌。如果身份认证服务器在本地网络上,这个方法非常好。但它的缺点是如果网络连接断开或是你在没有网的远程端工作。你会被锁在系统之外,直到你能通过网络连接到身份认证服务器。 +一些询问-响应的方法,比如一次性密码(OTP),在硬件令牌上获取加密的代码密钥,然后将这个密钥通过网络传输到远程身份认证服务器。然后这个服务器会告诉 Fedora 的 PAM 框架,这是否是该用户的一个有效令牌。如果身份认证服务器在本地网络上,这个方法非常好。但它的缺点是如果网络连接断开或是你在没有网的远程端工作。你会被锁在系统之外,直到你能通过网络连接到身份认证服务器。 -有时候,生产环境会需要通过 Yubikey 使用一次性密码(OTP)设置,然而,在家庭或个人的系统上,你可能更喜欢询问-响应设置。一切都是本地的,这种方法不需要通过远程网络呼叫。下面这些过程适用于 Fedora 27、28和29. +有时候,生产环境会采用通过 Yubikey 使用一次性密码(OTP)的设置,然而,在家庭或个人的系统上,你可能更喜欢询问-响应设置。一切都是本地的,这种方法不需要通过远程网络调用。下面这些过程适用于 Fedora 27、28 和 29. ### 准备 #### 硬件令牌密钥 -首先,你需要一个安全的硬件令牌密钥。具体来说,这个过程需要一个 Yubikey 4,Yubikey NEO,或者是最近发布的、同样支持 FIDO2 的 Yubikey 5 系列设备。你应该购买它们中的两个来有一个备份,以避免其中一个丢失或遭到损坏。你可以在不同的工作地点使用这些密钥。较为简单的 FIDO 和 FIDO U2F 版本不适用与这个过程,但是非常适合使用 FIDO 的在线服务。 +首先,你需要一个安全的硬件令牌密钥。具体来说,这个过程需要一个 Yubikey 4、Yubikey NEO,或者是最近发布的、同样支持 FIDO2 的 Yubikey 5 系列设备。你应该购买它们中的两个,一个做备份,以避免其中一个丢失或遭到损坏。你可以在不同的工作地点使用这些密钥。较为简单的 FIDO 和 FIDO U2F 版本不适用于这个过程,但是非常适合使用 FIDO 的在线服务。 #### 备份、备份,以及备份 @@ -38,19 +36,18 @@ #### 升级,然后安装 -现在,确定你的 Fedora 是最新的,然后通过 dnf 命令安装所需要的 Fedora Yubikey 包。 +现在,确定你的 Fedora 是最新的,然后通过 `dnf` 命令安装所需要的 Fedora Yubikey 包。 ``` $ sudo dnf upgrade $ sudo dnf install ykclient* ykpers* pam_yubico* -$ cd ``` -如果你使用的是 VM 环境,例如 Virtual Box,确保 Yubikey 设备已经插进了 USB 口,然后允许 VM 控制的 USB 访问 Yubikey。 +如果你使用的是 VM 环境,例如 Virtual Box,确保 Yubikey 设备已经插进了 USB 口,然后允许 VM 控制的 USB 访问 Yubikey。 ### 配置 Yubikey -通过 USB Yubikey 验证你的账户: +确认你的账户访问到了 USB Yubikey: ``` $ ykinfo -v @@ -63,21 +60,21 @@ version: 3.5.0 Yubikey core error: no yubikey present ``` -接下来,通过下面这些 ykpersonalize 命令初始化你每个新的 Yubikeys。使用 HMAC-SHA1 算法进行询问响应,以此来设置 Yubikey 配置插槽 2。即使少于 64 个字符,如果你已经为询问响应设置好了你的 Yubikey。你就不需要再运行 ykpersonalize 了。 +接下来,通过下面这些 `ykpersonalize` 命令初始化你每个新的 Yubikey。这将设置 Yubikey 配置插槽 2 使用 HMAC-SHA1 算法(即使少于 64 个字符)进行询问响应。如果你已经为询问响应设置好了你的 Yubikey。你就不需要再次运行 `ykpersonalize` 了。 ``` ykpersonalize -2 -ochal-resp -ochal-hmac -ohmac-lt64 -oserial-api-visible ``` -一些用户在使用的时候将 YubiKey 留在了工作环境里,甚至对虚拟机使用了询问响应。然而,为了更好的安全性,你可能会更愿意使用手动触发 YubiKey 来响应询问。 +一些用户在使用的时候将 YubiKey 留在了他们的工作站上,甚至用于对虚拟机进行询问-响应。然而,为了更好的安全性,你可能会更愿意使用手动触发 YubiKey 来响应询问。 -要添加手动询问按钮触发器,请添加 -ochal-btn-trig 标记,这个标记可以在请求中使得 Yubikey 闪烁 Yubikey LED。等待你在 15 秒内按下硬件密钥区域上的按钮来生成响应密钥。 +要添加手动询问按钮触发器,请添加 `-ochal-btn-trig` 选项,这个选项可以使得 Yubikey 在请求中闪烁其 LED。等待你在 15 秒内按下硬件密钥区域上的按钮来生成响应密钥。 ``` $ ykpersonalize -2 -ochal-resp -ochal-hmac -ohmac-lt64 -ochal-btn-trig -oserial-api-visible ``` -为你的每个新的硬件密钥执行此操作。每个密钥执行以此,使用下面的命令将 Yubikey 配置存储到 ~/.yubico: +为你的每个新的硬件密钥执行此操作。每个密钥执行一次。完成编程之后,使用下面的命令将 Yubikey 配置存储到 `~/.yubico`: ``` $ ykpamcfg -2 -v @@ -88,17 +85,17 @@ Sending 63 bytes HMAC challenge to slot 2 Stored initial challenge and expected response in '/home/chuckfinley/.yubico/challenge-9992567'. ``` -如果你要设置多个密钥用于备份。请将所有的密钥设置为相同,然后使用 ykpamcfg utility 存储每个密钥的询问-响应。如果你在一个已经存在的注册密钥上运行 ykpersonalize 命令,你就必须再次存储配置信息。 +如果你要设置多个密钥用于备份,请将所有的密钥设置为相同,然后使用 `ykpamcfg` 工具存储每个密钥的询问-响应。如果你在一个已经存在的注册密钥上运行 `ykpersonalize` 命令,你就必须再次存储配置信息。 ### 配置 /etc/pam.d/sudo -现在要去验证配置是否有效,在相同的终端窗口中,你需要设置 sudo 来要求使用 Yubikey 的询问-响应。将下面这几行插入到 /etc/pam.d/sudo 文件中。 +现在要去验证配置是否有效,**在同一个终端窗口中**,你需要设置 `sudo` 来要求使用 Yubikey 的询问-响应。将下面这几行插入到 `/etc/pam.d/sudo` 文件中。 ``` auth required pam_yubico.so mode=challenge-response ``` -将上面的 auth 行插入到 auth 文件中的 system-auth 行的上面,然后保存并退出编辑器。在默认的 Fedora 29 设置中,/etc/pam.d/sudo 应该像下面这样: +将上面的 `auth` 行插入到文件中的 `auth include system-auth` 行的上面,然后保存并退出编辑器。在默认的 Fedora 29 设置中,`/etc/pam.d/sudo` 应该像下面这样: ``` #%PAM-1.0 @@ -111,24 +108,25 @@ session required pam_limits.so session include system-auth ``` -保持原始终端窗口打开,然后打开一个新的终端窗口进行测试,在新的终端窗口中输入: +**保持这个初始的终端窗口打开**,然后打开一个新的终端窗口进行测试,在新的终端窗口中输入: ``` $ sudo echo testing ``` -你应该注意到了 key 上的 LED 在闪烁。点击 Yubikey 按钮,你应该会看见一个输入 sudo 密码的提示。在你输入你的密码之后,你应该会在终端屏幕上看见 ”testing“ 的字样。 +你应该注意到了 Yubikey 上的 LED 在闪烁。点击 Yubikey 按钮,你应该会看见一个输入 `sudo` 密码的提示。在你输入你的密码之后,你应该会在终端屏幕上看见 “testing” 的字样。 -现在去测试确保正常的失败,启动另一个终端窗口,并从 USB 插口中拔掉 Yubikey。使用下面这条命令验证,在没有 Yubikey 的情况下,sudo 是否会不再正常工作。 +现在去测试确保失败也正常,启动另一个终端窗口,并从 USB 插口中拔掉 Yubikey。使用下面这条命令验证,在没有 Yubikey 的情况下,`sudo` 是否会不再正常工作。 ``` $ sudo echo testing fail ``` -你应该立刻被提示输入 sudo 密码,即使你输入了正确密码,登陆也应该失败。 -### 设置 Gnome 桌面管理 +你应该立刻被提示输入 `sudo` 密码,但即使你输入了正确密码,登录也应该失败。 -一旦你的测试完成后,你就可以为图形登陆添加询问-响应支持了。将你的 Yubikey 再次插入进 USB 插口中。然后将下面这几行添加到 /etc/pam.d/gdm-password 文件中: +### 设置 Gnome 桌面管理器(GDM) + +一旦你的测试完成后,你就可以为图形登录添加询问-响应支持了。将你的 Yubikey 再次插入进 USB 插口中。然后将下面这几行添加到 `/etc/pam.d/gdm-password` 文件中: ``` auth required pam_yubico.so mode=challenge-response @@ -140,9 +138,9 @@ auth required pam_yubico.so mode=challenge-response $ sudo vi /etc/pam.d/gdm-password ``` -你应该看到 yubikey 上的 LED 在闪烁,按下 yubikey 按钮,然后在提示符出输入密码。 +你应该看到 Yubikey 上的 LED 在闪烁,按下 Yubikey 按钮,然后在提示符处输入密码。 -修改 /etc/pam.d/gdm-password 文件,在已有的 password-auth 上添加新的 auth 行。这个文件的顶部应该像下面这样: +修改 `/etc/pam.d/gdm-password` 文件,在已有的 `auth substack password-auth` 行上添加新的行。这个文件的顶部应该像下面这样: ``` auth [success=done ignore=ignore default=bad] pam_selinux_permit.so @@ -154,15 +152,15 @@ auth include postlogin account required pam_nologin.so ``` -保存更改并退出编辑器,如果你使用的是 vi,输入键是按 Esc 键,然后在提示符出输入 wq! 来保存并退出。 +保存更改并退出编辑器,如果你使用的是 vi,输入键是按 `Esc` 键,然后在提示符处输入 `wq!` 来保存并退出。 ### 结论 -现在注销 GNOME。将 Yubikey 插入到 USB 口,在图形登陆界面上点击你的用户名。Yubikey LED 会开始闪烁。触摸那个按钮,你会被提示输入你的密码。 +现在注销 GNOME。将 Yubikey 插入到 USB 口,在图形登录界面上点击你的用户名。Yubikey LED 会开始闪烁。触摸那个按钮,你会被提示输入你的密码。 -如果你丢失了 Yubikey,除了重置密码之外,你还可以使用备份的 Yubikey。你还可以给你的账户增加额外的 Yubikey 配置。 +如果你丢失了 Yubikey,除了重置密码之外,你还可以使用备份的 Yubikey。你还可以给你的账户增加额外的 Yubikey 配置。 -如果有其他人获得了你的密码,他们在没有你的物理硬件 Yubikey 的情况下,仍然不能登陆。恭喜!你已经显著提高了你的工作环境登陆的安全性了。 +如果有其他人获得了你的密码,他们在没有你的物理硬件 Yubikey 的情况下,仍然不能登录。恭喜!你已经显著提高了你的工作环境登录的安全性了。 -------------------------------------------------------------------------------- @@ -171,7 +169,7 @@ via: https://fedoramagazine.org/login-challenge-response-authentication/ 作者:[nabooengineer][a] 选题:[lujun9972][b] 译者:[hopefully2333](https://github.com/hopefully2333) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From e0856a2eb56d29dbcfb0d410e229a6f46764f8a2 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 24 Dec 2018 13:43:35 +0800 Subject: [PATCH 031/322] PUB:20181022 Improve login security with challenge-response authentication.md @hopefully2333 https://linux.cn/article-10378-1.html --- ...prove login security with challenge-response authentication.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20181022 Improve login security with challenge-response authentication.md (100%) diff --git a/translated/tech/20181022 Improve login security with challenge-response authentication.md b/published/20181022 Improve login security with challenge-response authentication.md similarity index 100% rename from translated/tech/20181022 Improve login security with challenge-response authentication.md rename to published/20181022 Improve login security with challenge-response authentication.md From bd6dbed6ea649bc2509275249cd441e0ab01a8f1 Mon Sep 17 00:00:00 2001 From: Ryze-Borgia <42087725+Ryze-Borgia@users.noreply.github.com> Date: Mon, 24 Dec 2018 15:38:39 +0800 Subject: [PATCH 032/322] Update and rename sources/talk/20180128 Getting Linux Jobs.md to translated/talk/20180128 Getting Linux Jobs.md --- sources/talk/20180128 Getting Linux Jobs.md | 99 ------------------- .../talk/20180128 Getting Linux Jobs.md | 94 ++++++++++++++++++ 2 files changed, 94 insertions(+), 99 deletions(-) delete mode 100644 sources/talk/20180128 Getting Linux Jobs.md create mode 100644 translated/talk/20180128 Getting Linux Jobs.md diff --git a/sources/talk/20180128 Getting Linux Jobs.md b/sources/talk/20180128 Getting Linux Jobs.md deleted file mode 100644 index 4cb79e9834..0000000000 --- a/sources/talk/20180128 Getting Linux Jobs.md +++ /dev/null @@ -1,99 +0,0 @@ -translating by ryze-borgia -Getting Linux Jobs -====== - -In a qualitative review of job posting websites, even highly skilled Linux administrators would be hamstrung to succeed in getting to the stage of an interview. - -All of this results in hundreds of decent and skilled people being snubbed without cause simply because today's job market requires a few extra tools to increase the odds. - -I have two colleagues and a cousin who have all received certifications with RedHat, managed quite extensive server rooms, and received earnest recommendations from former employers. - -All of these skills, certifications and experience come to naught as they apply to employer ads that are crudely constructed by someone hurriedly cutting and pasting snippets of "skill words" from a list of technical terms. - -Not surprisingly, today's politeness has gone the way of the bird, and a **non-response** from companies posting ads seems to be the new way of communicating. - -Unfortunately, it also means that these recruiters/HR personnel probably did **not** get the best candidate. - -The reason I can say this with such conviction is because of the type of buffoonery that takes place so often when creating job ads in the first place. - -Walter, another [Reallylinux.com][3] guest writer, presented how [**Job Want Ads Have Gone Mad**][4]. - -Perhaps he's right. However, I believe every Linux job seeker can avoid pitfalls of a job hunt by keeping in mind **three key facts** about job ads. - -First, few advertisements for Linux administrators are exclusively about Linux. - -Bear in mind the occasional Linux system administrator job, where you would actually be using Linux on servers. Instead, many jobs that rise up on a "Linux administrator" search are actually referring to a plethora of 'NX operating systems. - -For example, here is a quote from a **"Linux Administrator"** job posting: -This role will provide support for build system integration, especially operating system installation support for BSD applications... - -Or another ad declares in the bowels of its content: -Windows administration experience required. - -Ironically, if you show up to interview for any of these types of jobs and focus on Linux, they probably will not choose you. - -Even more importantly, if you simply include Linux as your expertise, they may not even bother with your resume, because they can't tell the difference between UNIX, BSD, Linux, etc. - -As a result, if you are conscientious and only include Linux on your resume, you are automatically out. But change that Linux to UNIX/Linux and you end up getting a bit farther in the human resources bureaucracy. - -I had two colleagues that ended up changing this on their resumes and getting a much better hit ratio for interviews, which were still slim pickings because most job ads are tailored with some particular person already in mind. The main intent behind such job ads being a cover for the ass of the department making the claim of having an open job. - -Second, the only person at the company who cares at all about the system administrator position is the technical lead/manager hiring for the slot. Others at the company, including the HR contact or the management could not care less. - -I remember sitting in a board room as a fly on the wall, hearing one executive vice president refer to server administrators as "dime a dozen geeks." How wrong they are to suggest this. - -Ironically, one day should the mail system fail, or the PBX connectivity hiccup, or perhaps core business files disappear from the intranet, these same executives are the first to get on the phone and threaten to fire the system admins. - -Perhaps if they would stop leaving so many hot air telephone messages, or filling their emails with 35MB photographs of another vice president's fishing trip and wife, the servers wouldn't be so problematic. - -Be aware that a Linux administrator ad, or any job posting for server administrator is placed because someone at the TECHNICAL level sees an urgent need for staffing. You're not going to get any empathy talking to HR or any leader of the company. Instead, take the time to find out who the hiring technical manager is and try to telephone them. - -You can always call them directly because you have some "specific technical questions" you know the HR person could not answer. This opens the dialogue with the person who actually cares that the position is filled and ensures you get a foot in because you took the time for personal contact, even if it was a 60 second phone call. - -What if the HR beauracracy won't let you through? - -Start asking as many tech questions as possible direct to the HR hiring contact, such as how their Linux clusters are setup and do they run VMs exclusively? Anything relatively technical will send these HR people in a tizzy and allow you the question: "may I contact the technical manager of the team?" - -If the response is a fluffy "maybe" or "I'll get back to you on that" they already filled the slot in their mind with someone else two weeks earlier, such as the HR staff member's fiance. They simply wanted it to look less like nepotism and more like indeterminism with a dash of egoism. - -``` -"They simply wanted it to look less like nepotism and more like indeterminism with a dash of egoism." -``` - -So take the time to find out who is the direct TECHNICAL leader hiring for the position and talk to them. It can make a difference and get you past some of the baloney. - -Third, few job ads today include any semblance of reality. - -I've seen enough ads requiring a junior system administrator with expertise that senior level experts don't have, to know the plan is to list the blue sky wish list and then find out who applies. - -In this situation, the Linux administrator ad you apply for, should include some key phrases for which you already have experience or certifications. - -The trick is to so overload your resume with the key phrases that MATCH their ad, it becomes almost impossible for them to determine which phrases you left out. - -This doesn't necessarily translate to a job, but it often adds enough intrigue to get you an interview, which now a days is a major step. - -By understanding and applying these three techniques, hopefully those seeking Linux administrator jobs have a head start on those who have only a slim chance in hell. - -Even if these tips don't get you interviews right away, you can use the experience and awareness when you go to the next trade show, or company sponsored technical conference. - -I strongly recommend you regularly attend these as well, especially if they are reasonably close, as they always provide a kick start to networking. - -Remember that job networking now a days is a pseudonym for "getting the gossip on which companies are actually hiring and which ones are just lying about jobs to give the appearance of growth for shareholders." - - - --------------------------------------------------------------------------------- - -via: http://reallylinux.com/docs/gettinglinuxjobs.shtml - -作者:[Andrea W.Codingly][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://reallylinux.com -[1]:http://www.reallylinux.com -[2]:http://reallylinux.com/docs/linuxrecessionproof.shtml -[3]:http://reallylinux.com -[4]:http://reallylinux.com/docs/wantadsmad.shtml diff --git a/translated/talk/20180128 Getting Linux Jobs.md b/translated/talk/20180128 Getting Linux Jobs.md new file mode 100644 index 0000000000..1f7b5791af --- /dev/null +++ b/translated/talk/20180128 Getting Linux Jobs.md @@ -0,0 +1,94 @@ +Linux 求职建议 +====== + +通过对招聘网站数据的仔细研究,我们发现,即使是非常有经验的 Linux 程序员,也很难在面试中表现的很出色。 + +这就导致了很多优秀并且有经验的人找不到合适的工作,所以我们可能需要一些手段来提高自己的竞争力。 + +我有两个同事和一个表哥,他们都有 RedHat 认证,管理过比较大的服务器机房,也都收到过老员工的推荐。 + +可是,在他们应聘的时候,所有的这些证书、本身的能力、工作经验好像都没有起到任何作用,他们面对的是一些 +从术语列表中临时挑选的一些技术词汇片段所组成的问题。 + +现如今,礼貌变得过时了,**不回应**变成了公司招人时最好的沟通方式。 + +这同样也意味着大多公司的招聘或者人事可能会**错过**非常优秀的应聘者。 + +我之所以敢说的如此肯定,是因为现在招聘广告大多数看上去都非常的滑稽。 + +Walter ,[Reallylinux.com][3] 另一位特约撰稿人,发表过一篇关于 [招聘广告疯掉了][4] 的文章。 + +他说的没错,可是我认为 Linux 工作应聘者可以通过注意招聘广告的**三个关键词**避免落入陷阱。 + +首先,很少会有 Linux 领域的招聘广告只对 Linux 有要求 。 + +一定要注意 Linux 相关工作的工作场合,公司很有可能会要求你在服务器上跑 Linux ,另外,通过 “Linux” 搜索得到的结果有很多实际上是会涉及到 NX (数字化产品开发系统)的。 + +举个例子,现在有一则关于 **Linux 管理员招聘** 的招聘广告: +参与建立系统集成,尤其是 BSD 应用的系统安装... + +或者有一些其他的要求: +有 Windows 系统管理经验的 + +最为讽刺的是,如果你在应聘面试的时候表现出精通 Linux 的话,你可能不会被聘用。 + +另外,如果你直接把 Linux 写在你的特长或者专业上,他们可能都不会仔细看你的简历,因为他们根本区分不了 UNIX, BSD, Linux。 + +最终的结果就是,如果你只在简历上写了 Linux ,你可能会被直接掉,但是如果你改成 UNIX/Linux 的话,可能会走得更远。 + +我有两个同事最后修改了他们的简历,然后获得了更好的面试机会,但是依旧没有被聘用,因为大多数招聘广告其实已经内定人员了,这些招聘信息被放出来仅仅是为了表现出他们有招聘的想法。 + +第二点,公司里真正需要了解系统管理的只有特聘的科技主管,其他人包括人事或管理层根本不关心这个。 + +我记得有一次开会的时候,听见一个执行副总裁把服务器管理人员说成“一毛钱一打的人”,这种想法是多么的奇怪啊。 + +讽刺的是,等到邮件系统出故障,交换机连接时不时会断开,或者核心商业文件从企业内网中消失的时候,这些总裁又是最先打电话给系统管理员的。 + +或许如果他们不整天说些空话,或者不往邮件里塞满妻子的照片和旅行途中的照片的话,服务器可能就不会崩溃。 + +在找工作的时候一定要关注招聘 Linux 运维或者服务器管理人员的广告,因为这种一般都是在公司技术层有迫切的需求的时候才会有的。你也不需要和人事或者公司高层聊什么,搞清楚谁要招聘然后打电话给他们。 + +你需要直接联系他们因为有些技术问题人事是解决不了的,即使你只有 60 秒的时间可以和他们交流,你也必须抓住这个机会和真正有需求并且懂技术的人沟通。 + +那如果人事不让你进怎么办呢? + +记得问人事一些技术性问题,比如说他们的 Linux 群组是如何建立的,能不能独立运行虚拟机。这些技术性的问题会让人事变得不耐烦,最后让你有机会问出“我能不能直接联系你们团队的技术人员”。 + +如果对方的回答是“应该可以”或者“稍后回复你”,那么他们可能已经在两周前就已经计划好了找一个人来填补这个空缺,比如说人事部员工的未婚夫。他们只是不希望看起来太像裙带主义,而是带有一点利己主义的不确定主义。 + +所以一定要记得花点时间弄清楚到底谁是发布招聘广告的直接技术负责人然后和他们聊一聊,这可能会让你少一番胡扯并且让你更有可能应聘成功。 + +第三点,现在的广告很少有完全真实的内容了。 + +我以前见过一个招聘具有高级专家所不具备的专门知识的初级系统管理员的广告,计划是列出公司的发展计划蓝图,然后找到应聘者。 + +在这种情况下,你应聘 Linux 管理员职位应该提供几个关键性信息,例如工作经验和相关证书。 + +诀窍在于,在你的简历中给出与他们的招聘信息相匹配的关键词,这样他们就基本找不到你存在的问题。 + +这并不一定会让你成功找到一份工作,但它可以让你获得一次面试机会,这也算是一个巨大的进步。 + +通过理解和应用以上三点,或许可以让那些寻求 Linux 管理员工作的人能够比那些在地狱中只有一线希望的人有一个好的开始。 + +即使这些建议不能让你马上得到面试机会,你也可以利用这些经验和意识去参加贸易展或公司主办的技术会议等活动。 + +我强烈建议你们也经常参加这种活动,尤其是当它们时间比较接近的时候,可以给你一个扩展人脉的机会。 + +请记住,如今的“求职网日”已经失去了原来的意义了,现在只是可以用来获取“哪些公司实际上在招聘、哪些公司只是为了给股东带来增长的表象而在工作方面撒谎”的小道消息。 + + +-------------------------------------------------------------------------------- + +via: http://reallylinux.com/docs/gettinglinuxjobs.shtml + +作者:[Andrea W.Codingly][a] +译者:[Ryze-Borgia](https://github.com/Ryze-Borgia) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://reallylinux.com +[1]:http://www.reallylinux.com +[2]:http://reallylinux.com/docs/linuxrecessionproof.shtml +[3]:http://reallylinux.com +[4]:http://reallylinux.com/docs/wantadsmad.shtml From 128cf37c5433db41731ee4c9fec303cde41282de Mon Sep 17 00:00:00 2001 From: WangYue <815420852@qq.com> Date: Mon, 24 Dec 2018 17:07:37 +0800 Subject: [PATCH 033/322] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=8E=9F=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 翻译完成删除原文 20180826 How to Install and Use FreeDOS on VirtualBox.md --- ...o Install and Use FreeDOS on VirtualBox.md | 156 ------------------ 1 file changed, 156 deletions(-) delete mode 100644 sources/talk/20180826 How to Install and Use FreeDOS on VirtualBox.md diff --git a/sources/talk/20180826 How to Install and Use FreeDOS on VirtualBox.md b/sources/talk/20180826 How to Install and Use FreeDOS on VirtualBox.md deleted file mode 100644 index f6d36e718b..0000000000 --- a/sources/talk/20180826 How to Install and Use FreeDOS on VirtualBox.md +++ /dev/null @@ -1,156 +0,0 @@ -WangYueScream Tanslating ---------------- -How to Install and Use FreeDOS on VirtualBox -====== -This step-by-step guide shows you how to install FreeDOS on VirtualBox in Linux. - -### Installing FreeDOS on VirtualBox in Linux - - - -In November of 2017, I [interviewed Jim Hall][1] about the history behind the [FreeDOS project][2]. Today, I’m going to tell you how to install and use FreeDOS. Please note: I will be using [VirtualBox][3] 5.2.14 on [Solus][4]. - -Note: I used Solus as the host operating system for this tutorial because it is very easy to setup. One thing you should keep in mind is that Solus’ Software Center contains two versions of VirtualBox: `virtualbox` and `virtualbox-current`. Solus gives you the option to use the linux-lts kernel and the linux-current kernel. `virtualbox`is modified for linux-lts and `virtualbox-current` is for linux-current. - -#### Step 1 – Create New Virtual Machine - -![][5] - -Once you open VirtualBox, press the “New” button to create a new virtual machine. You can name it whatever you want, I just use “FreeDOS”. You can use the label to specify what version of FreeDOS you are installing. You also need to select the type and version of the operating system you will be installing. Select “Other” and “DOS”. - -#### Step 2 – Select Memory Size - -![][6] - -The next dialog box will ask you how much of the host computer’s memory you want to make available to FreeDOS. The default is 32MB. Don’t change it. Back in the day, this would be a huge amount of RAM for a DOS machine. If you need to, you can increase it later by right-clicking on the virtual machine you created for FreeDOS and selecting Settings -> System. - -![][7] - -#### Step 3 – Create Virtual Hard Disk - -![][8] - -Next, you will be asked to create a virtual hard drive where FreeDOS and its files will be stored. Since you haven’t created one yet, just click “Create”. - -The next dialog box will ask you what hard disk file type you want to use. This default (VirtualBox Disk Image) works just fine. Click “Next”. - -The next question you will encounter is how you want the virtual disk to act. Do you want it to start small and gradually grow to its full size as you create files and install programs? Then choose dynamically allocated. If you prefer that the virtual hard drive (vhd) is created at full size, then choose fixed size. Dynamically allocated is nice if you don’t plan to use the whole vhd or if you don’t have very much free space on your hard drive. (Keep in mind that while the size of a dynamically allocated vhd increases as you add files, it will not drop when you remove files.) I prefer dynamically allocated, but you can choose the option that serves your needs best and click “Next”. - -![][9] - -Now, you can choose the size and location of the vhd. 500 MB should be plenty of space. Remember most of the programs you will be using will be text-based, thus fairly small. Once you make your adjustments, click Create, - -#### Step 4 – Attach .iso file - -Before we continue, you will need to [download][10] the FreeDOS .iso file. You will need to choose the CDROM “standard” installer. - -![][11] - -Once the file has been downloaded, return to VirtualBox. Select your virtual machine and open the settings. You can do this by either right-clicking on the virtual machine and selecting “Settings” or highlight the virtual machine and click the “Settings” button. - -Now, click the “Storage” tab. Under “Storage Devices”, select the CD icon. (It should say “Empty” next to it.) In the “Attributes” panel on the right, click on the CD icon and select the location of the .iso file you just downloaded. - -Note: Typically, after you install an operating system on VirtualBox you can delete the original .iso file. Not with FreeDOS. You need the .iso file if you want to install applications via the FreeDOS package manager. I generally keep the ,iso file attached the virtual machine in case I want to install something. If you do that, you have to make sure that you tell FreeDOS you want to boot from the hard drive each time you boot it up because it defaults to the attached CD/iso. If you forget to attach the .iso, don’t worry. You can do so by selecting “Devices” on the top of your FreeDOS virtual machine window. The .iso files are listed under “Optical Drives”. - -#### Step 5 – Install FreeDOS - -![][12] - -Now that we’ve completed all of the preparations, let’s install FreeDOS. - -First, you need to be aware of a bug in the most recent version of VirtualBox. If you start the virtual machine that we just created and select “Install to harddisk” when the FreeDOS welcome screen appears, you will see an unending, scrolling mass of machine code. I’ve only run into this issue recently and it affects both the Linux and Windows versions of VirtualBox. (I know first hand.) - -To get around this, you need to make a simple edit. When you see the FreeDOS welcome screen, press Tab. (Make sure that the “Install to harddrive” option is selected.) Type the word `raw` after “fdboot.img” and hit Enter. The FreeDOS installer will then start. - -![][13] - -The first part of the installer will handle formatting your virtual drive. Once formatting is completed, the installer will reboot. When the FreeDOS welcome screen appears again, you will have to re-enter the `raw` comment you used earlier. - -Make sure that you select “Yes” on all of the questions in the installer. One important question that doesn’t have a “Yes” or “No” answer is: “What FreeDOS packages do you want to install?. The two options are “Base packages” or “Full installation”. Base packages are for those who want a DOS experience most like the original MS-DOS. The Full installation includes a bunch of tools and utilities to improve DOS. - -At the end of the installation, you will be given the option to reboot or stay on DOS. Select “reboot”. - -#### Step 6 – Setup Networking - -Unlike the original DOS, FreeDOS can access the internet. You can install new packages and update the ones already you have installed. In order to use networking, you need to install several applications in FreeDOS. - -![][14] - -First, boot into your newly created FreeDOS virtual machine. At the FreeDOS selection screen, select “Boot from System harddrive”. - -![][15] - -Now, to access the FreeDOS package manager, type `fdimples`. You can navigate around the package manager with the arrow keys and select categories or packages with the space bar. From the “Networking” category, you need to select `fdnet`. The FreeDOS Project also recommends installing `mtcp` and `wget`. Hit “Tab” several times until “OK” is selected and press “Enter”. Once the installation is complete, type `reboot` and hit enter. After the system reboots, boot to your system drive. If the network installation was successful, you will see several new messages at the terminal listing your network information. - -![][16] - -##### Note - -Sometimes the default VirtualBox setup doesn’t work. If that happens, close your FreeDOS VirtualBox window. Right-click your virtual machine from the main VirtualBox screen and select “Settings”. The default VirtualBox network setting is “NAT”. Change it to “Bridged Adapter” and retry installing the FreeDOS packages. It should work now. - -#### Step 7 – Basic Usage of FreeDOS - -##### Commons Commands - -Now that you have installed FreeDOS, let’s look at a few basic commands. If you have ever used the Command Prompt on Windows, you will be familiar with some of these commands. - - * `DIR`– display the contents of the current directory - * `CD` – change the directory you are currently in - * `COPY OLD.TXT NEW.TXT`– copy files - * `TYPE TEST.TXT` – display content of file - * `DEL TEST.TXT` – delete file - * `XCOPY DIR NEWDIR` – copy directory and all of its contents - * `EDIT TEST.TXT`– edit a file - * `MKDIR NEWDIR` – create a new directory - * `CLS` – clear the screen - - - -You can find more basic DOS commands on the web or the [handy cheat sheet][17] created by Jim Hall. - -##### Running a Program - -Running program on FreeDos is fairly easy. When you install an application with the `fdimples` package manager, be sure to note where the .EXE file of the application is located. This is shown in the application’s details. To run the application, you generally need to navigate to the application folder and type the application’s name. - -For example, FreeDOS has an editor named `FED` that you can install. After installing it, all you need to do is navigate to `C:\FED` and type `FED`. - -Sometimes a program, such as Pico, is stored in the `\bin` folder. These programs can be called up from any folder. - -Games usually have an .EXE program or two that you have to run before you can play the game. These setup file usually fix sound, video, or control issues. - -If you run into problems that this tutorial didn’t cover, don’t forget to visit the [home of FreeDOS][2]. They have a wiki and several other support options. - -Have you ever used FreeDOS? What tutorials would you like to see in the future? Please let us know in the comments below. - -If you found this article interesting, please take a minute to share it on social media, Hacker News or [Reddit][18]. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/install-freedos/ - -作者:[John Paul][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/john/ -[1]:https://itsfoss.com/interview-freedos-jim-hall/ -[2]:http://www.freedos.org/ -[3]:https://www.virtualbox.org/ -[4]:https://solus-project.com/home/ -[5]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/freedos-tutorial-1.jpg -[6]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/freedos-tutorial-2.jpg -[7]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/freedos-tutorial-3.jpg -[8]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/freedos-tutorial-4.jpg -[9]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/freedos-tutorial-6.jpg -[10]:http://www.freedos.org/download/ -[11]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/freedos-tutorial-7.jpg -[12]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/freedos-tutorial-8.png -[13]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/freedos-tutorial-9.png -[14]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/freedos-tutorial-10.png -[15]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/freedos-tutorial-11.png -[16]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/freedos-tutorial-12.png -[17]:https://opensource.com/article/18/6/freedos-commands-cheat-sheet -[18]:http://reddit.com/r/linuxusersgroup From 8b3c24fd40630f9140b48981cd0897ddefdb6c20 Mon Sep 17 00:00:00 2001 From: WangYue <815420852@qq.com> Date: Mon, 24 Dec 2018 17:08:51 +0800 Subject: [PATCH 034/322] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AF=91=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 20180826 How to Install and Use FreeDOS on VirtualBox.md 翻译完成添加译文 --- ...o Install and Use FreeDOS on VirtualBox.md | 157 ++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 translated/talk/20180826 How to Install and Use FreeDOS on VirtualBox.md diff --git a/translated/talk/20180826 How to Install and Use FreeDOS on VirtualBox.md b/translated/talk/20180826 How to Install and Use FreeDOS on VirtualBox.md new file mode 100644 index 0000000000..e8b0d30183 --- /dev/null +++ b/translated/talk/20180826 How to Install and Use FreeDOS on VirtualBox.md @@ -0,0 +1,157 @@ + +如何在 VirtualBox 上安装并使用 FreeDOS? +====== +这份指南将带你如何一步一步在 Linux 平台下利用 VirtualBox 安装 FreeDOS。 + +### Linux 下借助 VirtualBox 安装 FreeDOS + + + +2017 年的 11 月份,我[采访了 Jim Hall][1] 关于 [FreeDOS project][2] 背后的历史故事。今天,我将告诉你如何安装并使用 FreeDOS。需要注意到是:我将在 [Solus][4](一种针对家庭用户的 Linux 桌面发行版)下使用 5.2.14 版本的 [VirtualBox][3] 来完成这些操作。 + +注意:在本教程我将使用 Solus 作为主机系统因为它很容易设置。另一个你需要注意的事情是 Solus 的软件中心有两个版本的 VirtualBox:`virtualbox` 和 `virtualbox-current`。Solus 会让你选择是使用 linux-lts 内核还是 linux-current 内核。最终区别就是,`virtualbox` 适用于 linux-lts 而 `virtualbx-current` 适用于 linux-current。 + + +#### 第一步 – 创建新的虚拟机 + +![][5] + +当你打开 VirtualBox,点击 "New" 按钮来新建一个虚拟机。你可以自定义这台虚拟机的名字,我将它命名为 “FreeDOS”。你也可以在标注栏内指明你正在安装的 FreeDOS 的版本。你还需要选择你将要安装的操作系统的类型和版本。选择 “Other” 下的 “DOS”。 + +#### 第二步 – 设置内存大小 + +![][6] + +下一个对话框会问你要给 FreeDOS 主机分配多少可用的内存空间。默认分配 32 MB。不必更改它。在 DOS 系统盛行的年代,32 MB 大小的内存对于一台搭载 FreeDOS 的机器已经很足够了。如果你有需要,你可以通过对你针对 FreeDOS 新建的虚拟机右键并选择 Setting -> Symtem 来增加内存。 + +![][7] + +#### 第三步 – 创建虚拟硬盘 + +![][8] + +下一步,你会被要求创建一个虚拟硬盘用来存储 FreeDOS 和它的文件。如果你还没有创建,只需要点击 “Create”。 + +下一个对话框会问你想用什么磁盘文件类型。默认的类型 (VirtualBox Disk Image) 效果就挺好。点击 “Next”。 + +下一个你遇到的问题是你想虚拟硬盘以何种方式创建。你是否希望虚拟硬盘占据的空间刚开始很小然后会随着你创建文件和安装软件逐渐增加直至达到你设置的上限?那么选择动态分配。如果你更喜欢虚拟硬盘 (VHD) 按照既定大小直接创建,选择固定大小即可。如果你不打算使用整个 VHD 或者你的硬盘空余空间不是太足够,那么动态分配是个很不错的分配方式。(需要注意的是,动态分配的虚拟硬盘占据的空间会随着你增加文件而增加,但不会因为你删除文件而变小) 我个人更喜欢动态分配,但你可以根据实际需要来选择最合适你的分配类型然后点击 “Next”。 + +![][9] + +现在,你可以选择虚拟磁盘的大小和位置。500 MB 已经很足够了。需要注意的是很多你之后用到的程序都是基于文本的,这意味着它们占据的空间非常小。在你做好这些调整后,点击 Creat。 + + +#### 第四步 – 关联 .iso 文件 + +在我们继续之前,你需要[下载][10] FreeDOS 的 .iso 文件。你需要选择 CDROM 格式的 “standard” 安装程序。 + +![][11] + +当文件下载完毕后,返回到 VirtualBox。选中你的虚拟机并打开设置。你可以通过对虚拟机右键并选中 “Setting” 或者 选中虚拟机并点击 “Setting” 按钮。 + +接下来,点击 “Storage” 选项卡。在 “Storage Devices” 下面,选中 CD 图标。(它应该会在图标旁边显示 “Empty”。) 在右边的 “Attribute” 面板,点中 CD 图标然后在对应路径选中你刚下载的 .iso 文件。 + +提示:通常,在你通过 VirtualBox 安装完一个操作系统后你就可以删除对应的 .iso 文件了。但这并不适合 FreeDOS 。如果你想通过 FreeDOS 的包管理器来安装应用程序,你需要这个 .iso 文件。我通常会让这个 .iso 文件连接到虚拟机以便我安装一些程序。如果你也这么做了,你必须要确认下你让 FreeDOS 虚拟机每次启动的时候是从硬盘启动因为虚拟机的默认设置是从已关联的 .iso 文件启动。如果你忘了关联 .iso 文件,也不用担心。你可以通过选择 FreeDOS 虚拟机窗口上方的 “Devices” 来关联。然后就会发现 .iso 文件列在 “Optical Drives”。 + + +#### 第五步 – 安装 FreeDOS + +![][12] + +既然我们已经完成了所有的准备工作,让我们来开始安装 FreeDOS 吧。 + +首先,你需要知道关于最新版本的 VirtualBox 的一个 bug。当我们创建好虚拟硬盘然后选中 “Install to harddisk” 后,如果你开启虚拟机你会发现在 FreeDOS 的欢迎界面出现过后就是不断滚动无群无尽的机器代码。我最近就遇到过这个问题而且不管是 Linux 还是 Windows 平台的 VirtualBox 都会碰到这个问题。(我知道解决办法。) + +为了避开这个问题,你需要做一个简单的修改。当你看到 FreeDOS 的欢迎界面的时候,按下 Tab 键。(确认 “Install to harddrive” 已经选中。)在 “fdboot.img” 之后输入 `raw` 然后按下 Enter 键。接下来就会启动 FreeDOS 的安装程序。 + +![][13] + +安装程序会首先处理你的虚拟磁盘的格式化。当格式化完成后,安装程序会重启。当 FreeDOS 的欢迎界面再次出现的时候,你不得不重新输入 `raw` 就像你之前输入的内容那样。 + +要确保在安装过程中你遇到的所有问题你选的都是 “Yes”。但也要注意有一个很重要的问题:“What FreeDOS packages do you want to install?” 的答案并不是 “Yes” 或者 “No”。答案有两个选择分别是 “Base packages” 和 “Full installation”。“Base packages” 针对的是想体验类似原始的 MS-DOS 环境的人群。“Full installation” 则包括了一系列工具和实用的程序来提升 DOS。 + +在整个安装过程的最后,你可以选择重启或者继续停留在 DOS。选择“reboot”。 + +#### 第六步 – 设置网络 + +不同于原始的 DOS,FreeDOS 可以访问互联网。你可以安装新的软件包或者更新你已经安装的软件包。要想使用网络,你还需要在 FreeDOS 安装些应用程序。 + +![][14] + +首先,启动进入你新创建的 FreeDOS 虚拟机。在 FreeDOS 的选择界面,选中 “Boot from System harddrive”。 + +![][15] + +现在,你可以通过输入 `fdimples` 来访问 FreeDOS 的软件包管理工具。你也可以借助方向键来浏览软件包管理器然后用空格键选择类别或者软件包。在 “Networking” 类别中,你需要选中 `fdnet`。FreeDOS project 推荐也安装 `mtcp` 和 `wget`。多次点击 “Tab” 键直到选中 “OK” 然后在按下 “Enter” 键。安装完成后,输入 `reboot` 并按下 “Enter” 键确认执行。系统重启后,引导你的系统驱动。如果网络安装成功的话,你会在终端看到一些关于你的网络信息的新消息。 + +![][16] + +##### 注意 + +有时候 VirtualBox 的默认设置并没有生效。如果遇到这种情况,先关闭你的 FreeDOS 虚拟机窗口。在 VirtualBox 主界面右键你的虚拟机并选中 “Setting”。VirtualBox 默认的网络设置是 “NAT”。将它改为 “Bridged Adapter” 后再尝试安装 FreeDOS 的软件包。现在就应该能正常运作了。 + + +#### 第七步 – FreeDOS 的基本使用 + +##### 常见命令 + +既然你已经成功安装了 FreeDOS,让我们来看些基础命令。如果你已经在 Windows 平台使用过命令提示符,那么你会发现有很多命令都是相似的。 + + * `DIR`– 显示当前目录的内容 + * `CD` – 改变当前所在的目录 + * `COPY OLD.TXT NEW.TXT`– 复制文件 + * `TYPE TEST.TXT` – 显示文件内容 + * `DEL TEST.TXT` – 删除文件 + * `XCOPY DIR NEWDIR` – 复制目录及目录下的所有内容 + * `EDIT TEST.TXT`– 编辑一个文件 + * `MKDIR NEWDIR` – 创建一个新目录 + * `CLS` – 清除屏幕 + +你可以借助互联网或者 Jim Hall 所创建的 [handy cheat sheet][17] 来找到更多基本的 DOS 命令。 + +##### 运行一个程序 + +在 FreeDOS 上运行程序相当简单。需要注意的是当你借助 `fdimples` 软件包管理器来安装一个应用程序的时候,要确保你指定了待安装程序的 .EXE 文件的路径。这个路径会在应用程序的详细信息中显示。要想运行程序,通常你还需要进入到程序所在文件夹并输入该程序的名字。 + +例如,FreeDOS 中你可以安装一个叫 `FED` 的编辑器。安装完成后,你还需要做的就是进入 `C:\FED` 这个文件夹下并输入 `FED`。 + +对于位于 `\bin` 这个文件夹的程序,比如 Pico。这些程序可以在任意文件夹中被调用。 + +对于游戏通常会有一个或者两个 .EXE 程序,你玩游戏之前不得不先运行它们。这些设置文件通常能够修复你遇到的声音,视频,或者控制问题。 + +如果你遇到一些本教程中没指出的问题,别忘记访问 [home of FreeDOS][2] 来寻求解决办法。他们有一个 wiki 和一些其他的支持选项。 + +你使用过 FreeDOS 吗?你还想看关于 FreeDOS 哪些方面的教程?请在下面的评论区告诉我们。 + +如果你觉得本篇文章很有趣,请花一分钟的时间将它分享在你的社交媒体,Hacker News 或者 [Reddit][18]。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-freedos/ + +作者:[John Paul][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[WangYueScream](https://github.com/WangYueScream) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/john/ +[1]:https://itsfoss.com/interview-freedos-jim-hall/ +[2]:http://www.freedos.org/ +[3]:https://www.virtualbox.org/ +[4]:https://solus-project.com/home/ +[5]:https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/07/freedos-tutorial-1.jpg?w=787&ssl=1 +[6]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/07/freedos-tutorial-2.jpg?w=792&ssl=1 +[7]:https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/07/freedos-tutorial-3.jpg?w=797&ssl=1 +[8]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/freedos-tutorial-4.jpg?w=684&ssl=1 +[9]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/freedos-tutorial-6.jpg?w=705&ssl=1 +[10]:http://www.freedos.org/download/ +[11]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/07/freedos-tutorial-7.jpg?w=800&ssl=1 +[12]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/freedos-tutorial-8.png?w=789&ssl=1 +[13]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/freedos-tutorial-9.png?w=748&ssl=1 +[14]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/freedos-tutorial-10.png?w=792&ssl=1 +[15]:https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/07/freedos-tutorial-11.png?w=739&ssl=1 +[16]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/07/freedos-tutorial-12.png?w=744&ssl=1 +[17]:https://opensource.com/article/18/6/freedos-commands-cheat-sheet +[18]:http://reddit.com/r/linuxusersgroup From 5bacf6d82b9f66e3d93bc42b59769865298aa829 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 24 Dec 2018 17:37:49 +0800 Subject: [PATCH 035/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20The=20Linux=20com?= =?UTF-8?q?mand=20line=20can=20fetch=20fun=20from=20afar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ux command line can fetch fun from afar.md | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 sources/tech/20181223 The Linux command line can fetch fun from afar.md diff --git a/sources/tech/20181223 The Linux command line can fetch fun from afar.md b/sources/tech/20181223 The Linux command line can fetch fun from afar.md new file mode 100644 index 0000000000..3b5e77fa27 --- /dev/null +++ b/sources/tech/20181223 The Linux command line can fetch fun from afar.md @@ -0,0 +1,63 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The Linux command line can fetch fun from afar) +[#]: via: (https://opensource.com/article/18/12/linux-toy-remote) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +The Linux command line can fetch fun from afar +====== +Use these tools to access weather, reading material, and more from remote locations. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-remote.png?itok=mHm9POPi) + +We're almost to the end of our 24-day-long Linux command-line toys advent calendar. Hopefully, you've been following along, but if not, start back at [the beginning][1] and work your way through. You'll find plenty of games, diversions, and oddities for your Linux terminal. + +And while you may have seen some toys from our calendar before, we hope there’s at least one new thing for everyone. + +Today's toy (or actually, collection of toys) is a little different. So far I've mostly tried to focus on toys that are self-contained, and completely usable under an open source license. But I've gotten some great suggestions from readers which utilize an open source tool to access something remotely that may or may not be open source. Today, I'll round up a few of those. + +The first one is a total classic: use Telnet to watch an ASCII-rendition of Star Wars. Chances are that Telnet is already installed on your system, so all you'll need to do is run: + +``` +$ telnet towel.blinkenlights.nl +``` + +I feel like I first saw this one over a decade ago, so it's a bit amazing to me that it's still alive and online. If you've never watched it, set aside some time and go check it out. You won't regret it. + +![](https://opensource.com/sites/default/files/uploads/linux-toy-star-wars.png) + +Next, Opensource.com contributor [Manuel Dewald][2] suggested a way to fetch your local weather from the terminal. It's easy, and only requires that you have **curl** (or, well, **** **wget** ) installed. + +``` +$ curl wttr.in +``` + +![](https://opensource.com/sites/default/files/uploads/linux-toy-weather.png) + +Finally, while you can spend the holidays reading your favorite sites (including Opensource.com) from your favorite [command-line web browser][3], there are a few of my favorite sites that are more easily browsed with a dedicated client. Two of these include Reddit and Hacker News, for which there are clients that have been recommended to me that you may wish to try, mostly available under open source licenses. I've poked around with [haxor-news][4] (Hacker News) and [rtv][5] (Reddit), and both seem pretty cool. + +Do you have a favorite command-line toy that we should have included? It's a little late to submit a suggestion for this year, but we'd still love to feature some cool command-line toys in the new year. Let me know in the comments below, and I'll check it out. And let me know what you thought of today's amusement. + +Be sure to check out yesterday's toy, [Watch YouTube videos at the Linux terminal][6], and come back tomorrow for another! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-remote + +作者:[Jason Baker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jason-baker +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/18/12/linux-toy-boxes +[2]: https://opensource.com/users/ntlx +[3]: https://opensource.com/article/16/12/web-browsers-linux-command-line +[4]: https://github.com/donnemartin/haxor-news +[5]: https://github.com/michael-lazar/rtv +[6]: https://opensource.com/article/18/12/linux-toy-youtube-dl From ce9506bca4f84d991f8a05d611e89897e8a8f95e Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 24 Dec 2018 19:02:11 +0800 Subject: [PATCH 036/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=207=20CI/CD=20tools?= =?UTF-8?q?=20for=20sysadmins?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20181220 7 CI-CD tools for sysadmins.md | 136 ++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 sources/talk/20181220 7 CI-CD tools for sysadmins.md diff --git a/sources/talk/20181220 7 CI-CD tools for sysadmins.md b/sources/talk/20181220 7 CI-CD tools for sysadmins.md new file mode 100644 index 0000000000..d645cf2561 --- /dev/null +++ b/sources/talk/20181220 7 CI-CD tools for sysadmins.md @@ -0,0 +1,136 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (7 CI/CD tools for sysadmins) +[#]: via: (https://opensource.com/article/18/12/cicd-tools-sysadmins) +[#]: author: (Dan Barker https://opensource.com/users/barkerd427) + +7 CI/CD tools for sysadmins +====== +An easy guide to the top open source continuous integration, continuous delivery, and continuous deployment tools. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cicd_continuous_delivery_deployment_gears.png?itok=kVlhiEkc) + +Continuous integration, continuous delivery, and continuous deployment (CI/CD) have all existed in the developer community for many years. Some organizations have involved their operations counterparts, but many haven't. For most organizations, it's imperative for their operations teams to become just as familiar with CI/CD tools and practices as their development compatriots are. + +CI/CD practices can equally apply to infrastructure and third-party applications and internally developed applications. Also, there are many different tools but all use similar models. And possibly most importantly, leading your company into this new practice will put you in a strong position within your company, and you'll be a beacon for others to follow. + +Some organizations have been using CI/CD practices on infrastructure, with tools like [Ansible][1], [Chef][2], or [Puppet][3], for several years. Other tools, like [Test Kitchen][4], allow tests to be performed on infrastructure that will eventually host applications. In fact, those tests can even deploy the application into a production-like environment and execute application-level tests with production loads in more advanced configurations. However, just getting to the point of being able to test the infrastructure individually is a huge feat. Terraform can also use Test Kitchen for even more [ephemeral][5] and [idempotent][6] infrastructure configurations than some of the original configuration-management tools. Add in Linux containers and Kubernetes, and you can now test full infrastructure and application deployments with prod-like specs and resources that come and go in hours rather than months or years. Everything is wiped out before being deployed and tested again. + +However, you can also focus on getting your network configurations or database data definition language (DDL) files into version control and start running small CI/CD pipelines on them. Maybe it just checks syntax or semantics or some best practices. Actually, this is how most development pipelines started. Once you get the scaffolding down, it will be easier to build on. You'll start to find all kinds of use cases for pipelines once you get started. + +For example, I regularly write a newsletter within my company, and I maintain it in version control using [MJML][7]. I needed to be able to host a web version, and some folks liked being able to get a PDF, so I built a [pipeline][8]. Now when I create a new newsletter, I submit it for a merge request in GitLab. This automatically creates an index.html with links to HTML and PDF versions of the newsletter. The HTML and PDF files are also created in the pipeline. None of this is published until someone comes and reviews these artifacts. Then, GitLab Pages publishes the website and I can pull down the HTML to send as a newsletter. In the future, I'll automatically send the newsletter when the merge request is merged or after a special approval step. This seems simple, but it has saved me a lot of time. This is really at the core of what these tools can do for you. They will save you time. + +The key is creating tools to work in the abstract so that they can apply to multiple problems with little change. I should also note that what I created required almost no code except [some light HTML templating][9], some [node to loop through the HTML files][10], and some more [node to populate the index page with all the HTML pages and PDFs][11]. + +Some of this might look a little complex, but most of it was taken from the tutorials of the different tools I'm using. And many developers are happy to work with you on these types of things, as they might also find them useful when they're done. The links I've provided are to a newsletter we plan to start for [DevOps KC][12], and all the code for creating the site comes from the work I did on our internal newsletter. + +Many of the tools listed below can offer this type of interaction, but some offer a slightly different model. The emerging model in this space is that of a declarative description of a pipeline in something like YAML with each stage being ephemeral and idempotent. Many of these systems also ensure correct sequencing by creating a [directed acyclic graph][13] (DAG) over the different stages of the pipeline. + +These stages are often run in Linux containers and can do anything you can do in a container. Some tools, like [Spinnaker][14], focus only on the deployment component and offer some operational features that others don't normally include. [Jenkins][15] has generally kept pipelines in an XML format and most interactions occur within the GUI, but more recent implementations have used a [domain specific language][16] (DSL) using [Groovy][17]. Further, Jenkins jobs normally execute on nodes with a special Java agent installed and consist of a mix of plugins and pre-installed components. + +Jenkins introduced pipelines in its tool, but they were a bit challenging to use and contained several caveats. Recently, the creator of Jenkins decided to move the community toward a couple different initiatives that will hopefully breathe new life into the project—which is the one that really brought CI/CD to the masses. I think its most interesting initiative is creating a Cloud Native Jenkins that can turn a Kubernetes cluster into a Jenkins CI/CD platform. + +As you learn more about these tools and start bringing these practices into your company or your operations division, you'll quickly gain followers. You will increase your own productivity as well as that of others. We all have years of backlog to get to—how much would your co-workers love if you could give them enough time to start tackling that backlog? Not only that, but your customers will start to see increased application reliability, and your management will see you as a force multiplier. That certainly can't hurt during your next salary negotiation or when interviewing with all your new skills. + +Let's dig into the tools a bit more. We'll briefly cover each one and share links to more information. + +### GitLab CI + +GitLab is a fairly new entrant to the CI/CD space, but it's already achieved the top spot in the [Forrester Wave for Continuous Integration Tools][20]. That's a huge achievement in such a crowded and highly qualified field. What makes GitLab CI so great? It uses a YAML file to describe the entire pipeline. It also has a functionality called Auto DevOps that allows for simpler projects to have a pipeline built automatically with multiple tests built-in. This system uses [Herokuish buildpacks][21] to determine the language and how to build the application. Some languages can also manage databases, which is a real game-changer for building new applications and getting them deployed to production from the beginning of the development process. The system has native integrations into Kubernetes and will deploy your application automatically into a Kubernetes cluster using one of several different deployment methodologies, like percentage-based rollouts and blue-green deployments. + +In addition to its CI functionality, GitLab offers many complementary features like operations and monitoring with Prometheus deployed automatically with your application; portfolio and project management using GitLab Issues, Epics, and Milestones; security checks built into the pipeline with the results provided as an aggregate across multiple projects; and the ability to edit code right in GitLab using the WebIDE, which can even provide a preview or execute part of a pipeline for faster feedback. + +### GoCD + +GoCD comes from the great minds at Thoughtworks, which is testimony enough for its capabilities and efficiency. To me, GoCD's main differentiator from the rest of the pack is its [Value Stream Map][22] (VSM) feature. In fact, pipelines can be chained together with one pipeline providing the "material" for the next pipeline. This allows for increased independence for different teams with different responsibilities in the deployment process. This may be a useful feature when introducing this type of system in older organizations that intend to keep these teams separate—but having everyone using the same tool will make it easier later to find bottlenecks in the VSM and reorganize the teams or work to increase efficiencies. + +It's incredibly valuable to have a VSM for each product in a company; that GoCD allows this to be [described in JSON or YAML][23] in version control and presented visually with all the data around wait times makes this tool even more valuable to an organization trying to understand itself better. Start by installing GoCD and mapping out your process with only manual approval gates. Then have each team use the manual approvals so you can start collecting data on where bottlenecks might exist. + +### Travis CI + +Travis CI was my first experience with a Software as a Service (SaaS) CI system, and it's pretty awesome. The pipelines are stored as YAML with your source code, and it integrates seamlessly with tools like GitHub. I don't remember the last time a pipeline failed because of Travis CI or the integration—Travis CI has a very high uptime. Not only can it be used as SaaS, but it also has a version that can be hosted. I haven't run that version—there were a lot of components, and it looked a bit daunting to install all of it. I'm guessing it would be much easier to deploy it all to Kubernetes with [Helm charts provided by Travis CI][26]. Those charts don't deploy everything yet, but I'm sure it will grow even more in the future. There is also an enterprise version if you don't want to deal with the hassle. + +However, if you're developing open source code, you can use the SaaS version of Travis CI for free. That is an awesome service provided by an awesome team! This alleviates a lot of overhead and allows you to use a fairly common platform for developing open source code without having to run anything. + +### Jenkins + +Jenkins is the original, the venerable, de facto standard in CI/CD. If you haven't already, you need to read "[Jenkins: Shifting Gears][27]" from Kohsuke, the creator of Jenkins and CTO of CloudBees. It sums up all of my feelings about Jenkins and the community from the last decade. What he describes is something that has been needed for several years, and I'm happy CloudBees is taking the lead on this transformation. Jenkins will be a bit overwhelming to most non-developers and has long been a burden on its administrators. However, these are items they're aiming to fix. + +[Jenkins Configuration as Code][28] (JCasC) should help fix the complex configuration issues that have plagued admins for years. This will allow for a zero-touch configuration of Jenkins masters through a YAML file, similar to other CI/CD systems. [Jenkins Evergreen][29] aims to make this process even easier by providing predefined Jenkins configurations based on different use cases. These distributions should be easier to maintain and upgrade than the normal Jenkins distribution. + +Jenkins 2 introduced native pipeline functionality with two types of pipelines, which [I discuss][30] in a LISA17 presentation. Neither is as easy to navigate as YAML when you're doing something simple, but they're quite nice for doing more complex tasks. + +[Jenkins X][31] is the full transformation of Jenkins and will likely be the implementation of Cloud Native Jenkins (or at least the thing most users see when using Cloud Native Jenkins). It will take JCasC and Evergreen and use them at their best natively on Kubernetes. These are exciting times for Jenkins, and I look forward to its innovation and continued leadership in this space. + +### Concourse CI + +I was first introduced to Concourse through folks at Pivotal Labs when it was an early beta version—there weren't many tools like it at the time. The system is made of microservices, and each job runs within a container. One of its most useful features that other tools don't have is the ability to run a job from your local system with your local changes. This means you can develop locally (assuming you have a connection to the Concourse server) and run your builds just as they'll run in the real build pipeline. Also, you can rerun failed builds from your local system and inject specific changes to test your fixes. + +Concourse also has a simple extension system that relies on the fundamental concept of resources. Basically, each new feature you want to provide to your pipeline can be implemented in a Docker image and included as a new resource type in your configuration. This keeps all functionality encapsulated in a single, immutable artifact that can be upgraded and modified independently, and breaking changes don't necessarily have to break all your builds at the same time. + +### Spinnaker + +Spinnaker comes from Netflix and is more focused on continuous deployment than continuous integration. It can integrate with other tools, including Travis and Jenkins, to kick off test and deployment pipelines. It also has integrations with monitoring tools like Prometheus and Datadog to make decisions about deployments based on metrics provided by these systems. For example, the canary deployment uses a judge concept and the metrics being collected to determine if the latest canary deployment has caused any degradation in pertinent metrics and should be rolled back or if deployment can continue. + +A couple of additional, unique features related to deployments cover an area that is often overlooked when discussing continuous deployment, and might even seem antithetical, but is critical to success: Spinnaker helps make continuous deployment a little less continuous. It will prevent a stage from running during certain times to prevent a deployment from occurring during a critical time in the application lifecycle. It can also enforce manual approvals to ensure the release occurs when the business will benefit the most from the change. In fact, the whole point of continuous integration and continuous deployment is to be ready to deploy changes as quickly as the business needs to change. + +### Screwdriver + +Screwdriver is an impressively simple piece of engineering. It uses a microservices approach and relies on tools like Nomad, Kubernetes, and Docker to act as its execution engine. There is a pretty good [deployment tutorial][34] for deploying to AWS and Kubernetes, but it could be improved once the in-progress [Helm chart][35] is completed. + +Screwdriver also uses YAML for its pipeline descriptions and includes a lot of sensible defaults, so there's less boilerplate configuration for each pipeline. The configuration describes an advanced workflow that can have complex dependencies among jobs. For example, a job can be guaranteed to run after or before another job. Jobs can run in parallel and be joined afterward. You can also use logical operators to run a job, for example, if any of its dependencies are successful or only if all are successful. Even better is that you can specify certain jobs to be triggered from a pull request. Also, dependent jobs won't run when this occurs, which allows easy segregation of your pipeline for when an artifact should go to production and when it still needs to be reviewed. + +This is only a brief description of these CI/CD tools—each has even more cool features and differentiators you can investigate. They are all open source and free to use, so go deploy them and see which one fits your needs best. + +### What to read next + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/cicd-tools-sysadmins + +作者:[Dan Barker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/barkerd427 +[b]: https://github.com/lujun9972 +[1]: https://www.ansible.com/ +[2]: https://www.chef.io/ +[3]: https://puppet.com/ +[4]: https://github.com/test-kitchen/test-kitchen +[5]: https://www.merriam-webster.com/dictionary/ephemeral +[6]: https://en.wikipedia.org/wiki/Idempotence +[7]: https://mjml.io/ +[8]: https://gitlab.com/devopskc/newsletter/blob/master/.gitlab-ci.yml +[9]: https://gitlab.com/devopskc/newsletter/blob/master/index/index.html +[10]: https://gitlab.com/devopskc/newsletter/blob/master/html-to-pdf.js +[11]: https://gitlab.com/devopskc/newsletter/blob/master/populate-index.js +[12]: https://devopskc.com/ +[13]: https://en.wikipedia.org/wiki/Directed_acyclic_graph +[14]: https://www.spinnaker.io/ +[15]: https://jenkins.io/ +[16]: https://martinfowler.com/books/dsl.html +[17]: http://groovy-lang.org/ +[18]: https://about.gitlab.com/product/continuous-integration/ +[19]: https://gitlab.com/gitlab-org/gitlab-ce/ +[20]: https://about.gitlab.com/2017/09/27/gitlab-leader-continuous-integration-forrester-wave/ +[21]: https://github.com/gliderlabs/herokuish +[22]: https://www.gocd.org/getting-started/part-3/#value_stream_map +[23]: https://docs.gocd.org/current/advanced_usage/pipelines_as_code.html +[24]: https://docs.travis-ci.com/ +[25]: https://github.com/travis-ci/travis-ci +[26]: https://github.com/travis-ci/kubernetes-config +[27]: https://jenkins.io/blog/2018/08/31/shifting-gears/ +[28]: https://jenkins.io/projects/jcasc/ +[29]: https://github.com/jenkinsci/jep/blob/master/jep/300/README.adoc +[30]: https://danbarker.codes/talk/lisa17-becoming-plumber-building-deployment-pipelines/ +[31]: https://jenkins-x.io/ +[32]: https://concourse-ci.org/ +[33]: https://github.com/concourse/concourse +[34]: https://docs.screwdriver.cd/cluster-management/kubernetes +[35]: https://github.com/screwdriver-cd/screwdriver-chart From 8942b1cc62d410fcf30597ce1758fc72bf997925 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 24 Dec 2018 19:03:38 +0800 Subject: [PATCH 037/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20to=20Build?= =?UTF-8?q?=20a=20Netboot=20Server,=20Part=203?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...1 How to Build a Netboot Server, Part 3.md | 284 ++++++++++++++++++ 1 file changed, 284 insertions(+) create mode 100644 sources/tech/20181221 How to Build a Netboot Server, Part 3.md diff --git a/sources/tech/20181221 How to Build a Netboot Server, Part 3.md b/sources/tech/20181221 How to Build a Netboot Server, Part 3.md new file mode 100644 index 0000000000..7c4501b58b --- /dev/null +++ b/sources/tech/20181221 How to Build a Netboot Server, Part 3.md @@ -0,0 +1,284 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Build a Netboot Server, Part 3) +[#]: via: (https://fedoramagazine.org/how-to-build-a-netboot-server-part-3/) +[#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/) + +How to Build a Netboot Server, Part 3 +====== + +![](https://fedoramagazine.org/wp-content/uploads/2018/12/netboot3-816x345.jpg) + +The [How to Build a Netboot Server, Part 1][1] article provided a minimal [iPXE][2] boot script for your netboot image. Many users probably have a local operating system that they want to use in addition to the netboot image. But switching bootloaders using the typical workstation’s BIOS can be cumbersome. This part of the series shows how to set up some more complex iPXE configurations. These allow the end user to easily choose which operating system they want to boot. They also let the system administrator manage the boot menus from a central server. + +### An interactive iPXE boot menu + +The commands below redefine the netboot image’s boot.cfg as an interactive iPXE boot menu with a 5 second countdown timer: + +``` +$ MY_FVER=29 +$ MY_KRNL=$(ls -c /fc$MY_FVER/lib/modules | head -n 1) +$ MY_DNS1=192.0.2.91 +$ MY_DNS2=192.0.2.92 +$ MY_NAME=server-01.example.edu +$ MY_EMAN=$(echo $MY_NAME | tr '.' "\n" | tac | tr "\n" '.' | cut -b -${#MY_NAME}) +$ MY_ADDR=$(host -t A $MY_NAME | awk '{print $4}') +$ cat << END > $HOME/esp/linux/boot.cfg +#!ipxe + +set timeout 5000 + +:menu +menu iPXE Boot Menu +item --key 1 lcl 1. Microsoft Windows 10 +item --key 2 f$MY_FVER 2. RedHat Fedora $MY_FVER +choose --timeout \${timeout} --default lcl selected || goto shell +set timeout 0 +goto \${selected} + +:failed +echo boot failed, dropping to shell... +goto shell + +:shell +echo type 'exit' to get the back to the menu +set timeout 0 +shell +goto menu + +:lcl +exit + +:f$MY_FVER +kernel --name kernel.efi \${prefix}/vmlinuz-$MY_KRNL initrd=initrd.img ro ip=dhcp rd.peerdns=0 nameserver=$MY_DNS1 nameserver=$MY_DNS2 root=/dev/disk/by-path/ip-$MY_ADDR:3260-iscsi-iqn.$MY_EMAN:fc$MY_FVER-lun-1 netroot=iscsi:$MY_ADDR::::iqn.$MY_EMAN:fc$MY_FVER console=tty0 console=ttyS0,115200n8 audit=0 selinux=0 quiet +initrd --name initrd.img \${prefix}/initramfs-$MY_KRNL.img +boot || goto failed +END +``` + +The above menu has five sections: + + * **menu** defines the actual menu that will be shown on the screen. + * **failed** notifies the user that something went wrong and drops the user to a shell so they can troubleshot the problem. + * **shell** provides an interactive command prompt. You can reach it either by pressing the **Esc** key while at the boot menu or if the “boot” command returns with a failure code. + * **lcl** contains a single command that tells iPXE to exit and return control back to the BIOS. Whatever you want to boot by default (e.g. the workstation’s local hard drive) **must** be listed as the next boot item right after iPXE in your workstation’s BIOS. + * **f29** contains the same netboot code used earlier but with the final exit replaced with goto failed. + + + +Copy the updated boot.cfg from your $HOME/esp/linux directory out to the ESPs of all your client systems. If all goes well, you should see results similar to the image below: + +![][3] + +### A server hosted boot menu + +Another feature you can add to the netboot server is the ability to manage all the client boot menus from one central location. This feature can be especially useful when rolling out a new version of the OS. It lets you perform a sort of [atomic transaction][4] to switch all clients over to the new OS after you’ve copied the new kernel and initramfs out to the ESPs of all the clients. + +Install Mojolicious: + +``` +$ sudo -i +# dnf install -y perl-Mojolicious +``` + +Define the “bootmenu” app: + +``` +# mkdir /opt/bootmenu +# cat << END > /opt/bootmenu/bootmenu.pl +#!/usr/bin/env perl +use Mojolicious::Lite; +use Mojolicious::Plugins; + +plugin 'Config'; + +get '/menu'; + +app->start; +END +# chmod 755 /opt/bootmenu/bootmenu.pl +``` + +Define the configuration file for the bootmenu app: + +``` +# cat << END > /opt/bootmenu/bootmenu.conf +{ + hypnotoad => { + listen => ['http://*:80'], + pid_file => '/run/bootmenu/bootmenu.pid', + } +} +END +``` + +This is an extremely simple Mojolicious application that listens on port 80 and only answers to /menu requests. If you want a quick introduction to what Mojolicious can do, run man Mojolicious::Guides::Growing to view the manual. Use the **Q** key to quit the manual. + +Move boot.cfg over to our netboot app as a template named menu.html.ep: + +``` +# mkdir /opt/bootmenu/templates +# mv $HOME/esp/linux/boot.cfg /opt/bootmenu/templates/menu.html.ep +``` + +Define a systemd service to manage the bootmenu app: + +``` +# cat << END > /etc/systemd/system/bootmenu.service +[Unit] +Description=Serves iPXE Menus over HTTP +After=network-online.target + +[Service] +Type=forking +DynamicUser=true +RuntimeDirectory=bootmenu +PIDFile=/run/bootmenu/bootmenu.pid +ExecStart=/usr/bin/hypnotoad /opt/bootmenu/bootmenu.pl +ExecReload=/usr/bin/hypnotoad /opt/bootmenu/bootmenu.pl +AmbientCapabilities=CAP_NET_BIND_SERVICE +KillMode=process + +[Install] +WantedBy=multi-user.target +END +``` + +Add an exception for the HTTP service to the local firewall and start the bootmenu service: + +``` +# firewall-cmd --add-service http +# firewall-cmd --runtime-to-permanent +# systemctl enable bootmenu.service +# systemctl start bootmenu.service +``` + +Test it with wget: + +``` +$ sudo dnf install -y wget +$ MY_BOOTMENU_SERVER=server-01.example.edu +$ wget -q -O - http://$MY_BOOTMENU_SERVER/menu +``` + +The above command should output something similar to the following: + +``` +#!ipxe + +set timeout 5000 + +:menu +menu iPXE Boot Menu +item --key 1 lcl 1. Microsoft Windows 10 +item --key 2 f29 2. RedHat Fedora 29 +choose --timeout ${timeout} --default lcl selected || goto shell +set timeout 0 +goto ${selected} + +:failed +echo boot failed, dropping to shell... +goto shell + +:shell +echo type 'exit' to get the back to the menu +set timeout 0 +shell +goto menu + +:lcl +exit + +:f29 +kernel --name kernel.efi ${prefix}/vmlinuz-4.19.4-300.fc29.x86_64 initrd=initrd.img ro ip=dhcp rd.peerdns=0 nameserver=192.0.2.91 nameserver=192.0.2.92 root=/dev/disk/by-path/ip-192.0.2.158:3260-iscsi-iqn.edu.example.server-01:fc29-lun-1 netroot=iscsi:192.0.2.158::::iqn.edu.example.server-01:fc29 console=tty0 console=ttyS0,115200n8 audit=0 selinux=0 quiet +initrd --name initrd.img ${prefix}/initramfs-4.19.4-300.fc29.x86_64.img +boot || goto failed +``` + +Now that the boot menu server is working, rebuild the ipxe.efi bootloader with an init script that points to it. + +First, update the init.ipxe script created in part one of this series: + +``` +$ MY_BOOTMENU_SERVER=server-01.example.edu +$ cat << END > $HOME/ipxe/init.ipxe +#!ipxe + +dhcp || exit +set prefix file:///linux +chain http://$MY_BOOTMENU_SERVER/menu || exit +END +``` + +Now, rebuild the boot loader: + +``` +$ cd $HOME/ipxe/src +$ make clean +$ make bin-x86_64-efi/ipxe.efi EMBED=../init.ipxe +``` + +Copy the updated bootloader to your ESP: + +``` +$ cp $HOME/ipxe/src/bin-x86_64-efi/ipxe.efi $HOME/esp/efi/boot/bootx64.efi +``` + +After you’ve copied the updated bootloader to all your clients, you can make future updates to the boot menu simply by editing /opt/bootmenu/templates/menu.html.ep and running: + +``` +$ sudo systemctl restart bootmenu.service +``` + +### Making further changes + +If the boot menu server is working properly, you’ll longer need the the boot.cfg file on your client systems. + +For example, re-add the Fedora 28 image to the boot menu: + +``` +$ sudo -i +# MY_FVER=28 +# MY_KRNL=$(ls -c /fc$MY_FVER/lib/modules | head -n 1) +# MY_DNS1=192.0.2.91 +# MY_DNS2=192.0.2.92 +# MY_NAME=$(> /opt/bootmenu/templates/menu.html.ep + +:f$MY_FVER +kernel --name kernel.efi \${prefix}/vmlinuz-$MY_KRNL initrd=initrd.img ro ip=dhcp rd.peerdns=0 nameserver=$MY_DNS1 nameserver=$MY_DNS2 root=/dev/disk/by-path/ip-$MY_ADDR:3260-iscsi-iqn.$MY_EMAN:fc$MY_FVER-lun-1 netroot=iscsi:$MY_ADDR::::iqn.$MY_EMAN:fc$MY_FVER console=tty0 console=ttyS0,115200n8 audit=0 selinux=0 quiet +initrd --name initrd.img \${prefix}/initramfs-$MY_KRNL.img +boot || goto failed +END +# sed -i "/item --key 2/a item --key 3 f$MY_FVER 3. RedHat Fedora $MY_FVER" /opt/bootmenu/templates/menu.html.ep +# systemctl restart bootmenu.service +``` + +If all goes well, your clients should see results similar to the image below the next time they boot: + +![][5] + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/how-to-build-a-netboot-server-part-3/ + +作者:[Gregory Bartholomew][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/glb/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/how-to-build-a-netboot-server-part-1/ +[2]: https://ipxe.org/ +[3]: https://fedoramagazine.org/wp-content/uploads/2018/11/netboot-menu-1024x641.png +[4]: https://en.wikipedia.org/wiki/Atomicity_(database_systems) +[5]: https://fedoramagazine.org/wp-content/uploads/2018/11/netboot-menu-updated-1024x641.png From c970813fb07650d8caea5de0d5bff7b5014c4f0b Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 24 Dec 2018 19:06:26 +0800 Subject: [PATCH 038/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20To=20Instal?= =?UTF-8?q?l=20Microsoft=20.NET=20Core=20SDK=20On=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nstall Microsoft .NET Core SDK On Linux.md | 337 ++++++++++++++++++ 1 file changed, 337 insertions(+) create mode 100644 sources/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md diff --git a/sources/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md b/sources/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md new file mode 100644 index 0000000000..728db3b7be --- /dev/null +++ b/sources/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md @@ -0,0 +1,337 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Install Microsoft .NET Core SDK On Linux) +[#]: via: (https://www.ostechnix.com/how-to-install-microsoft-net-core-sdk-on-linux/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +How To Install Microsoft .NET Core SDK On Linux +====== + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/NET-Core-SDK-720x340.png) + +The **.NET Core** is a free, cross platform and open source framework developed by Microsoft to build desktop applications, mobile apps, web apps, IoT apps and gaming apps etc. If you’re dotnet developer coming from Windows platform, .NET core helps you to setup your development environment easily on any Linux and Unix-like operating systems. This step by step guide explains how to install Microsoft .NET Core SDK on Linux and how to write your first app using .Net. + +### Install Microsoft .NET Core SDK On Linux + +The .NET core supports GNU/Linux, Mac OS and Windows. .Net core can be installed on popular GNU/Linux operating systems including Debian, Fedora, CentOS, Oracle Linux, RHEL, SUSE/openSUSE, and Ubuntu. As of writing this guide, the latest .NET core version was **2.2**. + +On **Debian 9** , you can install .NET Core SDK as shown below. + +First of all, you need to register Microsoft key and add .NET repository by running the following commands: + +``` +$ wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg +$ sudo mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/ +$ wget -q https://packages.microsoft.com/config/debian/9/prod.list +$ sudo mv prod.list /etc/apt/sources.list.d/microsoft-prod.list +$ sudo chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg +$ sudo chown root:root /etc/apt/sources.list.d/microsoft-prod.list +``` + +After registering the key and adding the repository, install .NET SDK using commands: + +``` +$ sudo apt-get update +$ sudo apt-get install dotnet-sdk-2.2 +``` + +**On Debian 8:** + +Add Microsoft key and enable .NET repository: + +``` +$ wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg +$ sudo mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/ +$ wget -q https://packages.microsoft.com/config/debian/8/prod.list +$ sudo mv prod.list /etc/apt/sources.list.d/microsoft-prod.list +$ sudo chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg +$ sudo chown root:root /etc/apt/sources.list.d/microsoft-prod.list +``` + +Install .NET SDK: + +``` +$ sudo apt-get update +$ sudo apt-get install dotnet-sdk-2.2 +``` + +**On Fedora 28:** + +Add Microsoft key and enable .NET repository: + +``` +$ sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc +$ wget -q https://packages.microsoft.com/config/fedora/27/prod.repo +$ sudo mv prod.repo /etc/yum.repos.d/microsoft-prod.repo +$ sudo chown root:root /etc/yum.repos.d/microsoft-prod.repo +``` + +Now, Install .NET SDK: + +``` +$ sudo dnf update +$ sudo dnf install dotnet-sdk-2.2 +``` + +On **Fedora 27** , add the key and repository using commands: + +``` +$ sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc +$ wget -q https://packages.microsoft.com/config/fedora/27/prod.repo +$ sudo mv prod.repo /etc/yum.repos.d/microsoft-prod.repo +$ sudo chown root:root /etc/yum.repos.d/microsoft-prod.repo +``` + +And install .NET SDK using commands: + +``` +$ sudo dnf update +$ sudo dnf install dotnet-sdk-2.2 +``` + +**On CentOS/Oracle Linux:** + +Add Microsoft key and enable .NET core repository: + +``` +$ sudo rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm +``` + +Update the repositories and install .NET SDK: + +``` +$ sudo yum update +$ sudo yum install dotnet-sdk-2.2 +``` + +**On openSUSE Leap:** + +Add key, enable repository and install necessary dependencies using the following commands: + +``` +$ sudo zypper install libicu +$ sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc +$ wget -q https://packages.microsoft.com/config/opensuse/42.2/prod.repo +$ sudo mv prod.repo /etc/zypp/repos.d/microsoft-prod.repo +$ sudo chown root:root /etc/zypp/repos.d/microsoft-prod.repo +``` + +Update the repositories and Install .NET SDK using commands: + +``` +$ sudo zypper update +$ sudo zypper install dotnet-sdk-2.2 +``` + +**On Ubuntu 18.04 LTS:** + +Register the Microsoft key and .NET core repository using commands: + +``` +$ wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb +$ sudo dpkg -i packages-microsoft-prod.deb +``` + +Enable ‘Universe’ repository using: + +``` +$ sudo add-apt-repository universe +``` + +Then, install .NET Core SDK using command: + +``` +$ sudo apt-get install apt-transport-https +$sudo apt-get update +$ sudo apt-get install dotnet-sdk-2.2 +``` + +**On Ubuntu 16.04 LTS:** + +Register Microsoft key and .NET repository using commands: + +``` +$ wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb +$ sudo dpkg -i packages-microsoft-prod.deb +``` + +And then, Install .NET core SDK: + +``` +$ sudo apt-get install apt-transport-https +$ sudo apt-get update +$ sudo apt-get install dotnet-sdk-2.2 +``` + +### Create Your First App + +We have successfully installed .Net Core SDK in our Linux box. It is time to create our first app using dotnet. + +For the purpose of this guide, I am going to create a new app called **“ostechnixApp”**. To do so, simply run the following command: + +``` +$ dotnet new console -o ostechnixApp +``` + +**Sample output:** + +``` +Welcome to .NET Core! +--------------------- +Learn more about .NET Core: https://aka.ms/dotnet-docs +Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli-docs + +Telemetry +--------- +The .NET Core tools collect usage data in order to help us improve your experience. The data is anonymous and doesn't include command-line arguments. The data is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell. + +Read more about .NET Core CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry + +ASP.NET Core +------------ +Successfully installed the ASP.NET Core HTTPS Development Certificate. +To trust the certificate run 'dotnet dev-certs https --trust' (Windows and macOS only). For establishing trust on other platforms refer to the platform specific documentation. +For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054. +Getting ready... +The template "Console Application" was created successfully. + +Processing post-creation actions... +Running 'dotnet restore' on ostechnixApp/ostechnixApp.csproj... +Restoring packages for /home/sk/ostechnixApp/ostechnixApp.csproj... +Generating MSBuild file /home/sk/ostechnixApp/obj/ostechnixApp.csproj.nuget.g.props. +Generating MSBuild file /home/sk/ostechnixApp/obj/ostechnixApp.csproj.nuget.g.targets. +Restore completed in 894.27 ms for /home/sk/ostechnixApp/ostechnixApp.csproj. + +Restore succeeded. +``` + +As you can see in the above output, .Net has created a new application of type console. The parameter -o creates a directory named “ostechnixApp” where you store your app data with all necessary files. + +Let us switch to ostechnixApp directory and see what’s in there. + +``` +$ cd ostechnixApp/ +$ ls +obj ostechnixApp.csproj Program.cs +``` + +As you there are three files named **ostechnixApp.csproj** and **Program.cs** and one directory named **obj**. By default, the Program.cs file will contain the code to run the ‘Hello World’ program in the console. Let us have a look at the code. + +``` +$ cat Program.cs +using System; + +namespace ostechnixApp +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} +``` + +To run the newly created app, simply run the following command: + +``` +$ dotnet run +Hello World! +``` + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/run-dotnet.png) + +Simple, isn’t it? Yes, it is! Now, you can write your code in the **Program.cs** file and run it as shown above. + +Alternatively, you can create a new directory, for example mycode, using commands: + +``` +$ mkdir ~/.mycode + +$ cd mycode/ +``` + +…and make that as your new development environment by running the following command: + +``` +$ dotnet new console +``` + +Sample output: + +``` +The template "Console Application" was created successfully. + +Processing post-creation actions... +Running 'dotnet restore' on /home/sk/mycode/mycode.csproj... +Restoring packages for /home/sk/mycode/mycode.csproj... +Generating MSBuild file /home/sk/mycode/obj/mycode.csproj.nuget.g.props. +Generating MSBuild file /home/sk/mycode/obj/mycode.csproj.nuget.g.targets. +Restore completed in 331.87 ms for /home/sk/mycode/mycode.csproj. + +Restore succeeded. +``` + +The above command will create two files named **mycode.csproj** and **Program.cs** and one directory named **obj**. Open the Program.cs file in your favorite editor, delete or modify the existing ‘hello world’ code with your own code. + +Once the code is written, save and close the Program.cs file and run the app using command: + +``` +$ dotnet run +``` + +To check the installed .NET core SDK version, simply run: + +``` +$ dotnet --version +2.2.101 +``` + +To get help, run: + +``` +$ dotnet --help +``` + +### Get Microsoft Visual Studio Code Editor + +To write the code, you can use your favorite editors of your choice. Microsoft has also its own editor named “ **Microsoft Visual Studio Code** ” with support for .NET. It is an open source, lightweight and powerful source code editor. It comes with built-in support for JavaScript, TypeScript and Node.js and has a rich ecosystem of extensions for other languages (such as C++, C#, Python, PHP, Go) and runtimes (such as .NET and Unity). It is a cross-platform code editor, so you can use it in Microsoft Windows, GNU/Linux, and Mac OS X. You can use it if you’re interested. + +To know how to install and use it on Linux, please refer the following guide. + +[Install Microsoft Visual Studio Code In Linux][3] + +[**This page**][1] has some basic tutorials to learn .NET Core and .NET Core SDK tools using Visual Studio Code editor. Go and check them to learn more. + +### Telemetry + +By default, the .NET core SDK will collect the usage data using a feature called **‘Telemetry’**. The collected data is anonymous and shared to the development team and community under the [Creative Commons Attribution License][2]. So the .NET team will understand how the tools are used and decide how they can be improved over time. If you don’t want to share your usage information, you can simply opt-out of telemetry by setting the **DOTNET_CLI_TELEMETRY_OPTOUT** environment variable to **‘1’** or **‘true’** using your favorite shell. + +And, that’s all. You know how to install .NET Core SDK on various Linux platforms and how to create a basic app using it. TO learn more about .NET usage, refer the links given at the end of this guide. + +More good stuffs to come. Stay tuned! + +Cheers! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-install-microsoft-net-core-sdk-on-linux/ + +作者:[SK][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: https://docs.microsoft.com/en-us/dotnet/core/tutorials/index +[2]: https://creativecommons.org/licenses/by/4.0/ +[3]: https://www.ostechnix.com/install-microsoft-visual-studio-code-linux/ From dfe81d4ea0255144219dbbbaee1b93915ecb2a96 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 24 Dec 2018 19:12:10 +0800 Subject: [PATCH 039/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20PowerTOP=20?= =?UTF-8?q?=E2=80=93=20Monitors=20Power=20Usage=20and=20Improve=20Laptop?= =?UTF-8?q?=20Battery=20Life=20in=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nd Improve Laptop Battery Life in Linux.md | 411 ++++++++++++++++++ 1 file changed, 411 insertions(+) create mode 100644 sources/tech/20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md diff --git a/sources/tech/20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md b/sources/tech/20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md new file mode 100644 index 0000000000..a615ffc73a --- /dev/null +++ b/sources/tech/20181219 PowerTOP - Monitors Power Usage and Improve Laptop Battery Life in Linux.md @@ -0,0 +1,411 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (PowerTOP – Monitors Power Usage and Improve Laptop Battery Life in Linux) +[#]: via: (https://www.2daygeek.com/powertop-monitors-laptop-battery-usage-linux/) +[#]: author: (Vinoth Kumar https://www.2daygeek.com/author/vinoth/) + +PowerTOP – Monitors Power Usage and Improve Laptop Battery Life in Linux +====== + +We all know, we almost 80-90% migrated from PC (Desktop) to laptop. + +But one thing we want from a laptop, it’s long battery life and we want to use every drop of power. + +So it’s good to know where our power is going and getting waste. + +You can use the powertop utility to see what’s drawing power when your system’s not plugged in. + +You need to run the powertop utility in terminal with super user privilege. + +It will access the hardware and measure power usage. + +### What is PowerTOP + +PowerTOP is a Linux tool to diagnose issues with power consumption and power management. + +It was developed by Intel to enable various power-saving modes in kernel, userspace, and hardware. + +In addition to being a diagnostic tool, PowerTOP also has an interactive mode where the user can experiment various power management settings for cases where the Linux distribution has not enabled these settings. + +It is possible to monitor processes and show which of them are utilizing the CPU and wake it from its Idle-States, allowing to identify applications with particular high power demands. + +### How to Install PowerTOP + +PowerTOP package is available in most of the distributions official repository so, use the distributions **[Package Manager][1]** to install it. + +For **`Fedora`** system, use **[DNF Command][2]** to install PowerTOP. + +``` +$ sudo dnf install powertop +``` + +For **`Debian/Ubuntu`** systems, use **[APT-GET Command][3]** or **[APT Command][4]** to install PowerTOP. + +``` +$ sudo apt install powertop +``` + +For **`Arch Linux`** based systems, use **[Pacman Command][5]** to install PowerTOP. + +``` +$ sudo pacman -S powertop +``` + +For **`RHEL/CentOS`** systems, use **[YUM Command][6]** to install PowerTOP. + +``` +$ sudo yum install powertop +``` + +For **`openSUSE Leap`** system, use **[Zypper Command][7]** to install PowerTOP. + +``` +$ sudo zypper install powertop +``` + +### How To Access PowerTOP + +PowerTOP requires super user privilege so, run as root to use PowerTOP utility on your Linux system. + +By default it shows `Overview` tab where we can see the power usage consumption for all the devices. Also shows your system wakeups seconds. + +``` +$ sudo powertop + +PowerTOP v2.9 Overview Idle stats Frequency stats Device stats Tunables + +The battery reports a discharge rate of 12.6 W +The power consumed was 259 J +The estimated remaining time is 1 hours, 52 minutes + +Summary: 1692.9 wakeups/second, 0.0 GPU ops/seconds, 0.0 VFS ops/sec and 54.9% CPU use + + Usage Events/s Category Description + 9.3 ms/s 529.4 Timer tick_sched_timer + 378.5 ms/s 139.8 Process [PID 2991] /usr/lib/firefox/firefox -contentproc -childID 7 -isForBrowser -prefsLen 8314 -prefMapSize 173895 -schedulerPrefs 00 + 7.5 ms/s 141.7 Timer hrtimer_wakeup + 3.3 ms/s 102.7 Process [PID 1527] /usr/lib/firefox/firefox --new-window + 11.6 ms/s 69.1 Process [PID 1568] /usr/lib/firefox/firefox -contentproc -childID 1 -isForBrowser -prefsLen 1 -prefMapSize 173895 -schedulerPrefs 0001, + 6.2 ms/s 59.0 Process [PID 1496] /usr/lib/firefox/firefox --new-window + 2.1 ms/s 59.6 Process [PID 2466] /usr/lib/firefox/firefox -contentproc -childID 3 -isForBrowser -prefsLen 5814 -prefMapSize 173895 -schedulerPrefs 00 + 1.8 ms/s 52.3 Process [PID 2052] /usr/lib/firefox/firefox -contentproc -childID 4 -isForBrowser -prefsLen 5814 -prefMapSize 173895 -schedulerPrefs 00 + 1.8 ms/s 50.8 Process [PID 3034] /usr/lib/firefox/firefox -contentproc -childID 7 -isForBrowser -prefsLen 8314 -prefMapSize 173895 -schedulerPrefs 00 + 3.6 ms/s 48.4 Process [PID 3009] /usr/lib/firefox/firefox -contentproc -childID 7 -isForBrowser -prefsLen 8314 -prefMapSize 173895 -schedulerPrefs 00 + 7.5 ms/s 46.2 Process [PID 2996] /usr/lib/firefox/firefox -contentproc -childID 7 -isForBrowser -prefsLen 8314 -prefMapSize 173895 -schedulerPrefs 00 + 25.2 ms/s 33.6 Process [PID 1528] /usr/lib/firefox/firefox --new-window + 5.7 ms/s 32.2 Interrupt [7] sched(softirq) + 2.1 ms/s 32.2 Process [PID 1811] /usr/lib/firefox/firefox -contentproc -childID 4 -isForBrowser -prefsLen 5814 -prefMapSize 173895 -schedulerPrefs 00 + 19.7 ms/s 25.0 Process [PID 1794] /usr/lib/firefox/firefox -contentproc -childID 4 -isForBrowser -prefsLen 5814 -prefMapSize 173895 -schedulerPrefs 00 + 1.9 ms/s 31.5 Process [PID 1596] /usr/lib/firefox/firefox -contentproc -childID 1 -isForBrowser -prefsLen 1 -prefMapSize 173895 -schedulerPrefs 0001, + 3.1 ms/s 29.9 Process [PID 1535] /usr/lib/firefox/firefox --new-window + 7.1 ms/s 28.2 Process [PID 1488] /usr/lib/firefox/firefox --new-window + 1.8 ms/s 29.5 Process [PID 1762] /usr/lib/firefox/firefox -contentproc -childID 3 -isForBrowser -prefsLen 5814 -prefMapSize 173895 -schedulerPrefs 00 + 8.8 ms/s 23.3 Process [PID 1121] /usr/bin/gnome-shell + 1.2 ms/s 21.8 Process [PID 1657] /usr/lib/firefox/firefox -contentproc -childID 2 -isForBrowser -prefsLen 920 -prefMapSize 173895 -schedulerPrefs 000 + 13.3 ms/s 13.9 Process [PID 1746] /usr/lib/firefox/firefox -contentproc -childID 3 -isForBrowser -prefsLen 5814 -prefMapSize 173895 -schedulerPrefs 00 + 2.7 ms/s 11.1 Process [PID 3410] /usr/lib/gnome-terminal-server + 3.8 ms/s 10.8 Process [PID 1057] /usr/lib/Xorg vt2 -displayfd 3 -auth /run/user/1000/gdm/Xauthority -nolisten tcp -background none -noreset -keeptty + 3.1 ms/s 9.8 Process [PID 1629] /usr/lib/firefox/firefox -contentproc -childID 2 -isForBrowser -prefsLen 920 -prefMapSize 173895 -schedulerPrefs 000 + 0.9 ms/s 6.7 Interrupt [136] xhci_hcd + 278.0 us/s 6.4 Process [PID 414] [irq/141-iwlwifi] + 128.7 us/s 5.7 Process [PID 1] /sbin/init + 118.5 us/s 5.2 Process [PID 10] [rcu_preempt] + 49.0 us/s 4.7 Interrupt [0] HI_SOFTIRQ + 459.3 us/s 3.1 Interrupt [142] i915 + 2.1 ms/s 2.3 Process [PID 3451] powertop + 8.4 us/s 2.7 kWork intel_atomic_helper_free_state_ + 1.2 ms/s 1.8 kWork intel_atomic_commit_work + 374.2 us/s 2.1 Interrupt [9] acpi + 42.1 us/s 1.8 kWork intel_atomic_cleanup_work + 3.5 ms/s 0.25 kWork delayed_fput + 238.0 us/s 1.5 Process [PID 907] /usr/lib/upowerd + 17.7 us/s 1.5 Timer intel_uncore_fw_release_timer + 26.4 us/s 1.4 Process [PID 576] [i915/signal:0] + 19.8 us/s 1.3 Timer watchdog_timer_fn + 1.1 ms/s 0.00 Process [PID 206] [kworker/7:2] + 2.4 ms/s 0.00 Interrupt [1] timer(softirq) + 13.4 us/s 0.9 Process [PID 9] [ksoftirqd/0] + + Exit | / Navigate | +``` + +The powertop output looks similar to the above screenshot, it will be slightly different based on your hardware. This have many screen you can switch between screen the using `Tab` and `Shift+Tab` button. + +### Idle Stats Tab + +It displays various information about the processor. + +``` +PowerTOP v2.9 Overview Idle stats Frequency stats Device stats Tunables + + + Package | Core | CPU 0 CPU 4 + | | C0 active 6.7% 7.2% + | | POLL 0.0% 0.1 ms 0.0% 0.1 ms + | | C1E 1.2% 0.2 ms 1.6% 0.3 ms +C2 (pc2) 7.5% | | +C3 (pc3) 25.2% | C3 (cc3) 0.7% | C3 0.5% 0.2 ms 0.6% 0.1 ms +C6 (pc6) 0.0% | C6 (cc6) 7.1% | C6 6.6% 0.5 ms 6.3% 0.5 ms +C7 (pc7) 0.0% | C7 (cc7) 59.8% | C7s 0.0% 0.0 ms 0.0% 0.0 ms +C8 (pc8) 0.0% | | C8 33.9% 1.6 ms 32.3% 1.5 ms +C9 (pc9) 0.0% | | C9 2.1% 3.4 ms 0.7% 2.8 ms +C10 (pc10) 0.0% | | C10 39.5% 4.7 ms 41.4% 4.7 ms + + | Core | CPU 1 CPU 5 + | | C0 active 8.3% 7.2% + | | POLL 0.0% 0.0 ms 0.0% 0.1 ms + | | C1E 1.3% 0.2 ms 1.4% 0.3 ms + | | + | C3 (cc3) 0.5% | C3 0.5% 0.2 ms 0.4% 0.2 ms + | C6 (cc6) 6.0% | C6 5.3% 0.5 ms 4.7% 0.5 ms + | C7 (cc7) 59.3% | C7s 0.0% 0.8 ms 0.0% 1.0 ms + | | C8 27.2% 1.5 ms 23.8% 1.4 ms + | | C9 1.6% 3.0 ms 0.5% 3.0 ms + | | C10 44.5% 4.7 ms 52.2% 4.6 ms + + | Core | CPU 2 CPU 6 + | | C0 active 11.2% 8.4% + | | POLL 0.0% 0.0 ms 0.0% 0.0 ms + | | C1E 1.4% 0.4 ms 1.3% 0.3 ms + | | + | C3 (cc3) 0.3% | C3 0.2% 0.1 ms 0.4% 0.2 ms + | C6 (cc6) 4.0% | C6 3.7% 0.5 ms 4.3% 0.5 ms + | C7 (cc7) 54.2% | C7s 0.0% 0.0 ms 0.0% 1.0 ms + | | C8 20.0% 1.5 ms 20.7% 1.4 ms + | | C9 1.0% 3.4 ms 0.4% 3.8 ms + | | C10 48.8% 4.6 ms 52.3% 5.0 ms + + | Core | CPU 3 CPU 7 + | | C0 active 8.8% 8.1% + | | POLL 0.0% 0.1 ms 0.0% 0.0 ms + | | C1E 1.2% 0.2 ms 1.2% 0.2 ms + | | + | C3 (cc3) 0.6% | C3 0.6% 0.2 ms 0.4% 0.2 ms + | C6 (cc6) 7.0% | C6 7.5% 0.5 ms 4.4% 0.5 ms + | C7 (cc7) 56.8% | C7s 0.0% 0.0 ms 0.0% 0.9 ms + | | C8 29.4% 1.4 ms 23.8% 1.4 ms + | | C9 1.1% 2.7 ms 0.7% 3.9 ms + | | C10 41.0% 4.0 ms 50.0% 4.8 ms + + + Exit | / Navigate | +``` + +### Frequency Stats Tab + +It displays the frequency of CPU. + +``` +PowerTOP v2.9 Overview Idle stats Frequency stats Device stats Tunables + + + Package | Core | CPU 0 CPU 4 + | | Average 930 MHz 1101 MHz +Idle | Idle | Idle + + | Core | CPU 1 CPU 5 + | | Average 1063 MHz 979 MHz + | Idle | Idle + + | Core | CPU 2 CPU 6 + | | Average 976 MHz 942 MHz + | Idle | Idle + + | Core | CPU 3 CPU 7 + | | Average 924 MHz 957 MHz + | Idle | Idle + +``` + +### Device Stats Tab + +It displays power usage information against only devices. + +``` +PowerTOP v2.9 Overview Idle stats Frequency stats Device stats Tunables + + +The battery reports a discharge rate of 13.8 W +The power consumed was 280 J + + Usage Device name + 46.7% CPU misc + 46.7% DRAM + 46.7% CPU core + 19.0% Display backlight + 0.0% Audio codec hwC0D0: Realtek + 0.0% USB device: Lenovo EasyCamera (160709000341) + 100.0% PCI Device: Intel Corporation HD Graphics 530 + 100.0% Radio device: iwlwifi + 100.0% PCI Device: O2 Micro, Inc. SD/MMC Card Reader Controller + 100.0% PCI Device: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers + 100.0% USB device: Lenovo Wireless Optical Mouse N100 + 100.0% PCI Device: Intel Corporation Wireless 8260 + 100.0% PCI Device: Intel Corporation HM170/QM170 Chipset SATA Controller [AHCI Mode] + 100.0% Radio device: btusb + 100.0% PCI Device: Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #4 + 100.0% USB device: xHCI Host Controller + 100.0% PCI Device: Intel Corporation 100 Series/C230 Series Chipset Family USB 3.0 xHCI Controller + 100.0% PCI Device: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller + 100.0% PCI Device: Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #3 + 100.0% PCI Device: Samsung Electronics Co Ltd NVMe SSD Controller SM951/PM951 + 100.0% PCI Device: Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #2 + 100.0% PCI Device: Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #9 + 100.0% PCI Device: Intel Corporation 100 Series/C230 Series Chipset Family SMBus + 26.1 pkts/s Network interface: wlp8s0 (iwlwifi) + 0.0% USB device: usb-device-8087-0a2b + 0.0% runtime-reg-dummy + 0.0% Audio codec hwC0D2: Intel + 0.0 pkts/s Network interface: enp9s0 (r8168) + 0.0% PCI Device: Intel Corporation 100 Series/C230 Series Chipset Family Power Management Controller + 0.0% PCI Device: Intel Corporation HM170 Chipset LPC/eSPI Controller + 0.0% PCI Device: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor PCIe Controller (x16) + 0.0% PCI Device: Intel Corporation 100 Series/C230 Series Chipset Family MEI Controller #1 + 0.0% PCI Device: NVIDIA Corporation GM107M [GeForce GTX 960M] + 0.0% I2C Adapter (i2c-8): nvkm-0000:01:00.0-bus-0005 + 0.0% runtime-PNP0C14:00 + 0.0% PCI Device: Intel Corporation 100 Series/C230 Series Chipset Family HD Audio Controller + 0.0% runtime-PNP0C0C:00 + 0.0% USB device: xHCI Host Controller + 0.0% runtime-ACPI000C:00 + 0.0% runtime-regulatory.0 + 0.0% runtime-PNP0C14:01 + 0.0% runtime-vesa-framebuffer.0 + 0.0% runtime-coretemp.0 + 0.0% runtime-alarmtimer + + Exit | / Navigate | +``` + +### Tunables Stats Tab + +This tab is important area that provides suggestions to optimize your laptop battery. + +``` +PowerTOP v2.9 Overview Idle stats Frequency stats Device stats Tunables + + +>> Bad Enable SATA link power management for host2 + Bad Enable SATA link power management for host3 + Bad Enable SATA link power management for host0 + Bad Enable SATA link power management for host1 + Bad VM writeback timeout + Bad Autosuspend for USB device Lenovo Wireless Optical Mouse N100 [1-2] + Good Bluetooth device interface status + Good Enable Audio codec power management + Good NMI watchdog should be turned off + Good Runtime PM for I2C Adapter i2c-7 (nvkm-0000:01:00.0-bus-0002) + Good Autosuspend for unknown USB device 1-11 (8087:0a2b) + Good Runtime PM for I2C Adapter i2c-3 (i915 gmbus dpd) + Good Autosuspend for USB device Lenovo EasyCamera [160709000341] + Good Runtime PM for I2C Adapter i2c-1 (i915 gmbus dpc) + Good Runtime PM for I2C Adapter i2c-12 (nvkm-0000:01:00.0-bus-0009) + Good Autosuspend for USB device xHCI Host Controller [usb1] + Good Runtime PM for I2C Adapter i2c-13 (nvkm-0000:01:00.0-aux-000a) + Good Runtime PM for I2C Adapter i2c-2 (i915 gmbus dpb) + Good Runtime PM for I2C Adapter i2c-8 (nvkm-0000:01:00.0-bus-0005) + Good Runtime PM for I2C Adapter i2c-15 (nvkm-0000:01:00.0-aux-000c) + Good Runtime PM for I2C Adapter i2c-16 (nvkm-0000:01:00.0-aux-000d) + Good Runtime PM for I2C Adapter i2c-5 (nvkm-0000:01:00.0-bus-0000) + Good Runtime PM for I2C Adapter i2c-0 (SMBus I801 adapter at 6040) + Good Runtime PM for I2C Adapter i2c-11 (nvkm-0000:01:00.0-bus-0008) + Good Runtime PM for I2C Adapter i2c-14 (nvkm-0000:01:00.0-aux-000b) + Good Autosuspend for USB device xHCI Host Controller [usb2] + Good Runtime PM for I2C Adapter i2c-9 (nvkm-0000:01:00.0-bus-0006) + Good Runtime PM for I2C Adapter i2c-10 (nvkm-0000:01:00.0-bus-0007) + Good Runtime PM for I2C Adapter i2c-6 (nvkm-0000:01:00.0-bus-0001) + Good Runtime PM for PCI Device Intel Corporation 100 Series/C230 Series Chipset Family HD Audio Controller + Good Runtime PM for PCI Device Intel Corporation 100 Series/C230 Series Chipset Family USB 3.0 xHCI Controller + Good Runtime PM for PCI Device Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers + Good Runtime PM for PCI Device Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #9 + Good Runtime PM for PCI Device Intel Corporation HD Graphics 530 + Good Runtime PM for PCI Device Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller + Good Runtime PM for PCI Device Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #3 + Good Runtime PM for PCI Device O2 Micro, Inc. SD/MMC Card Reader Controller + Good Runtime PM for PCI Device Intel Corporation HM170 Chipset LPC/eSPI Controller + Good Runtime PM for PCI Device Intel Corporation 100 Series/C230 Series Chipset Family MEI Controller #1 + Good Runtime PM for PCI Device Samsung Electronics Co Ltd NVMe SSD Controller SM951/PM951 + Good Runtime PM for PCI Device Intel Corporation HM170/QM170 Chipset SATA Controller [AHCI Mode] + Good Runtime PM for PCI Device Intel Corporation 100 Series/C230 Series Chipset Family Power Management Controller + Good Runtime PM for PCI Device Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #2 + Good Runtime PM for PCI Device Intel Corporation Wireless 8260 + Good Runtime PM for PCI Device Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor PCIe Controller (x16) + Good Runtime PM for PCI Device Intel Corporation 100 Series/C230 Series Chipset Family PCI Express Root Port #4 + Good Runtime PM for PCI Device Intel Corporation 100 Series/C230 Series Chipset Family SMBus + Good Runtime PM for PCI Device NVIDIA Corporation GM107M [GeForce GTX 960M] + + Exit | Toggle tunable | Window refresh +``` + +### How To Generate PowerTop HTML Report + +Run the following command to generate the PowerTop HTML report. + +``` +$ sudo powertop --html=powertop.html +modprobe cpufreq_stats failedLoaded 100 prior measurements +Cannot load from file /var/cache/powertop/saved_parameters.powertop +File will be loaded after taking minimum number of measurement(s) with battery only +RAPL device for cpu 0 +RAPL Using PowerCap Sysfs : Domain Mask f +RAPL device for cpu 0 +RAPL Using PowerCap Sysfs : Domain Mask f +Devfreq not enabled +glob returned GLOB_ABORTED +Cannot load from file /var/cache/powertop/saved_parameters.powertop +File will be loaded after taking minimum number of measurement(s) with battery only +Preparing to take measurements +To show power estimates do 182 measurement(s) connected to battery only +Taking 1 measurement(s) for a duration of 20 second(s) each. +PowerTOP outputing using base filename powertop.html +``` + +Navigate to `file:///home/daygeek/powertop.html` file to access the generated PowerTOP HTML report. +![][9] + +### Auto-Tune mode + +This feature sets all tunable options from `BAD` to `GOOD` which increase the laptop battery life in Linux. + +``` +$ sudo powertop --auto-tune +modprobe cpufreq_stats failedLoaded 210 prior measurements +Cannot load from file /var/cache/powertop/saved_parameters.powertop +File will be loaded after taking minimum number of measurement(s) with battery only +RAPL device for cpu 0 +RAPL Using PowerCap Sysfs : Domain Mask f +RAPL device for cpu 0 +RAPL Using PowerCap Sysfs : Domain Mask f +Devfreq not enabled +glob returned GLOB_ABORTED +Cannot load from file /var/cache/powertop/saved_parameters.powertop +File will be loaded after taking minimum number of measurement(s) with battery only +To show power estimates do 72 measurement(s) connected to battery only +Leaving PowerTOP +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/powertop-monitors-laptop-battery-usage-linux/ + +作者:[Vinoth Kumar][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/vinoth/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/category/package-management/ +[2]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/ +[3]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[4]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[5]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ +[6]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ +[7]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ +[8]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[9]: https://www.2daygeek.com/wp-content/uploads/2015/07/powertop-html-output.jpg From ede5c1de34601550ad3f9c779fc2c0676d2462f6 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 24 Dec 2018 19:13:33 +0800 Subject: [PATCH 040/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Watch=20YouTube?= =?UTF-8?q?=20videos=20at=20the=20Linux=20terminal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ch YouTube videos at the Linux terminal.md | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 sources/tech/20181222 Watch YouTube videos at the Linux terminal.md diff --git a/sources/tech/20181222 Watch YouTube videos at the Linux terminal.md b/sources/tech/20181222 Watch YouTube videos at the Linux terminal.md new file mode 100644 index 0000000000..d2ba12dbeb --- /dev/null +++ b/sources/tech/20181222 Watch YouTube videos at the Linux terminal.md @@ -0,0 +1,80 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Watch YouTube videos at the Linux terminal) +[#]: via: (https://opensource.com/article/18/12/linux-toy-youtube-dl) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +Watch YouTube videos at the Linux terminal +====== +Thought video content was just for your GUI? Think again. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-youtube-dl.png?itok=HYR5vU2a) + +We're almost to the end of our 24-day-long Linux command-line toys advent calendar. Hopefully, you've been following along, but if not, start back at [the beginning][1] and work your way through. You'll find plenty of games, diversions, and oddities for your Linux terminal. + +And while you may have seen some toys from our calendar before, we hope there’s at least one new thing for everyone. + +Today we're going to double-down on yesterday's toy, [MPlayer][2], and add in one more, [**youtube-dl**][3]. + +As its name would imply, **youtube-dl** is a command-line utility for downloading YouTube videos, but it can capture video from a number of other sites as well, and it's a really quite full-featured application with [thorough documentation][4] to make video acquisition easy. A note: please don't use **youtube-dl** in any context that would violate the copyright laws in your jurisdiction. + +**youtube-dl** is licensed under a public domain dedication known as [the][5] [Unlicense][5] that's similar to Creative Common's [CC0][6]. There are some interesting [legal opinions][7] out there about where public domain dedication fits into the open source landscape, but it's generally considered compatible with existing open source licenses even by organizations who don't recommend its use. + +In its simplest form, we're going to use **youtube-dl** to grab a video for playback in our terminal. First, [install][8] it using a method appropriate for your distribution. For me, in Fedora, it was packaged in my repositories, so installation was as simple as: + +``` +$ sudo dnf install youtube-dl +``` + +Then, let's grab a video. YouTube allows you to search by license, so today, we're going to take a look at a fireplace [video][9] from [Gemmy's Videos][10] available under a Creative Commons attribution license. For YouTube videos, you can download with the file ID alone, like this, and we'll specify an output file name as well. I intentionally picked a short video, since long videos can get quite large! + +``` +$ youtube-dl pec8P5K4s8c -o fireplace.mp4 +``` + +If you didn't install [MPlayer][2] yesterday, go ahead and do that, and you may need to install **libcaca** for your system as well if you did not install it previously. If you just use MPlayer to launch the video from the command line as-is ( **$** **mplayer fireplace.webm** ), it will play, but in a window all of its own; not exactly what we were going for. + +First, I set my **libcaca** settings to force it to use **ncurses** **** as the display driver, keeping the output in my terminal, with: + +``` +$ export CACA_DRIVER=ncurses +``` + +Then, I zoomed way out in my terminal (the more "pixels", the better), and played the file with the following (forcing the use of **libcaca** and silencing text output from MPlayer): + +``` +$ mplayer -really-quiet -vo caca fireplace.mp4 +``` + +And, there you go! +![](https://opensource.com/sites/default/files/uploads/linux-toy-youtube-dl.gif) + +Do you have a favorite command-line toy that we should have included? It's a little late to submit a suggestion for this year, but we'd still love to feature some cool command-line toys in the new year. Let me know in the comments below, and I'll check it out. And let me know what you thought of today's amusement. + +Be sure to check out yesterday's toy, [Listen to the radio at the Linux terminal][2], and come back tomorrow for another! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-youtube-dl + +作者:[Jason Baker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jason-baker +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/18/12/linux-toy-boxes +[2]: https://opensource.com/article/18/12/linux-toy-mplayer +[3]: https://rg3.github.io/youtube-dl/ +[4]: https://github.com/rg3/youtube-dl/blob/master/README.md#readme +[5]: https://unlicense.org/ +[6]: https://creativecommons.org/share-your-work/public-domain/cc0/ +[7]: https://opensource.org/faq#public-domain +[8]: https://github.com/rg3/youtube-dl/blob/master/README.md#installation +[9]: https://www.youtube.com/watch?v=pec8P5K4s8c +[10]: https://www.youtube.com/channel/UCwwaepmpWZVDd605MIRC20A From 064d04c6b62c113c2970bd1ace0409e68ce6e60b Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 24 Dec 2018 19:15:07 +0800 Subject: [PATCH 041/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20A=20Tale=20of=20H?= =?UTF-8?q?TTP/2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/tech/20181222 A Tale of HTTP-2.md | 75 +++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 sources/tech/20181222 A Tale of HTTP-2.md diff --git a/sources/tech/20181222 A Tale of HTTP-2.md b/sources/tech/20181222 A Tale of HTTP-2.md new file mode 100644 index 0000000000..5484e67148 --- /dev/null +++ b/sources/tech/20181222 A Tale of HTTP-2.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A Tale of HTTP/2) +[#]: via: (https://veronneau.org/a-tale-of-http2.html) +[#]: author: (Louis-Philippe Véronneau https://veronneau.org/) + +A Tale of HTTP/2 +====== + +Around a month ago, someone mentioned the existence of [HTTP/2][1] in an IRC channel I lurk in. For some reason, I had never heard of it and some of the features of this new protocol (like mutiplexing requests without having to open multiple TCP connections) seemed cool. + +To be honest, I had just finished re-writing the Puppet code that manages our backup procedures and enabling HTTP/2 seemed like a productive way to procrastinate before moving on to an another large project. How hard could this be? + +Turns out it took me around 25 hours of work... Sit back and put on comfortable slippers, for this is a tale of HTTP/2! + +[![The Yule Log][2]][3] + +### Cursed Be the HTTP/1.1 + +When I first looked up how to enable HTTP/2 on Apache it seemed a pretty simple task. The documentation mentioned loading the `http2` module and making sure to prioritise the new protocol via a configuration file like this one: + +``` +Protocols h2 h2c http/1.1 + +H2Push on +H2PushPriority core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated after +H2PushPriority text/css before +H2PushPriority image/jpeg after 32 +H2PushPriority image/png after 32 +H2PushPriority application/javascript interleaved +``` + +This would of course have been too easy. Even if everything in Apache was set up properly, websites kept being served as HTTP/1.1. I was obviously doing something right though, since my websites were now sending a new HTTP header: `Upgrade: h2, h2c`. + +After wasting a good deal of time debugging TLS ciphers (HTTP/2 is [incompatible with TLS 1.1][4]), I finally found out the problem was that we weren't using the right multi-processing module for Apache. + +Turns out Apache won't let you serve HTTP/2 while using `mpm_prefork` (the default MPM), as it is not supported by `mod_http2`. Even though there are two other MPM you can use with Apache, only `mpm_prefork` supports `mod_php`. Suddenly, adding support for HTTP/2 meant switching all our webapps built in PHP to PHP-FPM... + +### Down the Rabbit Hole + +![A clip from Alice in Wonderlands][5] + +For the longest time, a close friend has been trying to convince me of the virtues of [PHP-FPM][6]. As great as it looked on paper, I never really did anything about it. It seemed so ... complicated. Regular ol' `mod_php` did the trick just fine and other things required my attention. + +This whole HTTP/2 thing turned out to be the perfect excuse for me to dive into it after all. Once I understood how FPM pools worked, it was actually pretty easy to set up. Since I had to rewrite the Puppet profiles we're using to deploy websites, also I took that opportunity to harden a bunch of things left and right. + +PHP-FPM let's you run websites under different Unix users for added separation. On top of that, I decided it was time for PHP code on our servers to be ran in read-only mode and had to tweak a bunch of things for our Wordpress, Nextcloud, KanBoard and Drupal instances to stop complaining about it. + +After too much time passed automating tasks in Puppet, I finally was able to turn off `mod_php` and `mpm_prefork` everywhere and to enable `mpm_event` and `mod_http2`. The speed bonus offered by PHP-FPM and HTTP/2 is nice, but more than anything I'm happy this whole ordeal forced me to harden the way our Apache servers deal with PHP. + +![Victory!][7] + +-------------------------------------------------------------------------------- + +via: https://veronneau.org/a-tale-of-http2.html + +作者:[Louis-Philippe Véronneau][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://veronneau.org/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/HTTP/2 +[2]: https://veronneau.org/media/blog/2018-12-22/yule_log.jpg (The Yule Log) +[3]: https://commons.wikimedia.org/wiki/File:The_Yule_Log.jpg +[4]: https://http2.github.io/http2-spec/#TLSUsage +[5]: https://veronneau.org/media/blog/2018-12-22/mod_php.gif (A clip from Alice in Wonderlands) +[6]: https://wiki.apache.org/httpd/PHP-FPM +[7]: https://veronneau.org/media/blog/2018-12-22/victory.png (Victory!) From 88f18f9a0c8618915ab90ec9db8ca5bcb2b7a521 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 24 Dec 2018 19:18:45 +0800 Subject: [PATCH 042/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20to=20detect?= =?UTF-8?q?=20automatically=20generated=20emails?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...o detect automatically generated emails.md | 144 ++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 sources/tech/20181222 How to detect automatically generated emails.md diff --git a/sources/tech/20181222 How to detect automatically generated emails.md b/sources/tech/20181222 How to detect automatically generated emails.md new file mode 100644 index 0000000000..23b509a77b --- /dev/null +++ b/sources/tech/20181222 How to detect automatically generated emails.md @@ -0,0 +1,144 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to detect automatically generated emails) +[#]: via: (https://arp242.net/weblog/autoreply.html) +[#]: author: (Martin Tournoij https://arp242.net/) + +How to detect automatically generated emails +====== + +### How to detect automatically generated emails + + +When you send out an auto-reply from an email system you want to take care to not send replies to automatically generated emails. At best, you will get a useless delivery failure. At words, you will get an infinite email loop and a world of chaos. + +Turns out that reliably detecting automatically generated emails is not always easy. Here are my observations based on writing a detector for this and scanning about 100,000 emails with it (extensive personal archive and company archive). + +### Auto-submitted header + +Defined in [RFC 3834][1]. + +This is the ‘official’ standard way to indicate your message is an auto-reply. You should **not** send a reply if `Auto-Submitted` is present and has a value other than `no`. + +### X-Auto-Response-Suppress header + +Defined [by Microsoft][2] + +This header is used by Microsoft Exchange, Outlook, and perhaps some other products. Many newsletters and such also set this. You should **not** send a reply if `X-Auto-Response-Suppress` contains `DR` (“Suppress delivery reports”), `AutoReply` (“Suppress auto-reply messages other than OOF notifications”), or `All`. + +### List-Id and List-Unsubscribe headers + +Defined in [RFC 2919][3] + +You usually don’t want to send auto-replies to mailing lists or news letters. Pretty much all mail lists and most newsletters set at least one of these headers. You should **not** send a reply if either of these headers is present. The value is unimportant. + +### Feedback-ID header + +Defined [by Google][4]. + +Gmail uses this header to identify mail newsletters, and uses it to generate statistics/reports for owners of those newsletters. You should **not** send a reply if this headers is present; the value is unimportant. + +### Non-standard ways + +The above methods are well-defined and clear (even though some are non-standard). Unfortunately some email systems do not use any of them :-( Here are some additional measures. + +#### Precedence header + +Not really defined anywhere, mentioned in [RFC 2076][5] where its use is discouraged (but this header is commonly encountered). + +Note that checking for the existence of this field is not recommended, as some ails use `normal` and some other (obscure) values (this is not very common though). + +My recommendation is to **not** send a reply if the value case-insensitively matches `bulk`, `auto_reply`, or `list`. + +#### Other obscure headers + +A collection of other (somewhat obscure) headers I’ve encountered. I would recommend **not** sending an auto-reply if one of these is set. Most mails also set one of the above headers, but some don’t (but it’s not very common). + + * `X-MSFBL`; can’t really find a definition (Microsoft header?), but I only have auto-generated mails with this header. + + * `X-Loop`; not really defined anywhere, and somewhat rare, but sometimes it’s set. It’s most often set to the address that should not get emails, but `X-Loop: yes` is also encountered. + + * `X-Autoreply`; fairly rare, and always seems to have a value of `yes`. + + + + +#### Email address + +Check if the `From` or `Reply-To` headers contains `noreply`, `no-reply`, or `no_reply` (regex: `^no.?reply@`). + +#### HTML only + +If an email only has a HTML part, but no text part it’s a good indication this is an auto-generated mail or newsletter. Pretty much all mail clients also set a text part. + +#### Delivery failures + +Many delivery failure messages don’t really indicate that they’re failures. Some ways to check this: + + * `From` contains `mailer-daemon` or `Mail Delivery Subsystem` + + + +Many mail libraries leave some sort of footprint, and most regular mail clients override this with their own data. Checking for this seems to work fairly well. + + * `X-Mailer: Microsoft CDO for Windows 2000` – Set by some MS software; I can only find it on autogenerated mails. Yes, it’s still used in 2015. + + * `Message-ID` header contains `.JavaMail.` – I’ve found a few (5 on 50k) regular messages with this, but not many; the vast majority (thousends) of messages are news-letters, order confirmations, etc. + + * `^X-Mailer` starts with `PHP`. This should catch both `X-Mailer: PHP/5.5.0` and `X-Mailer: PHPmailer blah blah`. The same as `JavaMail` applies. + + * `X-Library` presence; only [Indy][6] seems to set this. + + * `X-Mailer` starts with `wdcollect`. Set by some Plesk mails. + + * `X-Mailer` starts with `MIME-tools`. + + + + +### Final precaution: limit the number of replies + +Even when following all of the above advice, you may still encounter an email program that will slip through. This can very dangerous, as email systems that simply `IF email THEN send_email` have the potential to cause infinite email loops. + +For this reason, I recommend keeping track of which emails you’ve sent an autoreply to and rate limiting this to at most n emails in n minutes. This will break the back-and-forth chain. + +We use one email per five minutes, but something less strict will probably also work well. + +### What you need to set on your auto-response + +The specifics for this will vary depending on what sort of mails you’re sending. This is what we use for auto-reply mails: + +``` +Auto-Submitted: auto-replied +X-Auto-Response-Suppress: All +Precedence: auto_reply +``` + +### Feedback + +You can mail me at [martin@arp242.net][7] or [create a GitHub issue][8] for feedback, questions, etc. + +-------------------------------------------------------------------------------- + +via: https://arp242.net/weblog/autoreply.html + +作者:[Martin Tournoij][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://arp242.net/ +[b]: https://github.com/lujun9972 +[1]: http://tools.ietf.org/html/rfc3834 +[2]: https://msdn.microsoft.com/en-us/library/ee219609(v=EXCHG.80).aspx +[3]: https://tools.ietf.org/html/rfc2919) +[4]: https://support.google.com/mail/answer/6254652?hl=en +[5]: http://www.faqs.org/rfcs/rfc2076.html +[6]: http://www.indyproject.org/index.en.aspx +[7]: mailto:martin@arp242.net +[8]: https://github.com/Carpetsmoker/arp242.net/issues/new From a5904dada661270b96bb72413f35cac575a936a8 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 24 Dec 2018 19:24:25 +0800 Subject: [PATCH 043/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Top=2011=20best?= =?UTF-8?q?=20Image=20Viewer=20for=20Ubuntu=20and=20other=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Image Viewer for Ubuntu and other Linux.md | 344 ++++++++++++++++++ 1 file changed, 344 insertions(+) create mode 100644 sources/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md diff --git a/sources/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md b/sources/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md new file mode 100644 index 0000000000..5aea9702e7 --- /dev/null +++ b/sources/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md @@ -0,0 +1,344 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Top 11 best Image Viewer for Ubuntu and other Linux) +[#]: via: (https://itsfoss.com/image-viewers-linux/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Top 11 best Image Viewer for Ubuntu and other Linux +====== + +It is probably a good idea to stick with the default system image viewer unless you want a specific feature (that’s missing) or if you crave for better user experience. + +However, if you like to experiment, you may try out different image viewers. You could end up loving the new user experience of viewing the images or get hooked on to the extra features offered. + +In this article, we have mentioned every kind of image viewers ranging from the simplest to the most advanced tool available for Ubuntu or any other Linux distro. + +### Best Image Viewers for Linux + +![Best image viewers for Ubuntu and other Linux distributions][1] + +**Note:** You should be able to find these image viewers listed in your software center or AppCenter. If you don’t find it there, we’ve mentioned the instructions for manual installation as well. + +#### 1. Nomacs + +![nomacs image viewer][2] + +**What’s good about it?** + + * Simple & Fast UI + * Image adjustment tools (color & size) + * Geolocation of the image + * Metadata information panel + * LAN Synchronization + * Fullscreen mode + + + +A free and open source image viewer that does not come baked with any fancy features. However, Nomacs does support most of the common image file formats if you want to use it. + +The user interface is very simple but it does offer some essential features for image adjustment (color, brightness, resize, crop, & cut). In addition to that, it also supports fullscreen mode, histogram, and a lot of different panels that you can toggle for metadata, edit history, and more such information. + +**How do I install it?** + +You can find it listed in the software center/AppCenter for easy installation. If you want to install it via terminal, you can take a look at their [GitHub page][3] or type in the command below: + +``` +sudo apt install nomacs +``` + +#### 2. Eye Of Gnome +![eye of gnome][4] + +**What’s good about it?** + + * A dead simple image viewer + * Slideshow style (if that’s what you like) + * An image viewer tailored for GNOME desktop environment + + + +This is a classic image viewer developed as a part of The GNOME Project a lot of years ago. Do note that this isn’t actively maintained anymore. But, it still works on Ubuntu’s latest LTS release and several other Linux distros. + +If you want a dead simple image viewer where you browse through the images in a slideshow-type UI and get the meta info in the sidebar, Eye of GNOME should be your choice. One of the best for GNOME desktop environment! + +**How do I install it?** + +To manually install it on Ubuntu (or Ubuntu-based Linux distros) type in the following command: + +``` +sudo apt install eog +``` + +For other distros and source, you should follow the [GitHub page.][5] + +#### 3. Eye Of MATE Image Viewer + +![eye of mate image viewer][6] + +**What’s good about it?** + + * A simple image viewer + * Plugins supported + * An image viewer tailored for MATE desktop environment + + + +Yet another simple image viewer with the basic functionalities of slideshow view and rotating images. + +Even if doesn’t support any image manipulation feature, it does support numerous image file formats and can handle big image files. + +**How do I install it?** + +For Ubuntu/Ubuntu-based distros, type in the following command: + +``` +sudo apt install eom +``` + +If you need help for other distros and the source, follow their [GitHub page][7]. + +#### 4. Geeqie +![geeqie image viewer][8] + +**What’s good about it?** + + * A flexible image manager that supports plugins (you’ll find other image viewers supported as well) + * Information about the color profile + + + +Geeqie is an impressive image manager and viewer. It supports other image viewers as plugins but does not offer any image manipulation tools. + +If you need to know the color profile, image info, and manage/view a collection of images. It should be a good choice for that. + +**How do I install it?** + +Type in the terminal: + +``` +sudo apt install geeqie +``` + +For the source, you can refer the [GitHub page][9]. + +#### 5. gThumb Image Viewer + +![gthumb image viewer][10] + +**What’s good about it?** + + * An all-in-one image viewer with the ability to manage, edit and view the images + * Reset EXIF orientation + * Convert image formats + * Find duplicate images + + + +gThumb is an amazing image viewer with a lot of features. You get an impressive user interface to view/manage your images along with the basic image manipulation tools (crop, resize, color, and so on.) + +You can also add comments to an image or reset the EXIF orientation info. It also gives you the ability to find duplicate images and convert image formats. + +**How do I install it?** + +You can enter this command in the terminal: + +``` +sudo apt install gthumb +``` + +If that doesn’t work, head to the [GitHub page][11] for more info. + +#### 6. Gwenview +![gwenview image viewer][12] + +**What’s good about it?** + + * A basic image viewer with common image manipulation tools to rotate and resize + * Feature extension using KIPI plugins + + + +Gwenview is just another basic image viewer tailored for KDE desktop environment. However, you can install it on other desktop environments as well. + +If you utilize the Konqueror web browser, you can use it as an embedded image viewer. Here, you can add comments/description to the image as well. In addition, it supports [KIPI][13] plugins. + +**How do I install it?** + +Type the following in the terminal to install it: + +``` +sudo apt install gwenview +``` + +For the source, check out their [GitHub page][14]. + +#### 7. Mirage + +![mirage image viewer][15] + +**What’s good about it?** + + * Customizable interface even it is a basic UI + * Basic image manipulation tools + * Command-line access + + + +If you want a decent image viewer along with the ability to access it via command line, a fullscreen mode, slideshow mode, basic editing tools to resize/crop/rotate/flip, and a configurable interface – Mirage would be the simplest option. + +It is a very fast and capable image viewer that supports a lot of image formats that include png, jpg, svg, xpm, gif, bmp, and tifff. + +**How do I install it?** + +You need to type in the following: + +``` +sudo apt install mirage +``` + +For the source code and other installation instructions, refer the [GitHub page][16]. + +#### 8. KPhotoAlbum +![][17] + +**What’s good about it?** + + * Perfect image manager to tag and manage the pictures + * Demo databases + * Image compression + * Merge/Remove images to/from Stack + + + +KPhotoAlbum is not exactly a dedicated image viewer but a photo manager to tag and manage the pictures you’ve got. + +You can opt for slideshows to view the image along with the ability to compress images and search them using the labels/tags. + +**How do I install it?** + +You can install it via the terminal by typing in: + +``` +sudo apt kphotoalbum +``` + +In either case, you can check for the [official instructions on their website][18] to get it installed on your Linux distro. + +#### 9. Shotwell + +![shotwell][19] + +**What’s good about it?** + + * Red-eye correction tool + * Upload photos to Facebook, Flickr, etc. + * Supports RAW file formats as well + + + +Shotwell is a feature-rich photo manager. You can view and manage your photos. Although you do not get all the basic image manipulation tools baked in it – you can easily crop and enhance your photos in a single click (auto brightness/contrast adjustments). + +**How do I install it?** + +Go to the terminal and enter the following (Ubuntu/Ubuntu-based distros): + +sudo apt install shotwell + +For more information, check out their [GitHub page][20]. + +#### 10. Ristretto + +![ristretto][21] + +**What’s good about it?** + + * A dead simple image viewer + * Fullscreen mode & Slideshow + + + +A very straightforward image viewer where you just get the ability to zoom, view in fullscreen mode and view the images as a slideshow. + +It is tailored for Xfce desktop environment – but you can install it anywhere. + +**How do I install it?** + +Even though it’s built for Xfce desktop environment, you can install it on any Ubuntu/Ubuntu-based distro by typing the following command in the terminal: + +``` +sudo apt install ristretto +``` +#### 11. digiKam + +![digikam image viewer][22] + +**What’s good about it?** + + * An all-in-one image viewer with advanced photo management features (editing/managing/viewing) + * Batch Queue Manager + * [Light Table][23] + + + +digiKam is an advanced photo manager with some additional image manipulation tools. You get the ability to configure the database using SQLite or MySQL. + +To enhance your experience of viewing images, it lets you choose the reduced version of images while you preview them. So, that becomes super fast even if you have a lot of images. You get several import/export options via Google, Facebook, Imgur, and so on. If you want a feature-rich image viewer, this is the one you should have installed. + +**How do I install it?** + +Type in the following command: + +``` +sudo apt install digikam +``` + +For more information, visit their [GitHub page][24]. + +### Wrapping Up + +So, no matter whether you want a different user experience or a rich set of features and powerful tools to manage your photos – there’s something everyone. + +Which image viewer do you prefer to use? Is it the system’s default viewer? + +Let us know in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/image-viewers-linux/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/best-image-viewers-linux.png?resize=800%2C450&ssl=1 +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/nomacs-image-viewer.jpg?resize=800%2C455&ssl=1 +[3]: https://github.com/nomacs/nomacs +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/eye-of-gnome-image-viewer.jpg?resize=800%2C470&ssl=1 +[5]: https://github.com/GNOME/eog +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/eye-of-mate-image-viewer.jpg?resize=800%2C464&ssl=1 +[7]: https://github.com/mate-desktop/eom +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/geeqie-image-viewer.jpg?resize=800%2C444&ssl=1 +[9]: https://github.com/BestImageViewer/geeqie +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/gthumb-image-viewer.jpg?resize=800%2C515&ssl=1 +[11]: https://github.com/GNOME/gthumb +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/gwenview-image-viewer.jpg?resize=800%2C517&ssl=1 +[13]: https://en.wikipedia.org/wiki/KDE_Image_Plugin_Interface +[14]: https://github.com/KDE/gwenview +[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/mirage-image-viewer.jpg?resize=800%2C475&ssl=1 +[16]: https://github.com/xiongchiamiov/Mirage +[17]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/kphotoalbum-viewer.jpg?fit=800%2C522&ssl=1 +[18]: https://www.kphotoalbum.org/download/ +[19]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/shotwell-image-viewer.jpg?resize=800%2C473&ssl=1 +[20]: https://github.com/GNOME/shotwell +[21]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/ristretto-image-viewer.jpg?resize=800%2C437&ssl=1 +[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/digitkam-image-viewer.jpg?resize=800%2C550&ssl=1 +[23]: https://docs.kde.org/trunk5/en/extragear-graphics/digikam/using-lighttable.html +[24]: https://github.com/KDE/digikam From 4a8a185e089337c534547e94d6146f02cfa90697 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 24 Dec 2018 19:28:03 +0800 Subject: [PATCH 044/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Large=20files=20w?= =?UTF-8?q?ith=20Git:=20LFS=20and=20git-annex?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Large files with Git- LFS and git-annex.md | 145 ++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 sources/tech/20181221 Large files with Git- LFS and git-annex.md diff --git a/sources/tech/20181221 Large files with Git- LFS and git-annex.md b/sources/tech/20181221 Large files with Git- LFS and git-annex.md new file mode 100644 index 0000000000..29a76f810f --- /dev/null +++ b/sources/tech/20181221 Large files with Git- LFS and git-annex.md @@ -0,0 +1,145 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Large files with Git: LFS and git-annex) +[#]: via: (https://anarc.at/blog/2018-12-21-large-files-with-git/) +[#]: author: (Anarc.at https://anarc.at/) + +Large files with Git: LFS and git-annex +====== + +Git does not handle large files very well. While there is work underway to handle large repositories through the [commit graph work][2], Git's internal design has remained surprisingly constant throughout its history, which means that storing large files into Git comes with a significant and, ultimately, prohibitive performance cost. Thankfully, other projects are helping Git address this challenge. This article compares how Git LFS and git-annex address this problem and should help readers pick the right solution for their needs. + +### The problem with large files + +As readers probably know, Linus Torvalds wrote Git to manage the history of the kernel source code, which is a large collection of small files. Every file is a "blob" in Git's object store, addressed by its cryptographic hash. A new version of that file will store a new blob in Git's history, with no deduplication between the two versions. The pack file format can store binary deltas between similar objects, but if many objects of similar size change in a repository, that algorithm might fail to properly deduplicate. In practice, large binary files (say JPEG images) have an irritating tendency of changing completely when even the smallest change is made, which makes delta compression useless. + +There have been different attempts at fixing this in the past. In 2006, Torvalds worked on [improving the pack-file format][3] to reduce object duplication between the index and the pack files. Those changes were eventually reverted because, as Nicolas Pitre [put it][4]: "that extra loose object format doesn't appear to be worth it anymore". + +Then in 2009, [Caca Labs][5] worked on improving the `fast-import` and `pack-objects` Git commands to do special handling for big files, in an effort called [git-bigfiles][6]. Some of those changes eventually made it into Git: for example, since [1.7.6][7], Git will stream large files directly to a pack file instead of holding them all in memory. But files are still kept forever in the history. + +An example of trouble I had to deal with is for the Debian security tracker, which follows all security issues in the entire Debian history in a single file. That file is around 360,000 lines for a whopping 18MB. The resulting repository takes 1.6GB of disk space and a local clone takes 21 minutes to perform, mostly taken up by Git resolving deltas. Commit, push, and pull are noticeably slower than a regular repository, taking anywhere from a few seconds to a minute depending one how old the local copy is. And running annotate on that large file can take up to ten minutes. So even though that is a simple text file, it's grown large enough to cause significant problems for Git, which is otherwise known for stellar performance. + +Intuitively, the problem is that Git needs to copy files into its object store to track them. Third-party projects therefore typically solve the large-files problem by taking files out of Git. In 2009, Git evangelist Scott Chacon released [GitMedia][8], which is a Git filter that simply takes large files out of Git. Unfortunately, there hasn't been an official release since then and it's [unclear][9] if the project is still maintained. The next effort to come up was [git-fat][10], first released in 2012 and still maintained. But neither tool has seen massive adoption yet. If I would have to venture a guess, it might be because both require manual configuration. Both also require a custom server (rsync for git-fat; S3, SCP, Atmos, or WebDAV for GitMedia) which limits collaboration since users need access to another service. + +### Git LFS + +That was before GitHub [released][11] Git Large File Storage (LFS) in August 2015. Like all software taking files out of Git, LFS tracks file hashes instead of file contents. So instead of adding large files into Git directly, LFS adds a pointer file to the Git repository, which looks like this: + +``` +version https://git-lfs.github.com/spec/v1 +oid sha256:4d7a214614ab2935c943f9e0ff69d22eadbb8f32b1258daaa5e2ca24d17e2393 +size 12345 +``` + +LFS then uses Git's smudge and clean filters to show the real file on checkout. Git only stores that small text file and does so efficiently. The downside, of course, is that large files are not version controlled: only the latest version of a file is kept in the repository. + +Git LFS can be used in any repository by installing the right hooks with `git lfs install` then asking LFS to track any given file with `git lfs track`. This will add the file to the `.gitattributes` file which will make Git run the proper LFS filters. It's also possible to add patterns to the `.gitattributes` file, of course. For example, this will make sure Git LFS will track MP3 and ZIP files: + +``` +$ cat .gitattributes +*.mp3 filter=lfs -text +*.zip filter=lfs -text +``` + +After this configuration, we use Git normally: `git add`, `git commit`, and so on will talk to Git LFS transparently. + +The actual files tracked by LFS are copied to a path like `.git/lfs/objects/{OID-PATH}`, where `{OID-PATH}` is a sharded file path of the form `OID[0:2]/OID[2:4]/OID` and where `OID` is the content's hash (currently SHA-256) of the file. This brings the extra feature that multiple copies of the same file in the same repository are automatically deduplicated, although in practice this rarely occurs. + +Git LFS will copy large files to that internal storage on `git add`. When a file is modified in the repository, Git notices, the new version is copied to the internal storage, and the pointer file is updated. The old version is left dangling until the repository is pruned. + +This process only works for new files you are importing into Git, however. If a Git repository already has large files in its history, LFS can fortunately "fix" repositories by retroactively rewriting history with [git lfs migrate][12]. This has all the normal downsides of rewriting history, however --- existing clones will have to be reset to benefit from the cleanup. + +LFS also supports [file locking][13], which allows users to claim a lock on a file, making it read-only everywhere except in the locking repository. This allows users to signal others that they are working on an LFS file. Those locks are purely advisory, however, as users can remove other user's locks by using the `--force` flag. LFS can also [prune][14] old or unreferenced files. + +The main [limitation][15] of LFS is that it's bound to a single upstream: large files are usually stored in the same location as the central Git repository. If it is hosted on GitHub, this means a default quota of 1GB storage and bandwidth, but you can purchase additional "packs" to expand both of those quotas. GitHub also limits the size of individual files to 2GB. This [upset][16] some users surprised by the bandwidth fees, which were previously hidden in GitHub's cost structure. + +While the actual server-side implementation used by GitHub is closed source, there is a [test server][17] provided as an example implementation. Other Git hosting platforms have also [implemented][18] support for the LFS [API][19], including GitLab, Gitea, and BitBucket; that level of adoption is something that git-fat and GitMedia never achieved. LFS does support hosting large files on a server other than the central one --- a project could run its own LFS server, for example --- but this will involve a different set of credentials, bringing back the difficult user onboarding that affected git-fat and GitMedia. + +Another limitation is that LFS only supports pushing and pulling files over HTTP(S) --- no SSH transfers. LFS uses some [tricks][20] to bypass HTTP basic authentication, fortunately. This also might change in the future as there are proposals to add [SSH support][21], resumable uploads through the [tus.io protocol][22], and other [custom transfer protocols][23]. + +Finally, LFS can be slow. Every file added to LFS takes up double the space on the local filesystem as it is copied to the `.git/lfs/objects` storage. The smudge/clean interface is also slow: it works as a pipe, but buffers the file contents in memory each time, which can be prohibitive with files larger than available memory. + +### git-annex + +The other main player in large file support for Git is git-annex. We [covered the project][24] back in 2010, shortly after its first release, but it's certainly worth discussing what has changed in the eight years since Joey Hess launched the project. + +Like Git LFS, git-annex takes large files out of Git's history. The way it handles this is by storing a symbolic link to the file in `.git/annex`. We should probably credit Hess for this innovation, since the Git LFS storage layout is obviously inspired by git-annex. The original design of git-annex introduced all sorts of problems however, especially on filesystems lacking symbolic-link support. So Hess has implemented different solutions to this problem. Originally, when git-annex detected such a "crippled" filesystem, it switched to [direct mode][25], which kept files directly in the work tree, while internally committing the symbolic links into the Git repository. This design turned out to be a little confusing to users, including myself; I have managed to shoot myself in the foot more than once using this system. + +Since then, git-annex has adopted a different v7 mode that is also based on smudge/clean filters, which it called "[unlocked files][26]". Like Git LFS, unlocked files will double disk space usage by default. However it is possible to reduce disk space usage by using "thin mode" which uses hard links between the internal git-annex disk storage and the work tree. The downside is, of course, that changes are immediately performed on files, which means previous file versions are automatically discarded. This can lead to data loss if users are not careful. + +Furthermore, git-annex in v7 mode suffers from some of the performance problems affecting Git LFS, because both use the smudge/clean filters. Hess actually has [ideas][27] on how the smudge/clean interface could be improved. He proposes changing Git so that it stops buffering entire files into memory, allows filters to access the work tree directly, and adds the hooks he found missing (for `stash`, `reset`, and `cherry-pick`). Git-annex already implements some tricks to work around those problems itself but it would be better for those to be implemented in Git natively. + +Being more distributed by design, git-annex does not have the same "locking" semantics as LFS. Locking a file in git-annex means protecting it from changes, so files need to actually be in the "unlocked" state to be editable, which might be counter-intuitive to new users. In general, git-annex has some of those unusual quirks and interfaces that often come with more powerful software. + +And git-annex is much more powerful: it not only addresses the "large-files problem" but goes much further. For example, it supports "partial checkouts" --- downloading only some of the large files. I find that especially useful to manage my video, music, and photo collections, as those are too large to fit on my mobile devices. Git-annex also has support for location tracking, where it knows how many copies of a file exist and where, which is useful for archival purposes. And while Git LFS is only starting to look at transfer protocols other than HTTP, git-annex already supports a [large number][28] through a [special remote protocol][29] that is fairly easy to implement. + +"Large files" is therefore only scratching the surface of what git-annex can do: I have used it to build an [archival system for remote native communities in northern Québec][30], while others have built a [similar system in Brazil][31]. It's also used by the scientific community in projects like [GIN][32] and [DataLad][33], which manage terabytes of data. Another example is the [Japanese American Legacy Project][34] which manages "upwards of 100 terabytes of collections, transporting them from small cultural heritage sites on USB drives". + +Unfortunately, git-annex is not well supported by hosting providers. GitLab [used to support it][35], but since it implemented Git LFS, it [dropped support for git-annex][36], saying it was a "burden to support". Fortunately, thanks to git-annex's flexibility, it may eventually be possible to treat [LFS servers as just another remote][37] which would make git-annex capable of storing files on those servers again. + +### Conclusion + +Git LFS and git-annex are both mature and well maintained programs that deal efficiently with large files in Git. LFS is easier to use and is well supported by major Git hosting providers, but it's less flexible than git-annex. + +Git-annex, in comparison, allows you to store your content anywhere and espouses Git's distributed nature more faithfully. It also uses all sorts of tricks to save disk space and improve performance, so it should generally be faster than Git LFS. Learning git-annex, however, feels like learning Git: you always feel you are not quite there and you can always learn more. It's a double-edged sword and can feel empowering for some users and terrifyingly hard for others. Where you stand on the "power-user" scale, along with project-specific requirements will ultimately determine which solution is the right one for you. + +Ironically, after thorough evaluation of large-file solutions for the Debian security tracker, I ended up proposing to rewrite history and [split the file by year][38] which improved all performance markers by at least an order of magnitude. As it turns out, keeping history is critical for the security team so any solution that moves large files outside of the Git repository is not acceptable to them. Therefore, before adding large files into Git, you might want to think about organizing your content correctly first. But if large files are unavoidable, the Git LFS and git-annex projects allow users to keep using most of their current workflow. + +> This article [first appeared][39] in the [Linux Weekly News][40]. + +-------------------------------------------------------------------------------- + +via: https://anarc.at/blog/2018-12-21-large-files-with-git/ + +作者:[Anarc.at][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://anarc.at/ +[b]: https://github.com/lujun9972 +[1]: https://anarc.at/blog/ +[2]: https://github.com/git/git/blob/master/Documentation/technical/commit-graph.txt +[3]: https://public-inbox.org/git/Pine.LNX.4.64.0607111010320.5623@g5.osdl.org/ +[4]: https://public-inbox.org/git/alpine.LFD.0.99.0705091422130.24220@xanadu.home/ +[5]: http://caca.zoy.org/ +[6]: http://caca.zoy.org/wiki/git-bigfiles +[7]: https://public-inbox.org/git/7v8vsnz2nc.fsf@alter.siamese.dyndns.org/ +[8]: https://github.com/alebedev/git-media +[9]: https://github.com/alebedev/git-media/issues/15 +[10]: https://github.com/jedbrown/git-fat +[11]: https://blog.github.com/2015-04-08-announcing-git-large-file-storage-lfs/ +[12]: https://github.com/git-lfs/git-lfs/blob/master/docs/man/git-lfs-migrate.1.ronn +[13]: https://github.com/git-lfs/git-lfs/wiki/File-Locking +[14]: https://github.com/git-lfs/git-lfs/blob/master/docs/man/git-lfs-prune.1.ronn +[15]: https://github.com/git-lfs/git-lfs/wiki/Limitations +[16]: https://medium.com/@megastep/github-s-large-file-storage-is-no-panacea-for-open-source-quite-the-opposite-12c0e16a9a91 +[17]: https://github.com/git-lfs/lfs-test-server +[18]: https://github.com/git-lfs/git-lfs/wiki/Implementations%0A +[19]: https://github.com/git-lfs/git-lfs/tree/master/docs/api +[20]: https://github.com/git-lfs/git-lfs/blob/master/docs/api/authentication.md +[21]: https://github.com/git-lfs/git-lfs/blob/master/docs/proposals/ssh_adapter.md +[22]: https://tus.io/ +[23]: https://github.com/git-lfs/git-lfs/blob/master/docs/custom-transfers.md +[24]: https://lwn.net/Articles/419241/ +[25]: http://git-annex.branchable.com/direct_mode/ +[26]: https://git-annex.branchable.com/tips/unlocked_files/ +[27]: http://git-annex.branchable.com/todo/git_smudge_clean_interface_suboptiomal/ +[28]: http://git-annex.branchable.com/special_remotes/ +[29]: http://git-annex.branchable.com/special_remotes/external/ +[30]: http://isuma-media-players.readthedocs.org/en/latest/index.html +[31]: https://github.com/RedeMocambos/baobaxia +[32]: https://web.gin.g-node.org/ +[33]: https://www.datalad.org/ +[34]: http://www.densho.org/ +[35]: https://docs.gitlab.com/ee/workflow/git_annex.html +[36]: https://gitlab.com/gitlab-org/gitlab-ee/issues/1648 +[37]: https://git-annex.branchable.com/todo/LFS_API_support/ +[38]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=908678#52 +[39]: https://lwn.net/Articles/774125/ +[40]: http://lwn.net/ From 3051b5772bb5aef0b5a6cb4bcce8db27adc7d725 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 24 Dec 2018 19:29:18 +0800 Subject: [PATCH 045/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Listen=20to=20the?= =?UTF-8?q?=20radio=20at=20the=20Linux=20terminal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...sten to the radio at the Linux terminal.md | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 sources/tech/20181221 Listen to the radio at the Linux terminal.md diff --git a/sources/tech/20181221 Listen to the radio at the Linux terminal.md b/sources/tech/20181221 Listen to the radio at the Linux terminal.md new file mode 100644 index 0000000000..268ba37568 --- /dev/null +++ b/sources/tech/20181221 Listen to the radio at the Linux terminal.md @@ -0,0 +1,60 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Listen to the radio at the Linux terminal) +[#]: via: (https://opensource.com/article/18/12/linux-toy-mplayer) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +Listen to the radio at the Linux terminal +====== +MPlayer is an extremely versatile open source media player that can be surprisingly useful at the Linux command line. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-mplayer.png?itok=6iTm3Xi7) + +You've found your way to our 24-day-long Linux command-line toys advent calendar. If this is your first visit to the series, you might be asking yourself what a command-line toy even is. It could be a game or any simple diversion that helps you have fun at the terminal. + +Some of you will have seen various selections from our calendar before, but we hope there’s at least one new thing for everyone. + +There are many ways to listen to music at the command line; if you've got media stored locally, **cmus** is a great option, but there are [plenty of others][1] as well. + +Lots of times when I'm at the terminal, though, I'd really rather just zone out and not pay close attention to picking each song, and let someone else do the work. While I've got plenty of playlists that work for just such a purpose, after a while, even though go stale, and I'll switch over to an internet radio station. + +Today's toy, MPlayer, is a versatile multimedia player that will support just about any media format you throw at it. If MPlayer is not already installed, you can probably find it packaged for your distribution. On Fedora, I found it in [RPM Fusion][2] (be aware that this is not an "official" repository for Fedora, so exercise caution): + +``` +$ sudo dnf install mplayer +``` + +MPlayer has a slew of command-line options to set depending on your situation. I wanted to listen to the local college radio station here in Raleigh ([88.1 WKNC,][3] they're pretty good!), and so after grabbing the streaming URL from their website, all that took to get my radio up and running, no GUI or web player needed, was: + +``` +$ mplayer -nocache -afm ffmpeg http://wknc.sma.ncsu.edu:8000/wknchd1.mp3 +``` + +MPlayer is open source under the GPLv3, and you can find out more about the project and download source code from the project's [website][4]. + +As I mentioned in yesterday's article, I'm trying to use a screenshot of each toy as the lead image for each article, but as we moved into the world of audio, I had to fudge it a little. So today's image was created from a public domain icon of a radio tower using **img2txt** , which is provided by the **libcaca** package. + +Do you have a favorite command-line toy that you we should have included? Our calendar is basically set for the remainder of the series, but we'd still love to feature some cool command-line toys in the new year. Let me know in the comments below, and I'll check it out. And let me know what you thought of today's amusement. + +Be sure to check out yesterday's toy, [Let you Linux terminal speak its mind][5], and come back tomorrow for another! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-mplayer + +作者:[Jason Baker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jason-baker +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/life/16/8/3-command-line-music-players-linux +[2]: https://rpmfusion.org/ +[3]: https://wknc.org/index.php +[4]: http://www.mplayerhq.hu/ +[5]: https://opensource.com/article/18/12/linux-toy-espeak From 0d058dbd84f57bb0cae635a3861a1557e97f9341 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 24 Dec 2018 19:34:17 +0800 Subject: [PATCH 046/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20An=20Easy=20Way?= =?UTF-8?q?=20To=20Remove=20Programs=20Installed=20From=20Source=20In=20Li?= =?UTF-8?q?nux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Programs Installed From Source In Linux.md | 200 ++++++++++++++++++ 1 file changed, 200 insertions(+) create mode 100644 sources/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md diff --git a/sources/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md b/sources/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md new file mode 100644 index 0000000000..7e3378b4e3 --- /dev/null +++ b/sources/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md @@ -0,0 +1,200 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (An Easy Way To Remove Programs Installed From Source In Linux) +[#]: via: (https://www.ostechnix.com/an-easy-way-to-remove-programs-installed-from-source-in-linux/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +An Easy Way To Remove Programs Installed From Source In Linux +====== + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/stow-1-720x340.jpg) + +Not all programs available in the official or third-party repositories, so you can’t install them using the regular package managers. Some times, you have to install the programs by manually compiling from source. As you may already know, when you install programs from source, the package files will be copied to multiple locations, such as **/usr/local/bin** , **/usr/local/etc/** , on the filesystem. If the installed program from source doesn’t have a built-in uninstaller, it is going to be a tedious task to remove the packages when you don’t need it anymore. You may need to spend couple (or several) minutes to find those package files and remove them manually. This is what I have been doing up until I stumbled upon a utility named **“GNU Stow”**. Thankfully, Stow has a fantastic way to easily manage programs installed from source. + +To quote the official website, + +> **GNU Stow is a symlink farm manager which takes distinct packages of software and/or data located in separate directories on the filesystem, and makes them appear to be installed in the same place.** + +To put this simply, Stow helps you to keep the package files organized in a way to easily manageable. In this method, the files will not be copied to multiple locations. Instead, all files are saved in a specific folder, usually under the program name itself, and Stow creates symbolic links to all the programs’ files into the appropriate places. For example, **/usr/local/bin** could contain symlinks to files within **/usr/local/stow/vim/bin** , **/usr/local/stow/python/bin** etc., and likewise recursively for any other subdirectories such as **…/share** , **…/man** , and so on. In this tutorial, I will show you how to easily manage programs installed from source using Stow with a practical example. Read on. + +### Installing GNU Stow + +GNU Stow is available in the default repositories of popular Linux operating systems. + +On **Arch Linux** and its variants, run the following command to install Stow. + +``` +$ sudo pacman -S stow +``` + +On **Debian** , **Ubuntu** , **Linux Mint** : + +``` +$ sudo apt install stow +``` + +On **Fedora** : + +``` +$ sudo dnf install stow +``` + +On **RHEL/CentOS** : + +``` +$ sudo yum install epel-release + +$ sudo yum install stow +``` + +### Easily Remove Programs Installed From Source In Linux + +As I already mentioned earlier, all program files of a package will be saved in a root folder located in **/usr/local/stow/**. Under this root or parent directory, each package will be saved in its own private sub-directory. For example, if we install Vim editor from source, all program files and directories related to Vim will be saved under **/usr/local/stow/vim** folder. If you install python from source, all files related to python will be kept under **/usr/local/stow/python** and so on. + +Let me install a program, for example **hello** , from source. + +First download the ‘hello’ program’s tarball. + +``` +$ wget http://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz +``` + +Extract the downloaded tarball using command: + +``` +$ tar -zxvf hello-2.10.tar.gz +``` + +The above command will create a directory named ‘hello-2.10’ in the current working directory and extract all contents in it. + +Switch to the extracted directory: + +``` +$ cd hello-2.10/ +``` + +Run the following command with –prefix option. + +``` +$ ./configure --prefix=/usr/local/stow/hello +``` + +The above command will save the build files in the specified location i.e **/usr/local/stow/hello** in our case. + +Finally, build and install the hello program using the following commands: + +``` +$ make + +$ sudo make install +``` + +That’s it. The hello program has been installed in **/usr/local/stow/hello/** location. You can verify it with ‘ls’ command as shown below. + +``` +$ ls /usr/local/stow/hello/ +bin share +``` + +Finally, go to the **/usr/local/stow/** directory and run the following command to generate the necessary symlinks. + +``` +$ cd /usr/local/stow/ + +$ sudo stow hello +``` + +All done! + +What just happened is all the files and directories contained in the hello package have been symlinked to the directory **/usr/local/**. In other words, **/usr/local/stow/hello/bin** has been symlinked to **/usr/local/bin** and **/usr/local/stow/hello/share** has been symlinked to **/usr/local/share** and **/usr/local/stow/hello/share/man** has been symlinked to **/usr/local/share/man** and so on. + +You can verify them using ‘ls’ command: + +``` +$ ls /usr/local/bin/ +hello +``` + +Let us check if the hello program is working or not using command: + +``` +$ hello +Hello, world! +``` + +Yeah, it is working!! + +Similarly, you can install programs as described above under its own sub-directory. + +Here is the contents of the Stow root directory: + +``` +$ tree /usr/local/stow/ +``` + +![][2] + +See? The hello program is installed /usr/local/stow/hello/ location. Like wise, all packages will be kept under their own directory. + +Here comes the main part. Let us remove the hello program. To do so, go to **/usr/local/stow/** directory: + +``` +$ cd /usr/local/stow/ +``` + +..and run the following command: + +``` +$ sudo stow --delete hello +``` + +The hello program has just been removed. You can verify if it is really removed using command: + +``` +$ hello +-bash: /usr/local/bin/hello: No such file or directory +``` + +![][3] + +See? Hello program is removed! + +Please note that Stow has removed the symlinks only. All program files and directories related to hello program are still available in **/usr/local/stow/hello** folder. So, you can install the hello program again without having to download the actual source file. If you don’t want it anymore, simply delete the folder. + +``` +$ sudo rm -fr /usr/local/stow/hello/ +``` + +To know more details about Stow, refer the man pages. + +``` +$ man stow +``` + + +Stow helps you to uninstall the programs as easily as you install them. If you are wondering how to effectively manage a lot of programs installed from source, GNU Stow is one such program to make this task a lot easier. Give it a try, you won’t be disappointed. + +And, that’s all for now. Hope this was useful. More good stuffs to come. Stay tuned! + +Cheers! + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/an-easy-way-to-remove-programs-installed-from-source-in-linux/ + +作者:[SK][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: http://www.ostechnix.com/wp-content/uploads/2018/12/tree-command.png +[3]: http://www.ostechnix.com/wp-content/uploads/2018/12/hello-world.png From 662d780561106a788e782e5a47b07e1469a0c9e4 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 24 Dec 2018 19:40:13 +0800 Subject: [PATCH 047/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Top=206=20open=20?= =?UTF-8?q?source=20desktop=20email=20clients?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Top 6 open source desktop email clients.md | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 sources/tech/20180119 Top 6 open source desktop email clients.md diff --git a/sources/tech/20180119 Top 6 open source desktop email clients.md b/sources/tech/20180119 Top 6 open source desktop email clients.md new file mode 100644 index 0000000000..7493714453 --- /dev/null +++ b/sources/tech/20180119 Top 6 open source desktop email clients.md @@ -0,0 +1,115 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Top 6 open source desktop email clients) +[#]: via: (https://opensource.com/business/18/1/desktop-email-clients) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +Top 6 open source desktop email clients +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/life_mail.png?itok=XTkwePLK) + +This article was originally published on October 8, 2015, and has been updated to reflect new information and project changes. + +Mobile and web technologies still haven't made the desktop obsolete, and despite some regular claims to the contrary, desktop clients don't seem to be going away anytime soon. + +And with good reason. For many, the preference for a native application (and corresponding native performance), easy offline use, a vast array of plugins, and meeting security needs will long outweigh pressures to switch to a webmail email client. Whether you're sticking with a desktop email client because of a corporate mandate or just personal preference, there are still many great options to choose from. And just because you may be stuck on Windows doesn't mean Outlook is your only option; many open source clients are cross-platform. + +In this roundup, we take a quick look at six open source options for desktop email, share a little bit about each, and provide you with some options you may want to try yourself. + +### Thunderbird + +For many years, Mozilla [Thunderbird][1] was the king of the open source email clients. It was available on all major platforms, and it had great success alongside Mozilla's now-flagship project, Firefox. Thunderbird has been around for over a decade and was immediately popular from the start, receiving over a million downloads in its first 10 days of public release. + +In recent years, the thunder behind Thunderbird got a little quieter, and in mid-2017 the project announced it would move off Mozilla's infrastructure, but keep the Mozilla Foundation as its legal and fiscal home. Several [new hires][2] were made to advance the project, with plans to bring in new developers to fix lingering issues and transform the codebase to be based on web technologies. + +Thunderbird is full-featured, with a number of well-supported plugins adding everything from calendar support to advanced address book integration, and many specialized features including theming and large file management. Out of the box, it supports POP and IMAP email syncing, spam filtering, and many other features you would expect, and it works flawlessly across Windows, macOS, and Linux. + +Thunderbird is made available under the [Mozilla Public License][3]. + +![Thunderbird][4] + +### Claws Mail + +[Claws Mail][5], a fork of [Sylpheed][6], is a fast and flexible alternative that might be appealing to anyone concerned about performance and minimal resource usage. It's a good option, for example, if you're working within the limited processing and memory capacity of a [Raspberry Pi][7], for example. + +But even for those with virtually unlimited computing resources to throw at a mail client, Claws Mail might be a good option. It's flexible, probably more so than Thunderbird or some of the other options in this list, and it has a number of plugins available for those who want to extend it. And it prides itself on being fast and reliable, too, in addition to sporting a simple interface that's perhaps ideal for new users. + +Claws Mail is based on the GTK+ framework and made available under the [GPL][8]. + +![](https://opensource.com/sites/default/files/images/business-uploads/desktop-email-claws.png) + +### Evolution + +If you're a user of the popular Fedora or Debian distributions, you're probably already familiar with the next option on our list, [Evolution][9]. Evolution is an official part of the GNOME project, but it didn't start out that way. Originally developed at Ximian, and later Novell, Evolution was designed from the ground up to be an enterprise-ready email application. + +To this end, Evolution supports Exchange Server and a number of other email setups you might find in a corporate environment. It's also a full personal information manager (PIM), sporting a calendar, task list, contact manager, and note taking application, in addition to handling your email. Even if it's not the default mail application in your distribution, you might want to take a look if you're interested in these features or the included spam filtering, GNU Privacy Guard (GPG) support, integration with LibreOffice, or a slew of other features. + +Evolution is made available as open source under the [LGPL][10]. + +![](https://opensource.com/sites/default/files/images/business-uploads/desktop-email-evolution.png) + +### Geary + +[Geary][11] is a project originally developed by Yorba Foundation, which made a number of different GNOME software tools. Geary supports a number of popular webmail services as the mail backend through IMAP. + +Geary doesn't have a lot of features compared to some other clients on this list, but its simple interface might be appealing to users frustrated with unnecessary complexity in other email programs. Geary is available under the [LGPL][10]. + +![](https://opensource.com/sites/default/files/images/business-uploads/desktop-email-geary.png) + +### KMail + +[KMail][12] is the mail component of [Kontact][13], the personal information manager included with KDE. KMail supports a variety of email protocols, including IMAP, SMTP, and POP3, and through its integration with the other Kontact components, it could be considered a complete groupware suite. Despite its Linux routes, a Windows build is also available. + +With its long history, KMail has developed most of the features you would expect to find in a modern mail program. While it fits nicely into the KDE group of applications, some may find its interface clunky compared to others. But give it a try and see what you think. + +KMail is made available under the [GPL][14]. + +![](https://opensource.com/sites/default/files/images/business-uploads/desktop-email-kmail.png) + +### Mailspring + +[Mailspring][15], the new kid on the block, is a relaunch of the now-defunct Nylas Mail by one of the original authors. It replaces Nylas' JavaScript sync engine with a C++ core, which is said to minimize the application's RAM and power demands, and removes heavy dependencies to add speed. Its features include a unified inbox, support for IMAP (but not ActiveSync), Gmail-style search, themes, and message translation. + +Mailspring is available for macOS, Windows, and Linux, and it's licensed under [GPLv3][16]. + +![Mailspring][17] + +Of course, there are many more options above and beyond these, including the full-featured PIM [Zimbra Desktop][18] or one of the [lightweight alternatives][19] like [GNUMail][20] that might be the best choice for your situation. What's your favorite open source desktop email client? And with webmail as the first choice of many users, what do you see as the role of the desktop email client in the years to come? Let us know in the comments below. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/business/18/1/desktop-email-clients + +作者:[Jason Baker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jason-baker +[b]: https://github.com/lujun9972 +[1]: https://www.mozilla.org/en-US/thunderbird/ +[2]: https://blog.mozilla.org/thunderbird/2017/12/new-thunderbird-releases-and-new-thunderbird-staff/ +[3]: https://www.mozilla.org/en-US/MPL/ +[4]: https://opensource.com/sites/default/files/u128651/desktop-email-thunderbird57.png (Thunderbird) +[5]: http://www.claws-mail.org/ +[6]: http://sylpheed.sraoss.jp/en/ +[7]: https://opensource.com/resources/what-raspberry-pi +[8]: http://www.claws-mail.org/COPYING +[9]: https://wiki.gnome.org/Apps/Evolution +[10]: http://www.gnu.org/licenses/lgpl-3.0.en.html +[11]: https://wiki.gnome.org/Apps/Geary +[12]: https://userbase.kde.org/KMail +[13]: https://userbase.kde.org/Kontact +[14]: http://www.gnu.org/licenses/gpl-3.0.en.html +[15]: https://getmailspring.com/ +[16]: https://github.com/Foundry376/Mailspring/blob/master/LICENSE.md +[17]: https://opensource.com/sites/default/files/u128651/desktop-email-mailspring.png (Mailspring) +[18]: https://www.zimbra.com/open-source-email-overview/ +[19]: https://opensource.com/article/17/7/email-alternatives-thunderbird +[20]: http://wiki.gnustep.org/index.php/GNUMail From cbbad162bd7b49b10533e1138ca58c3c69065f82 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 24 Dec 2018 19:44:28 +0800 Subject: [PATCH 048/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Fragmentation=20i?= =?UTF-8?q?s=20Why=20Linux=20Hasn=E2=80=99t=20Succeeded=20on=20Desktop:=20?= =?UTF-8?q?Linus=20Torvalds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...t Succeeded on Desktop- Linus Torvalds.md" | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 "sources/talk/\\20181219 Fragmentation is Why Linux Hasn-t Succeeded on Desktop- Linus Torvalds.md" diff --git "a/sources/talk/\\20181219 Fragmentation is Why Linux Hasn-t Succeeded on Desktop- Linus Torvalds.md" "b/sources/talk/\\20181219 Fragmentation is Why Linux Hasn-t Succeeded on Desktop- Linus Torvalds.md" new file mode 100644 index 0000000000..e2d519439a --- /dev/null +++ "b/sources/talk/\\20181219 Fragmentation is Why Linux Hasn-t Succeeded on Desktop- Linus Torvalds.md" @@ -0,0 +1,65 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fragmentation is Why Linux Hasn’t Succeeded on Desktop: Linus Torvalds) +[#]: via: (https://itsfoss.com/desktop-linux-torvalds/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Fragmentation is Why Linux Hasn’t Succeeded on Desktop: Linus Torvalds +====== + +**Brief: Linus Torvalds has finally spoken his mind over why Linux that rules the servers and the clouds has not succeeded on the desktop front.** + +![Linus Torvalds voices his opinion on why desktop Linux didn't succeed][1] + +Too many cooks spoil the broth. + +Too many choices overwhelm the consumer/customer/user. + +Too many desktop choices held Linux back from succeeding as a desktop operating system? Linux creator Linus Torvalds certainly thinks so. + +In an interview with [TFiR][2], Torvalds expressed his views on the ‘failure’ of desktop Linux. + +> I still wish we were better at having a standardize desktop that goes across all the distributions… It’s not a kernel issue. It’s more of a personal annoyance how the fragmentation of the different vendors have, I think, held the desktop back a bit. + +You can watch the entire interview on [TFiR’s YouTube channel][3]. It’s a short video where Torvalds has expressed his views on desktop Linux and Chromebooks. + + + +### Chromebooks and Android are the future of desktop Linux! + +When I met Jim Zemlin, executive director of the Linux Foundation, at Open Source Summit in 2017, I asked him why Linux Foundation doesn’t work on creating an affordable Linux laptop for masses. Jim answered that Chromebooks are essentially Linux desktop and they are doing exactly that so there is no need of going after a new entry-level Linux laptop. + +Interestingly, Torvalds also puts his weight behind Chromebooks (and Android). + +> It seems to be that Chromebooks and Android are the paths towards the desktop. + +In case you didn’t know, [Chromebooks will soon be able to run native Debian apps][4]. Using Chromebook will give a slightly better ‘Linux feel’. For now, Chromebooks and Chrome OS are nowhere close to the traditional desktop feel despite the fact they run on top of the Linux kernel. + +### What do you think? + +I, along with many other Linux users, have felt the same reason behind the not-so-successful state of the desktop Linux. There are too many choices available when it comes to desktop Linux and this is overwhelming to the new users to the extent that they just avoid using it. + +Do I feel vindicated that Torvalds thinks the same? Kind of. + +What do you think? Do you agree with the opinion that the fragmentation held back desktop Linux? Or do you think that the multitude of choices symbolize the freedom Linux provides to the users? Share your view with us. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/desktop-linux-torvalds/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/torvalds-why-desktop-linux-failed.jpeg?resize=800%2C450&ssl=1 +[2]: https://www.tfir.io/ +[3]: https://www.youtube.com/watch?v=VHFdoFKDuQA +[4]: https://itsfoss.com/linux-apps-chromebook/ From 3ff4c04288d14c9e67c63a300eb8670e70681339 Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Mon, 24 Dec 2018 22:24:37 +0800 Subject: [PATCH 049/322] Translated by qhwdw --- ...GP - Part 7- Protecting Online Accounts.md | 147 ------------------ ...GP - Part 7- Protecting Online Accounts.md | 145 +++++++++++++++++ 2 files changed, 145 insertions(+), 147 deletions(-) delete mode 100644 sources/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md create mode 100644 translated/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md diff --git a/sources/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md b/sources/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md deleted file mode 100644 index 1c5cf7ff09..0000000000 --- a/sources/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md +++ /dev/null @@ -1,147 +0,0 @@ -Translating by qhwdw -Protecting Code Integrity with PGP — Part 7: Protecting Online Accounts -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/online-pgp.jpg?itok=BWc_Bk6q) -So far in this tutorial series, we've provided practical guidelines for using PGP, including basic concepts and steps for generating and protecting your keys. If you missed the previous articles, you can catch up below. In this final article, we offer additional guidance for protecting your online accounts, which is of paramount importance today. - -[Part 1: Basic Concepts and Tools][1] - -[Part 2: Generating Your Master Key][2] - -[Part 3: Generating PGP Subkeys][3] - -[Part 4: Moving Your Master Key to Offline Storage][4] - -[Part 5: Moving Subkeys to a Hardware Device][5] - -[Part 6: Using PGP with Git][6] - -### Checklist - - * Get a U2F-capable device (ESSENTIAL) - - * Enable 2-factor authentication for your online accounts (ESSENTIAL) - - * GitHub/GitLab - - * Google - - * Social media - - * Use U2F as primary mechanism, with TOTP as fallback (ESSENTIAL) - - - - -#### Considerations - -You may have noticed how a lot of your online developer identity is tied to your email address. If someone can gain access to your mailbox, they would be able to do a lot of damage to you personally, and to your reputation as a free software developer. Protecting your email accounts is just as important as protecting your PGP keys. - -##### Two-factor authentication with Fido U2F - -[Two-factor authentication][7] is a mechanism to improve account security by requiring a physical token in addition to a username and password. The goal is to make sure that even if someone steals your password (via keylogging, shoulder surfing, or other means), they still wouldn't be able to gain access to your account without having in their possession a specific physical device ("something you have" factor). - -The most widely known mechanisms for 2-factor authentication are: - - * SMS-based verification - - * Time-based One-Time Passwords (TOTP) via a smartphone app, such as the "Google Authenticator" or similar solutions - - * Hardware tokens supporting Fido U2F - - - - -SMS-based verification is easiest to configure, but has the following important downsides: it is useless in areas without signal (e.g. most building basements), and can be defeated if the attacker is able to intercept or divert SMS messages, for example by cloning your SIM card. - -TOTP-based multi-factor authentication offers more protection than SMS, but has important scaling downsides (there are only so many tokens you can add to your smartphone app before finding the correct one becomes unwieldy). Plus, there's no avoiding the fact that your secret key ends up stored on the smartphone itself -- which is a complex, globally connected device that may or may not have been receiving timely security patches from the manufacturer. - -Most importantly, neither TOTP nor SMS methods protect you from phishing attacks -- if the phisher is able to steal both your account password and the 2-factor token, they can replay them on the legitimate site and gain access to your account. - -[Fido U2F][8] is a standard developed specifically to provide a mechanism for 2-factor authentication and to combat credential phishing. The U2F protocol will store each site's unique key on the USB token and will prevent you from accidentally giving the attacker both your password and your one-time token if you try to use it on anything other than the legitimate website. - -Both Chrome and Firefox support U2F 2-factor authentication, and hopefully other browsers will soon follow. - -##### Get a token capable of Fido U2F - -There are [many options available][9] for hardware tokens with Fido U2F support, but if you're already ordering a smartcard-capable physical device, then your best option is a Yubikey 4, which supports both. - -##### Enable 2-factor authentication on your online accounts - -You definitely want to enable this option on the email provider you are using (especially if it is Google, which has excellent support for U2F). Other sites where this functionality should be enabled are: - - * GitHub: it probably occurred to you when you uploaded your PGP public key that if anyone else is able to gain access to your account, they can replace your key with their own. If you publish code on GitHub, you should take care of your account security by protecting it with U2F-backed authentication. - - * GitLab: for the same reasons as above. - - * Google: if you have a google account, you will be surprised how many sites allow logging in with Google authentication instead of site-specific credentials. - - * Facebook: same as above, a lot of online sites offer the option to authenticate using a Facebook account. You should 2-factor protect your Facebook account even if you do not use it. - - * Other sites, as you deem necessary. See [dongleauth.info][10] for inspiration. - - - - -##### Configure TOTP failover, if possible - -Many sites will allow you to configure multiple 2-factor mechanisms, and the recommended setup is: - - * U2F token as the primary mechanism - - * TOTP phone app as the secondary mechanism - - - - -This way, even if you lose your U2F token, you should be able to re-gain access to your account. Alternatively, you can enroll multiple U2F tokens (e.g. you can get another cheap token that only does U2F and use it for backup reasons). - -### Further reading - -By this point you have accomplished the following important tasks: - - 1. Created your developer identity and protected it using PGP cryptography. - - 2. Configured your environment so your identity is not easily stolen by moving your master key offline and your subkeys to an external hardware device. - - 3. Configured your git environment to ensure that anyone using your project is able to verify the integrity of the repository and its entire history. - - 4. Secured your online accounts using 2-factor authentication. - - - - -You are already in a good place, but you should also read up on the following topics: - - * How to secure your team communication (see the document in this repository). Decisions regarding your project development and governance require just as much careful protection as any committed code, if not so. Make sure that your team communication is trusted and the integrity of all decisions is verified. - - * How to secure your workstation (see the document in this repository). Your goal is to minimize risky behaviour that would cause your project code to be contaminated, or your developer identity to be stolen. - - * How to write secure code (see various documentation related to the programming languages and libraries used by your project). Bad, insecure code is still bad, insecure code even if there is a PGP signature on the commit that introduced it. - - - - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-7-protecting-online-accounts - -作者:[Konstantin Ryabitsev][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) -选题:[lujun9972](https://github.com/lujun9972) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.linux.com/users/mricon -[1]:https://www.linux.com/blog/learn/2018/2/protecting-code-integrity-pgp-part-1-basic-pgp-concepts-and-tools -[2]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-2-generating-and-protecting-your-master-pgp-key -[3]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-3-generating-pgp-subkeys -[4]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-4-moving-your-master-key-offline-storage -[5]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-5-moving-subkeys-hardware-device -[6]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-6-using-pgp-git -[7]:https://en.wikipedia.org/wiki/Multi-factor_authentication -[8]:https://en.wikipedia.org/wiki/Universal_2nd_Factor -[9]:http://www.dongleauth.info/dongles/ -[10]:http://www.dongleauth.info/ diff --git a/translated/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md b/translated/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md new file mode 100644 index 0000000000..4cf1f321c1 --- /dev/null +++ b/translated/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md @@ -0,0 +1,145 @@ +保护代码完整性(七):保护在线帐户 +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/online-pgp.jpg?itok=BWc_Bk6q) +到目前为止,本系列教程已经提供了 PGP 的实用指南,包括基本概念和工具、生成和保护你的密钥的步骤。如果你错过了前面的文章,可以通过下面的链接查看。在本系列的最后一篇文章中,我们将为你保护在线帐户提供一个额外的指南,保护在线帐户是当今非常重要的一件事情。 + +[第一部分:基本概念和工具][1] + +[第二部分:生成你的主密钥][2] + +[第三部分:生成 PGP 子密钥][3] + +[第四部分:将主密钥移到离线存储中][4] + +[第五部分:将子密钥移到硬件设备中][5] + +[第六部分:在 Git 中使用 PGP][6] + +### 清单 + + * 取得一个具备 U2F 功能的设备(必要) + + * 为你的在线帐户启用双因子认证(必要) + + * GitHub/GitLab + + * Google + + * 社交媒体 + + * 使用 U2F 作为主验证机制,使用 TOTP 作为备选(必要) + + + + +#### 考虑事项 + +你可能注意到,很多在线开发者身份是捆绑了你的 email 地址。如果有人能够访问你的邮箱,他们就能够去做一些对你会产生危害的事情,进而会损害你作为自由软件开发者的声誉。应该像保护你的 PGP 密钥那样保护你的 email 地址。 + +##### 使用 Fido U2F 的双因子认证 + +[双因子认证][7] 是一种提升帐户安全性的机制,它除了要求用户名和密码之外,还要求一个物理令牌。它的目标是即便在有人窃取了你的密码(通过按键记录器、肩窥攻击、或其它方式)的情况下,仍然能确保你的帐户安全,他们在没有得到你的一个专用的物理设备(“必备”的那个因子)的情况下,始终不能获取你的帐户。 + +广为人知的双因子认证机制有: + + * 基于 SMS 的验证 + + * 借助智能手机应用的基于时间的一次性令牌(TOTP),比如 "Google Authenticator" 或类似解决方案 + + * 支持 Fido U2F 的硬件令牌 + + + + +基于 SMS 的验证很容易配置,但是它有如下的缺点:它在没有手机信号的地方无法使用(比如,建筑物的地下室),并且如果攻击者能够阻断或转向 SMS 信息,这种方式可能就会失败,比如通过克隆你的 SIM 卡。 + +基于 TOTP 的多因子认证提供了比 SMS 更好的安全保护,但它也有一些重要的缺点(在你能够找到一个合适的令牌之前,你只能在智能手机中添加那么多令牌)。此外,还不能避免一个事实,那就是你的密钥最终还是保存在你的智能手机中 —— 它是一个复杂的、全球连接的设备,它有可能还没有及时从制造商那儿收到安全补丁。 + +更重要的是,不论是使用 TOTP 还是 SMS 的方法保护你免受诱骗攻击 —— 如果诱骗攻击者能够窃取你的帐户密码和双因子令牌,他们就可以在合法的站点上使用它们,访问你的帐户。 + +[Fido U2F][8] 是一个按标准开发的专用设备,它能够提供双因子认证机制来对付诱骗攻击。U2F 协议在 USB 令牌中保存每个站点的的唯一密钥,如果你在任何合法站点以外的地方尝试使用它,它将阻止你,以防范偶然让攻击者获得你的密码和一次性令牌。 + +Chrome 和 Firefox 都支持 U2F 双因子认证,希望其它浏览器也能够提供对 U2F 的支持。 + +##### 获得一个支持 Fido U2F 功能的令牌 + +支持 U2F 的硬件令牌的 [可选目标很多][9],但如果你已经订购了一个支持智能卡的物理设备,那么你最好的选择就是 Yubikey 4,它两者都支持。 + +##### 启用你的在线帐户的双因子认证 + +你要确定你想去启用的选项,你的 email 提供商已经使用了(特别是 Google,它对 U2F 的支持非常好)。其它的站点这个功能应该是启用了: + + * GitHub:当你上传你的 PGP 公钥时,你应该要想到,如果其他人能够获得访问你的帐户,他们可以用他们自己的 PGP 公钥替换掉你的 PGP 公钥。如果在 GitHub 上发布代码,你应该使用 U2F 认证来保护你的帐户安全。 + + * GitLab:理由同上 + + * Google:如果你有 google 帐户,你就惊奇地发现,许多帐户都允许以 Google 帐户来代替站点专用的认证来登入它们。 + + * Facebook:理由同上,许多在线站点都提供一个选择让你以 Facebook 的帐户来认证。即便你不使用 Facebook 也应该使用双因子认证来保护你的 Facebook 帐户。 + + * 你认为必要的其它站点。查看 [dongleauth.info][10] 去找找灵感。 + + + + +##### 如有可能,配置 TOTP 作为备选 + +许多站点都允许你配置多个双因子认证机制,推荐的设置是: + + * U2F 令牌作为主认证机制 + + * TOTP 手机 app 作为辅助认证机制 + + + + +通过这种方式,即便你丢失了你的 U2F 令牌,你仍然能够重新获取对你的帐户的访问。或者,你可以注册多个 U2F 令牌(即:你可以用一个便宜的令牌仅用它做 U2F,并且将它用作备份)。 + +### 延伸阅读 + +到目前为止,你已经完成了下列的重要任务: + + 1. 创建你的开发者身份并使用 PGP 加密来保护它。 + + 2. 通过将你的主密钥移到一个离线存储中并将子密钥移到一个外置硬件设备中的方式来配置你的环境,让窃取你的身份变得极为困难。 + + 3. 配置你的 Git 环境去确保任何使用你项目的人都能够验证仓库的完整性和它的整个历史。 + + 4. 使用双因子认证强化你的在线帐户。 + + + + +在安全保护方面,你已经做的很好了,但是你还应该去阅读以下的主题: + + * 如何去强化你的团队沟通(在这个仓库中查看相关文档)。你的项目开发和治理决策的要求应该和保护提交代码那样去保护,如果不这样做,应该确保你的团队沟通是可信任的,并且所有决策的完整性是可验证的。 + + * 如何去强化你的工作站的安全(在这个仓库中查看相关文档)。你的目标是最小化可能导致项目代码被污染的危险或你的开发者身份被窃的行为。 + + * 如何写出安全的代码(查看相关编程语言和你项目所使用的库的各种文档)。即便引入它的提交代码上有一个 PGP 签名,糟糕的、不安全的代码仍然是糟糕的、不安全的代码! + + + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-7-protecting-online-accounts + +作者:[Konstantin Ryabitsev][a] +译者:[qhwdw](https://github.com/qhwdw) +校对:[校对者ID](https://github.com/校对者ID) +选题:[lujun9972](https://github.com/lujun9972) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.linux.com/users/mricon +[1]:https://www.linux.com/blog/learn/2018/2/protecting-code-integrity-pgp-part-1-basic-pgp-concepts-and-tools +[2]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-2-generating-and-protecting-your-master-pgp-key +[3]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-3-generating-pgp-subkeys +[4]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-4-moving-your-master-key-offline-storage +[5]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-5-moving-subkeys-hardware-device +[6]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-6-using-pgp-git +[7]:https://en.wikipedia.org/wiki/Multi-factor_authentication +[8]:https://en.wikipedia.org/wiki/Universal_2nd_Factor +[9]:http://www.dongleauth.info/dongles/ +[10]:http://www.dongleauth.info/ From 3357a9baa663287c5414b4ee36aa147489ecb5e0 Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Mon, 24 Dec 2018 22:36:18 +0800 Subject: [PATCH 050/322] Translating by qhwdw --- sources/tech/20181221 How to Build a Netboot Server, Part 3.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181221 How to Build a Netboot Server, Part 3.md b/sources/tech/20181221 How to Build a Netboot Server, Part 3.md index 7c4501b58b..08c1a8a12e 100644 --- a/sources/tech/20181221 How to Build a Netboot Server, Part 3.md +++ b/sources/tech/20181221 How to Build a Netboot Server, Part 3.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (qhwdw) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f252552cf222439d5c004a7e1e36a4cf24263f2c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 24 Dec 2018 23:49:40 +0800 Subject: [PATCH 051/322] PRF:20181123 How to Build a Netboot Server, Part 1.md @qhwdw --- ...3 How to Build a Netboot Server, Part 1.md | 169 +++++++++--------- 1 file changed, 84 insertions(+), 85 deletions(-) diff --git a/translated/tech/20181123 How to Build a Netboot Server, Part 1.md b/translated/tech/20181123 How to Build a Netboot Server, Part 1.md index f2711ac3d1..1888f4ab2b 100644 --- a/translated/tech/20181123 How to Build a Netboot Server, Part 1.md +++ b/translated/tech/20181123 How to Build a Netboot Server, Part 1.md @@ -1,47 +1,51 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) -[#]: reviewer: -[#]: publisher: +[#]: reviewer: (wxy) +[#]: publisher: ( ) [#]: subject: (How to Build a Netboot Server, Part 1) - [#]: via: (https://fedoramagazine.org/how-to-build-a-netboot-server-part-1/) [#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/) +[#]: url: ( ) -[#]: url: - -如何构建一台网络引导服务器(第一部分) -====== +如何构建一台网络引导服务器(一) +====== ![](https://fedoramagazine.org/wp-content/uploads/2018/11/build-netboot-816x345.jpg) -有些计算机网络需要在各个物理机器上维护相同的软件和配置。学校的计算机实验室就是这样的一个环境。一台 [网络引导][1] 服务器能够被配置为基于网络去提供一个完整的操作系统,以便于客户端计算机从一个中央位置获取配置。本教程将向你展示构建一台网络引导服务器的一种方法。 +有些计算机网络需要在各个物理机器上维护相同的软件和配置。学校的计算机实验室就是这样的一个环境。 [网络引导][1] 服务器能够被配置为基于网络去提供一个完整的操作系统,以便于客户端计算机从一个中央位置获取配置。本教程将向你展示构建一台网络引导服务器的一种方法。 -本教程的第一部分将包括创建一台网络引导服务器和镜像。第二部分将展示如何去添加 Kerberos 验证的 home 目录到网络引导配置中。 +本教程的第一部分将包括创建一台网络引导服务器和镜像。第二部分将展示如何去添加 Kerberos 验证的家目录到网络引导配置中。 ### 初始化配置 -首先去下载 Fedora 服务器的 [netinst][2] 镜像,将它刻录到一张光盘上,然后它将引导服务器去重新格式化。我们只需要一个典型的 Fedora Server 的“最小化安装”来作为我们的开端,安装完成后,我们可以使用命令行去添加我们需要的任何额外的包。 +首先去下载 Fedora 服务器的 [netinst][2] 镜像,将它刻录到一张光盘上,然后用它引导服务器来重新格式化。我们只需要一个典型的 Fedora Server 的“最小化安装”来作为我们的开端,安装完成后,我们可以使用命令行去添加我们需要的任何额外的包。 ![][3] > 注意:本教程中我们将使用 Fedora 28。其它版本在“最小化安装”中包含的包可能略有不同。如果你使用的是不同的 Fedora 版本,如果一个预期的文件或命令不可用,你可能需要做一些调试。 -最小化安装的 Fedora Server 运行起来之后,以 root 用户登入并设置主机名字: +最小化安装的 Fedora Server 运行起来之后,以 root 用户登入: -```javascript +``` +$ sudo -i +``` + +并设置主机名字: + +``` $ MY_HOSTNAME=server-01.example.edu $ hostnamectl set-hostname $MY_HOSTNAME ``` > 注意:Red Hat 建议静态和临时名字应都要与这个机器在 DNS 中的完全合格域名相匹配,比如 host.example.com([了解主机名字][4])。 > -> 注意:本指南为了你“复制粘贴”友好。需要自定义的任何值都声明为一个 MY_* 变量,在你运行剩余命令之前,你可能需要调整它。如果你注销之后,变量的赋值将被清除。 +> 注意:本指南为了方便“复制粘贴”。需要自定义的任何值都声明为一个 `MY_*` 变量,在你运行剩余命令之前,你可能需要调整它。如果你注销之后,变量的赋值将被清除。 > -> 注意:Fedora 28 Server 在默认情况下往往会转储大量的日志到控制台上。你可以通过运行命令:sysctl -w kernel.printk=0 去禁用控制台日志输出。 +> 注意:Fedora 28 Server 在默认情况下往往会转储大量的日志到控制台上。你可以通过运行命令:`sysctl -w kernel.printk=0` 去禁用控制台日志输出。 接下来,我们需要在我们的服务器上配置一个静态网络地址。运行下面的一系列命令将找到并重新配置你的默认网络连接: -```javascript +``` $ MY_DNS1=192.0.2.91 $ MY_DNS2=192.0.2.92 $ MY_IP=192.0.2.158 @@ -66,7 +70,7 @@ nmcli con up br0-slave0 END ``` -> 注意:上面最后的一组命令被封装到一个 “nohup” 脚本中,因为它将临时禁用网络。这个 nohup 命令将允许 nmcli 命令去完成运行,直到你的 SSH 连接断开。注意,连接恢复可能需要 10 秒左右的时间,如果你改变了服务器 IP 地址,你将需要重新启动一个新的 SSH 连接。 +> 注意:上面最后的一组命令被封装到一个 `nohup` 脚本中,因为它将临时禁用网络。这个 `nohup` 命令可以让 `nmcli` 命令运行完成,即使你的 SSH 连接断开。注意,连接恢复可能需要 10 秒左右的时间,如果你改变了服务器 IP 地址,你将需要重新启动一个新的 SSH 连接。 > > 注意:上面的网络配置在默认的连接之上创建了一个 [网桥][5],这样我们在后面的测试中就可以直接运行一个虚拟机实例。如果你不想在这台服务器上去直接测试网络引导镜像,你可以跳过创建网桥的命令,并直接在你的默认网络连接上配置静态 IP 地址。 @@ -80,26 +84,26 @@ $ dnf install -y nfs-utils 为发布 NFS 去创建一个顶级的 [伪文件系统][6],然后在你的网络上共享它: -```javascript +``` $ MY_SUBNET=192.0.2.0 $ mkdir /export $ echo "/export -fsid=0,ro,sec=sys,root_squash $MY_SUBNET/$MY_PREFIX" > /etc/exports ``` -SELinux 将干扰网络引导服务器的运行。在本教程中我们将不涉及为它配置例外的部分,因此我们直接禁用它: +SELinux 会干扰网络引导服务器的运行。为它配置例外规则超出了本教程中,因此我们这里直接禁用它: -```javascript +``` $ sed -i '/GRUB_CMDLINE_LINUX/s/"$/ audit=0 selinux=0"/' /etc/default/grub $ grub2-mkconfig -o /boot/grub2/grub.cfg $ sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/sysconfig/selinux $ setenforce 0 ``` -> 注意:编辑 grub 命令行应该是不需要的,但在测试过程中发现,简单地编辑 /etc/sysconfig/selinux 被证明重启后是无效的,因此再次确保设置了 “selinux=0” 标志。 +> 注意:应该不需要编辑 grub 命令行,但我们在测试过程中发现,直接编辑 `/etc/sysconfig/selinux` 被证明重启后是无效的,因此这样做再次确保设置了 `selinux=0` 标志。 -现在,在本地防火墙中为 NFS 服务添加一个例外,然后启动 NFS 服务: +现在,在本地防火墙中为 NFS 服务添加一个例外规则,然后启动 NFS 服务: -```javascript +``` $ firewall-cmd --add-service nfs $ firewall-cmd --runtime-to-permanent $ systemctl enable nfs-server.service @@ -116,76 +120,70 @@ $ systemctl start nfs-server.service $ mkdir /fc28 ``` -使用 “dnf” 命令在新目录下用几个基础包去构建镜像: +使用 `dnf` 命令在新目录下用几个基础包去构建镜像: -```javascript +``` $ dnf -y --releasever=28 --installroot=/fc28 install fedora-release systemd passwd rootfiles sudo dracut dracut-network nfs-utils vim-minimal dnf ``` -在上面的命令中省略了很重要的 “kernel” 包。在它们被安装完成之前,我们需要去调整一下 “initramfs” 镜像中包含的驱动程序集,“kernel” 首次安装时将自动构建这个镜像。尤其是,我们需要禁用 “hostonly” 模式,以便于 initramfs 镜像能够在各种硬件平台上正常工作,并且我们还需要添加对网络和 NFS 的支持: +在上面的命令中省略了很重要的 `kernel` 包。在它们被安装完成之前,我们需要去调整一下 `initramfs` 镜像中包含的驱动程序集,`kernel` 首次安装时将自动构建这个镜像。尤其是,我们需要禁用 `hostonly` 模式,以便于 `initramfs` 镜像能够在各种硬件平台上正常工作,并且我们还需要添加对网络和 NFS 的支持: -```javascript +``` $ echo 'hostonly=no' > /fc28/etc/dracut.conf.d/hostonly.conf $ echo 'add_dracutmodules+=" network nfs "' > /fc28/etc/dracut.conf.d/netboot.conf ``` -现在,安装 kernel: +现在,安装 `kernel` 包: -```javascript +``` $ dnf -y --installroot=/fc28 install kernel ``` -设置一个阻止 kernel 被更新的规则: +设置一个阻止 `kernel` 包被更新的规则: -```javascript +``` $ echo 'exclude=kernel-*' >> /fc28/etc/dnf/dnf.conf ``` 设置 locale: -```javascript +``` $ echo 'LANG="en_US.UTF-8"' > /fc28/etc/locale.conf ``` > 注意:如果 locale 没有正确配置,一些程序(如 GNOME Terminal)将无法正常工作。 -root 用户密码留空: - -```javascript -$ sed -i 's/^root:\*/root:/' /fc28/etc/shadow -``` - 设置客户端的主机名字: -```javascript +``` $ MY_CLIENT_HOSTNAME=client-01.example.edu $ echo $MY_CLIENT_HOSTNAME > /fc28/etc/hostname ``` 禁用控制台日志输出: -```javascript +``` $ echo 'kernel.printk = 0 4 1 7' > /fc28/etc/sysctl.d/00-printk.conf ``` -定义网络引导镜像中的本地 “liveuser” 用户: +定义网络引导镜像中的本地 `liveuser` 用户: -```javascript +``` $ echo 'liveuser:x:1000:1000::/home/liveuser:/bin/bash' >> /fc28/etc/passwd $ echo 'liveuser::::::::' >> /fc28/etc/shadow $ echo 'liveuser:x:1000:' >> /fc28/etc/group $ echo 'liveuser:!::' >> /fc28/etc/gshadow ``` -在 sudo 中启用 “liveuser”: +允许 `liveuser` 使用 `sudo`: -```javascript +``` $ echo 'liveuser ALL=(ALL) NOPASSWD: ALL' > /fc28/etc/sudoers.d/liveuser ``` -启用自动 home 目录创建: +启用自动创建家目录: -```livescript +``` $ dnf install -y --installroot=/fc28 authselect oddjob-mkhomedir $ echo 'dirs /home' > /fc28/etc/rwtab.d/home $ chroot /fc28 authselect select sssd with-mkhomedir --force @@ -194,19 +192,19 @@ $ chroot /fc28 systemctl enable oddjobd.service 由于多个客户端将会同时挂载我们的镜像,我们需要去配置镜像工作在只读模式中: -```livescript +``` $ sed -i 's/^READONLY=no$/READONLY=yes/' /fc28/etc/sysconfig/readonly-root ``` 配置日志输出到内存而不是持久存储中: -```livescript +``` $ sed -i 's/^#Storage=auto$/Storage=volatile/' /fc28/etc/systemd/journald.conf ``` 配置 DNS: -```livescript +``` $ MY_DNS1=192.0.2.91 $ MY_DNS2=192.0.2.92 $ cat << END > /fc28/etc/resolv.conf @@ -215,9 +213,9 @@ nameserver $MY_DNS2 END ``` -解决编写本教程时存在的只读 root 挂载 bug([BZ1542567][7]): +绕开编写本教程时存在的根目录只读挂载的 bug([BZ1542567][7]): -```livescript +``` $ echo 'dirs /var/lib/gssproxy' > /fc28/etc/rwtab.d/gssproxy $ cat << END > /fc28/etc/rwtab.d/systemd dirs /var/lib/systemd/catalog @@ -227,7 +225,7 @@ END 最后,为我们镜像创建 NFS 文件系统,并将它共享到我们的子网中: -```livescript +``` $ mkdir /export/fc28 $ echo '/fc28 /export/fc28 none bind 0 0' >> /etc/fstab $ mount /export/fc28 @@ -237,20 +235,20 @@ $ exportfs -vr ### 创建引导加载器 -现在,我们已经有了可以进行网络引导的操作系统,我们需要一个引导加载器去从客户端系统上启动它。在本教程中我们使用的是 [iPXE][8]. +现在,我们已经有了可以进行网络引导的操作系统,我们需要一个引导加载器去从客户端系统上启动它。在本教程中我们使用的是 [iPXE][8]。 -> 注意:本节和接下来的节 — 使用 QEMU 测试 — 能在另外一台单独的计算机上来完成;它们不需要在网络引导服务器上来运行。 +> 注意:本节和接下来的节使用 QEMU 测试,也能在另外一台单独的计算机上来完成;它们并不需要在网络引导服务器上来运行。 -安装 git 并使用它去下载 iPXE: +安装 `git` 并使用它去下载 iPXE: -```livescript +``` $ dnf install -y git $ git clone http://git.ipxe.org/ipxe.git $HOME/ipxe ``` 现在我们需要去为我们的引导加载器创建一个指定的启动脚本: -```livescript +``` $ cat << 'END' > $HOME/ipxe/init.ipxe #!ipxe @@ -264,19 +262,19 @@ END 启动 “file” 下载协议: -```livescript +``` $ echo '#define DOWNLOAD_PROTO_FILE' > $HOME/ipxe/src/config/local/general.h ``` 安装 C 编译器以及相关的工具和库: -```livescript +``` $ dnf groupinstall -y "C Development Tools and Libraries" ``` 构建引导加载器: -```livescript +``` $ cd $HOME/ipxe/src $ make clean $ make bin-x86_64-efi/ipxe.efi EMBED=../init.ipxe @@ -284,7 +282,7 @@ $ make bin-x86_64-efi/ipxe.efi EMBED=../init.ipxe 记下新编译的引导加载器的存储位置。我们将在接下来的节中用到它: -```livescript +``` $ IPXE_FILE="$HOME/ipxe/src/bin-x86_64-efi/ipxe.efi" ``` @@ -292,13 +290,13 @@ $ IPXE_FILE="$HOME/ipxe/src/bin-x86_64-efi/ipxe.efi" 这一节是可选的,但是你需要去复制下面显示在物理机器上的 [EFI 系统分区][9] 的布局,在网络引导时需要去配置它们。 -> 注意:如果你想实现一个完全的无盘系统,你也可以复制那个文件到一个 TFTP 服务器,然后从 DHCP 上引用那台服务器。 +> 注意:如果你想实现一个完全的无盘系统,你也可以复制那个文件到一个 TFTP 服务器,然后从 DHCP 上指向那台服务器。 为了使用 QEMU 去测试我们的引导加载器,我们继续去创建一个仅包含一个 EFI 系统分区和我们的启动文件的、很小的磁盘镜像。 从创建 EFI 系统分区所需要的目录布局开始,然后把我们在前面节中创建的引导加载器复制进去: -```livescript +``` $ mkdir -p $HOME/esp/efi/boot $ mkdir $HOME/esp/linux $ cp $IPXE_FILE $HOME/esp/efi/boot/bootx64.efi @@ -306,13 +304,13 @@ $ cp $IPXE_FILE $HOME/esp/efi/boot/bootx64.efi 下面的命令将识别我们的引导加载器镜像正在使用的内核版本,并将它保存到一个变量中,以备后续的配置命令去使用它: -```livescript +``` $ DEFAULT_VER=$(ls -c /fc28/lib/modules | head -n 1) ``` 定义我们的客户端计算机将使用的引导配置: -```livescript +``` $ MY_DNS1=192.0.2.91 $ MY_DNS2=192.0.2.92 $ MY_NFS4=server-01.example.edu @@ -329,14 +327,14 @@ END 复制 Linux 内核并分配 initramfs 给 EFI 系统分区: -```livescript +``` $ cp $(find /fc28/lib/modules -maxdepth 2 -name 'vmlinuz' | grep -m 1 $DEFAULT_VER) $HOME/esp/linux/vmlinuz-$DEFAULT_VER $ cp $(find /fc28/boot -name 'init*' | grep -m 1 $DEFAULT_VER) $HOME/esp/linux/initramfs-$DEFAULT_VER.img ``` 我们最终的目录布局应该看起来像下面的样子: -```livescript +``` esp ├── efi │   └── boot @@ -347,17 +345,17 @@ esp └── vmlinuz-4.18.18-200.fc28.x86_64 ``` -使用 QEMU 去使用我们的 EFI 系统分区,我们需要去创建一个小的 “uefi.img” 磁盘镜像来包含它,然后将它连接到 QEMU 作为主引导驱动器。 +要让 QEMU 去使用我们的 EFI 系统分区,我们需要去创建一个小的 `uefi.img` 磁盘镜像来包含它,然后将它连接到 QEMU 作为主引导驱动器。 开始安装必需的工具: -```livescript +``` $ dnf install -y parted dosfstools ``` -现在创建 “uefi.img” 文件,并将 “esp” 目录中文件复制进去: +现在创建 `uefi.img` 文件,并将 `esp` 目录中的文件复制进去: -```livescript +``` $ ESP_SIZE=$(du -ks $HOME/esp | cut -f 1) $ dd if=/dev/zero of=$HOME/uefi.img count=$((${ESP_SIZE}+5000)) bs=1KiB $ UEFI_DEV=$(losetup --show -f $HOME/uefi.img) @@ -370,54 +368,55 @@ $ umount $HOME/mnt $ losetup -d ${UEFI_DEV} ``` -> 注意:在物理计算机上,你只需要从 “esp” 目录中复制文件到计算机上已存在的 EFI 系统分区中。你不需要使用 “uefi.img” 文件去引导物理计算机。 +> 注意:在物理计算机上,你只需要从 `esp` 目录中复制文件到计算机上已存在的 EFI 系统分区中。你不需要使用 `uefi.img` 文件去引导物理计算机。 > -> 注意:在一个物理计算机上,如果文件名已存在,你可以重命名 “bootx64.efi” 文件,如果你重命名了它,就需要去编辑计算机的 BIOS 设置,并添加重命令后的 efi 文件到引导列表中。 +> 注意:在一个物理计算机上,如果文件名已存在,你可以重命名 `bootx64.efi` 文件,如果你重命名了它,就需要去编辑计算机的 BIOS 设置,并添加重命令后的 efi 文件到引导列表中。 接下来我们需要去安装 qemu 包: -```livescript +``` $ dnf install -y qemu-system-x86 ``` 允许 QEMU 访问我们在本教程“初始化配置”一节中创建的网桥: -```livescript +``` $ echo 'allow br0' > /etc/qemu/bridge.conf ``` -创建一个 “OVMF_VARS.fd” 镜像的副本去保存我们虚拟机的持久 BIOS 配置: +创建一个 `OVMF_VARS.fd` 镜像的副本去保存我们虚拟机的持久 BIOS 配置: -```livescript +``` $ cp /usr/share/edk2/ovmf/OVMF_VARS.fd $HOME ``` 现在,启动虚拟机: -```livescript +``` $ qemu-system-x86_64 -machine accel=kvm -nographic -m 1024 -drive if=pflash,format=raw,unit=0,file=/usr/share/edk2/ovmf/OVMF_CODE.fd,readonly=on -drive if=pflash,format=raw,unit=1,file=$HOME/OVMF_VARS.fd -drive if=ide,format=raw,file=$HOME/uefi.img -net bridge,br=br0 -net nic,model=virtio ``` 如果一切顺利,你将看到类似下图所示的结果: ![][10] -你可以使用 “shutdown” 命令关闭虚拟机回到我们的服务器上: -```livescript +你可以使用 `shutdown` 命令关闭虚拟机回到我们的服务器上: + +``` $ sudo shutdown -h now ``` -> 注意:如果出现了错误或虚拟机挂住了,你可能需要启动一个新的 SSH 会话去连接服务器,使用 “kill” 命令去终止 “qemu-system-x86_64” 进程。 +> 注意:如果出现了错误或虚拟机挂住了,你可能需要启动一个新的 SSH 会话去连接服务器,使用 `kill` 命令去终止 `qemu-system-x86_64` 进程。 ### 镜像中添加包 -镜像中添加包应该是一个很简单的问题,在服务器上 chroot 进镜像,然后运行 “dnf install ”。 +镜像中添加包应该是一个很简单的问题,在服务器上 `chroot` 进镜像,然后运行 `dnf install `。 在网络引导镜像中并不限制你能安装什么包。一个完整的图形化安装应该能够完美地工作。 下面是一个如何将最小化安装的网络引导镜像变成完整的图形化安装的示例: -```livescript +``` $ for i in dev dev/pts dev/shm proc sys run; do mount -o bind /$i /fc28/$i; done $ chroot /fc28 /usr/bin/bash --login $ dnf -y groupinstall "Fedora Workstation" @@ -430,9 +429,9 @@ $ logout $ for i in run sys proc dev/shm dev/pts dev; do umount /fc28/$i; done ``` -可选,你可能希望去启用 “liveuser” 用户的自动登陆: +可选地,你可能希望去启用 `liveuser` 用户的自动登录: -```livescript +``` $ sed -i '/daemon/a AutomaticLoginEnable=true' /fc28/etc/gdm/custom.conf $ sed -i '/daemon/a AutomaticLogin=liveuser' /fc28/etc/gdm/custom.conf ``` @@ -444,7 +443,7 @@ via: https://fedoramagazine.org/how-to-build-a-netboot-server-part-1/ 作者:[Gregory Bartholomew][a] 选题:[lujun9972][b] 译者:[qhwdw](https://github.com/qhwdw) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 7af8488185a01b1db58102d771e956ea6111ee55 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 24 Dec 2018 23:50:47 +0800 Subject: [PATCH 052/322] PUB:20181123 How to Build a Netboot Server, Part 1.md @qhwdw https://linux.cn/article-10379-1.html --- .../20181123 How to Build a Netboot Server, Part 1.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181123 How to Build a Netboot Server, Part 1.md (99%) diff --git a/translated/tech/20181123 How to Build a Netboot Server, Part 1.md b/published/20181123 How to Build a Netboot Server, Part 1.md similarity index 99% rename from translated/tech/20181123 How to Build a Netboot Server, Part 1.md rename to published/20181123 How to Build a Netboot Server, Part 1.md index 1888f4ab2b..ac64617de8 100644 --- a/translated/tech/20181123 How to Build a Netboot Server, Part 1.md +++ b/published/20181123 How to Build a Netboot Server, Part 1.md @@ -1,11 +1,11 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) [#]: reviewer: (wxy) -[#]: publisher: ( ) +[#]: publisher: (wxy) [#]: subject: (How to Build a Netboot Server, Part 1) [#]: via: (https://fedoramagazine.org/how-to-build-a-netboot-server-part-1/) [#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/) -[#]: url: ( ) +[#]: url: (https://linux.cn/article-10379-1.html) 如何构建一台网络引导服务器(一) ====== From 0a6c32e789f12bfc6c40d519657a2d228eee6f02 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 25 Dec 2018 00:28:46 +0800 Subject: [PATCH 053/322] PRF:20180912 How to turn on an LED with Fedora IoT.md @ScarboroughCoral --- ...2 How to turn on an LED with Fedora IoT.md | 87 ++++++++----------- 1 file changed, 36 insertions(+), 51 deletions(-) diff --git a/translated/tech/20180912 How to turn on an LED with Fedora IoT.md b/translated/tech/20180912 How to turn on an LED with Fedora IoT.md index 59bbc1280b..f72d8cb0bc 100644 --- a/translated/tech/20180912 How to turn on an LED with Fedora IoT.md +++ b/translated/tech/20180912 How to turn on an LED with Fedora IoT.md @@ -1,116 +1,105 @@ -# 如何使用 Fedora IoT 开启 LED 灯 +如何使用 Fedora IoT 点亮 LED 灯 +====== ![](https://fedoramagazine.org/wp-content/uploads/2018/08/LED-IoT-816x345.jpg) -你喜欢 Fedora、容器和树莓派吗?这三者结合操控 LED 会怎么样?本文介绍的是 Fedora IoT,将展示如何在树莓派上安装预览镜像。还将学习如何与 GPIO 交互以开启 LED。 +如果你喜欢 Fedora、容器,而且有一块树莓派,那么这三者结合操控 LED 会怎么样?本文介绍的是 Fedora IoT,将展示如何在树莓派上安装预览镜像。还将学习如何与 GPIO 交互以点亮 LED。 ### 什么是 Fedora IoT? -Fedora IoT 是当前 Fedora 项目的目标之一,计划成为一个完整的 Fedora 版本。Fedora IoT 将是一个在ARM(目前仅限 aarch64)例如树莓派,以及 x86_64 架构设备上运行的系统。 +Fedora IoT 是当前 Fedora 项目的目标之一,计划成为一个完整的 Fedora 版本。Fedora IoT 将是一个在 ARM(目前仅限 aarch64)设备上(例如树莓派),以及 x86_64 架构上运行的系统。 ![][1] -Fedora IoT 基于 OSTree 开发, 就像[Fedora Silverblue][2] 和以往的 [Atomic Host][3]. +Fedora IoT 基于 OSTree 开发,就像 [Fedora Silverblue][2] 和以往的 [Atomic Host][3]。 ### 下载和安装 Fedora IoT -官方 Fedora IoT 镜像将和 Fedora 29 一起发布。但是在此期间你可以下载 [Fedora 28-based 镜像][4] 来进行这个实验。 +官方 Fedora IoT 镜像将和 Fedora 29 一起发布。但是在此期间你可以下载 [基于 Fedora 28 的镜像][4] 来进行这个实验。(LCTT 译注:截止至本译文发布,[Fedora 29 已经发布了][11],但是 IoT 版本并未随同发布,或许会在 Fedora 30 一同发布?) -你有两种方法来安装这个系统:使用 dd 命令闪存SD卡,或者使用 fedora-arm-installer 工具。Fedora 的 Wiki 里面提供了更多关于[设置物理设备][5] 的信息来开发 IoT。另外,你可能需要调整第三个分区的大小。 +你有两种方法来安装这个系统:要么使用 `dd` 命令烧录 SD 卡,或者使用 `fedora-arm-installer` 工具。Fedora 的 Wiki 里面提供了为 IoT [设置物理设备][5] 的更多信息。另外,你可能需要调整第三个分区的大小。 -把 SD 卡插入到设备并运行,需要创建一个用户来完成安装。这个步骤需要串行连接或带键盘的 HDMI 显示器来与设备进行交互。 +把 SD 卡插入到设备后,你需要创建一个用户来完成安装。这个步骤需要串行连接或一个 HDMI 显示器和键盘来与设备进行交互。 当系统安装完成后,下一步就是要设置网络连接。使用你刚才创建的用户登录系统,可以使用下列方式之一完成网络连接设置: -- 如果你需要手动配置你的网络,可能需要执行类似如下命令,需要保证设置正确的网络地址: +* 如果你需要手动配置你的网络,可能需要执行类似如下命令,需要保证设置正确的网络地址: -``` + ``` $ nmcli connection add con-name cable ipv4.addresses \ 192.168.0.10/24 ipv4.gateway 192.168.0.1 \ connection.autoconnect true ipv4.dns "8.8.8.8,1.1.1.1" \ type ethernet ifname eth0 ipv4.method manual - ``` -- 如果你网络上运行着 DHCP 服务,可能需要类似如下命令: +* 如果你网络上运行着 DHCP 服务,可能需要类似如下命令: -``` + ``` $ nmcli con add type ethernet con-name cable ifname eth0 ``` - - -### **Fedora 中的 GPIO 接口** +### Fedora 中的 GPIO 接口 许多关于 Linux 上 GPIO 的教程都关注传统的 GPIO sysfis 接口。这个接口已经不推荐使用了,并且上游 Linux 内核社区由于安全和其他问题的缘故打算完全删除它。 -Fedora 已经不将这个传统的接口编译到内核了,因此在系统上没有 /sys/class/gpio 这个文件。此教程使用一个上游内核提供的一个新的字符设备 /dev/gpiochipN 。这是目前和 GPIO 交互的方式。 +Fedora 已经不将这个传统的接口编译到内核了,因此在系统上没有 `/sys/class/gpio` 这个文件。此教程使用一个上游内核提供的一个新的字符设备 `/dev/gpiochipN` 。这是目前和 GPIO 交互的方式。 -为了和这个新设备进行交互,你需要使用一个库和一系列命令行界面工具。公共命令行工具比如说 echo 和 cat 在此设备上无法正常工作。 +为了和这个新设备进行交互,你需要使用一个库和一系列命令行界面的工具。常用的命令行工具比如说 `echo` 和 `cat` 在此设备上无法正常工作。 你可以通过安装 libgpiod-utils 包来安装命令行界面工具。python3-libgpiod 包提供了相应的 Python 库。 -### **使用 Podman 来创建一个容器** +### 使用 Podman 来创建一个容器 -[Podman][6] 是一个容器运行环境,其命令行界面类似于Docker。Podman的一大优势是它不会在后台运行任何守护进程。这对于资源有限的设备尤其有用。Podman 还允许您使用 systemd 单元文件启动容器化服务。此外,它还有许多其他功能。 +[Podman][6] 是一个容器运行环境,其命令行界面类似于 Docker。Podman 的一大优势是它不会在后台运行任何守护进程。这对于资源有限的设备尤其有用。Podman 还允许您使用 systemd 单元文件启动容器化服务。此外,它还有许多其他功能。 我们使用如下两步来创建一个容器: -``` 1. 创建包含所需包的分层镜像。 2. 使用分层镜像创建一个新容器。 -``` - - -首先创建一个 Dockerfile 文件,内容如下。这些内容告诉 podman 基于可使用的最新 Fedora 镜像来构建我们的分层镜像。然后就是更新系统和安装一些软件包: +首先创建一个 Dockerfile 文件,内容如下。这些内容告诉 Podman 基于可使用的最新 Fedora 镜像来构建我们的分层镜像。然后就是更新系统和安装一些软件包: ``` FROM fedora:latest RUN dnf -y update RUN dnf -y install libgpiod-utils python3-libgpiod - ``` 这样你就完成了镜像的生成前的配置工作,这个镜像基于最新的 Fedora,而且包含了和 GPIO 交互的软件包。 -现在你就可以运行下方命令来构建你的基本镜像了: +现在你就可以运行如下命令来构建你的基本镜像了: ``` $ sudo podman build --tag fedora:gpiobase -f ./Dockerfile - ``` 你已经成功创建了你的自定义镜像。这样以后你就可以不用每次都重新搭建环境了,而是基于你创建的镜像来完成工作。 ### 使用 Podman 完成工作 -为了确认当前的镜像,可以运行下方命令: +为了确认当前的镜像是否就绪,可以运行如下命令: ``` $ sudo podman images REPOSITORY TAG IMAGE ID CREATED SIZE localhost/fedora gpiobase 67a2b2b93b4b 10 minutes ago 488MB docker.io/library/fedora latest c18042d7fac6 2 days ago 300MB - ``` -现在,启动容器并进行一些实际的实验。 容器通常是隔离的,无法访问主机系统,包括GPIO接口。 因此需要在启动容器时将其挂载在容器内。 可以使用以下命令中的 -device 选项来解决: +现在,启动容器并进行一些实际的实验。容器通常是隔离的,无法访问主机系统,包括 GPIO 接口。因此需要在启动容器时将其挂载在容器内。可以使用以下命令中的 `-device` 选项来解决: ``` $ sudo podman run -it --name gpioexperiment --device=/dev/gpiochip0 localhost/fedora:gpiobase /bin/bash - ``` -运行之后就进入了正在运行的容器中。 在继续之前,这里有一些容器命令。 输入 exit 或者按下 **Ctrl+D** 来退出容器。 +运行之后就进入了正在运行的容器中。在继续之前,这里有一些容器命令。输入 `exit` 或者按下 `Ctrl+D` 来退出容器。 -显示所有存在的容器可以运行如下命令: +显示所有存在的容器可以运行如下命令,这包括当前没有运行的,比如你刚刚创建的那个: ``` $ sudo podman container ls -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 64e661d5d4e8 localhost/fedora:gpiobase /bin/bash 37 seconds ago Exited (0) Less than a second ago gpioexperiment - ``` 使用如下命令创建一个新的容器: @@ -127,55 +116,50 @@ $ sudo podman rm newexperiment ``` -### **开启 LED 灯** +### 点亮 LED 灯 -现在可以使用已创建的容器。 如果容器已经退出,请使用以下命令再次启动它: +现在可以使用已创建的容器。如果已经从容器退出,请使用以下命令再次启动它: ``` $ sudo podman start -ia gpioexperiment - ``` -如前所述,可以使用 Fedora 中 libgpiod-utils 包提供的 CLI 工具。 要列出可用的 GPIO 芯片可以使用如下命令: +如前所述,可以使用 Fedora 中 libgpiod-utils 包提供的命令行工具。要列出可用的 GPIO 芯片可以使用如下命令: ``` $ gpiodetect gpiochip0 [pinctrl-bcm2835] (54 lines) - ``` -要获取特定芯片的公开列表,请运行: +要获取特定芯片的连线列表,请运行: ``` $ gpioinfo gpiochip0 - ``` -请注意,物理引脚数与前一个命令打印的行数之间没有相关性。 重要的是 BCM 编号,如 [pinout.xyz][7] 所示。 建议不要使用没有相应 BCM 编号的线路。 +请注意,物理引脚数与前一个命令所打印的连线数之间没有相关性。重要的是 BCM 编号,如 [pinout.xyz][7] 所示。建议不要使用没有相应 BCM 编号的连线。 -现在,将 LED 连接到物理引脚40,也就是 BCM 21。请记住:LED的短腿(负极,称为阴极)必须连接到带有330欧姆电阻的树莓派的 GND 引脚, 并且长腿(阳极)到物理引脚40。 +现在,将 LED 连接到物理引脚 40,也就是 BCM 21。请记住:LED 的短腿(负极,称为阴极)必须连接到带有 330 欧姆电阻的树莓派的 GND 引脚, 并且长腿(阳极)到物理引脚 40。 -运行以下命令打开LED。,按下 **Ctrl + C ** 关闭: +运行以下命令点亮 LED,按下 `Ctrl + C` 关闭: ``` $ gpioset --mode=wait gpiochip0 21=1 - ``` -要点亮一段时间,请添加 -b(在后台运行)和 -s NUM(多少秒)参数,如下所示。 例如,要点亮 LED 5秒钟,运行如下命令: +要点亮一段时间,请添加 `-b`(在后台运行)和 `-s NUM`(多少秒)参数,如下所示。 例如,要点亮 LED 5 秒钟,运行如下命令: ``` $ gpioset -b -s 5 --mode=time gpiochip0 21=1 - ``` -另一个有用的命令是 gpioget。 它可以获得引脚的状态(高或低),可用于检测按钮和开关。 +另一个有用的命令是 `gpioget`。 它可以获得引脚的状态(高或低),可用于检测按钮和开关。 ![Closeup of LED connection with GPIO][8] -### **总结** +### 总结 -你也可以使用 Python 操控 LED - [这里有一些例子][9]。 也可以在容器内使用 i2c 设备。 此外,Podman 与此 Fedora 版本并不严格相关。 你可以在任何现有的 Fedora Edition 上安装它,或者在 Fedora 中使用两个基于 OSTree 的新系统进行尝试:[Fedora Silverblue][2] 和 [Fedora CoreOS][10]。 +你也可以使用 Python 操控 LED —— [这里有一些例子][9]。 也可以在容器内使用 i2c 设备。 此外,Podman 与此 Fedora 版本并不严格相关。你可以在任何现有的 Fedora 版本上安装它,或者在 Fedora 中使用两个基于 OSTree 的新系统进行尝试:[Fedora Silverblue][2] 和 [Fedora CoreOS][10]。 ------ @@ -184,7 +168,7 @@ via: https://fedoramagazine.org/turnon-led-fedora-iot/ 作者:[Alessio Ciregia][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[ScarboroughCoral](https://github.com/ScarboroughCoral) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -199,3 +183,4 @@ via: https://fedoramagazine.org/turnon-led-fedora-iot/ [8]: https://fedoramagazine.org/wp-content/uploads/2018/08/breadboard-1024x768.png [9]: https://github.com/brgl/libgpiod/tree/master/bindings/python/examples [10]: https://coreos.fedoraproject.org/ +[11]: https://fedoramagazine.org/announcing-fedora-29/ From 0b47390027f6c47b7aaeb9eda119c43a61515d79 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 25 Dec 2018 00:29:13 +0800 Subject: [PATCH 054/322] PUB:20180912 How to turn on an LED with Fedora IoT.md @ScarboroughCoral https://linux.cn/article-10380-1.html --- .../20180912 How to turn on an LED with Fedora IoT.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180912 How to turn on an LED with Fedora IoT.md (100%) diff --git a/translated/tech/20180912 How to turn on an LED with Fedora IoT.md b/published/20180912 How to turn on an LED with Fedora IoT.md similarity index 100% rename from translated/tech/20180912 How to turn on an LED with Fedora IoT.md rename to published/20180912 How to turn on an LED with Fedora IoT.md From 861c58e526212cae696ef929fc33c0a4af3f91dc Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 25 Dec 2018 01:31:15 +0800 Subject: [PATCH 055/322] PRF:20171223 Celebrate Christmas In Linux Way With These Wallpapers.md @jlztan --- ...tmas In Linux Way With These Wallpapers.md | 79 ++++++++++++------- 1 file changed, 52 insertions(+), 27 deletions(-) diff --git a/translated/tech/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md b/translated/tech/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md index 3c282ce7d5..5bd416a424 100644 --- a/translated/tech/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md +++ b/translated/tech/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md @@ -1,24 +1,38 @@ [#]: collector: (lujun9972) [#]: translator: (jlztan) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: subject: (Celebrate Christmas In Linux Way With These Wallpapers) [#]: via: (https://itsfoss.com/christmas-linux-wallpaper/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) [#]: url: ( ) -使用这些壁纸以 Linux 的方式庆祝圣诞节 +以 Linux 的方式庆祝圣诞节 ====== -当前正是假日季节,很多人可能已经在庆祝圣诞节了。我代表 It's FOSS 团队祝你圣诞快乐,新年快乐。 +当前正是假日季,很多人可能已经在庆祝圣诞节了。祝你圣诞快乐,新年快乐。 -为了延续节日氛围,我将向你展示一些非常棒的圣诞主题 [Linux壁纸][1]。在呈现这些壁纸之前,先来看一棵 Linux 终端下的圣诞树。 +为了延续节日氛围,我将向你展示一些非常棒的圣诞主题的 [Linux 壁纸][1]。在呈现这些壁纸之前,先来看一棵 Linux 终端下的圣诞树。 + +### 让你的桌面飘雪(针对 GNOME 用户) + +- [Let it Snow on Your Linux Desktop](https://youtu.be/1QI1ludzZuA) + +如果您在 Ubuntu 18.04 或任何其他 Linux 发行版中使用 GNOME 桌面,您可以使用一个小的 [GNOME 扩展][55]并在桌面上飘雪。 + +您可以从软件中心或 GNOME 扩展网站获取此 gsnow 扩展。我建议您阅读一些关于[使用 GNOME 扩展][55]的内容。 + +安装此扩展程序后,您会在顶部面板上看到一个小雪花图标。 如果您单击一次,您会看到桌面屏幕上的小絮状物掉落。 + +![](https://itsfoss.com/wp-content/uploads/2018/12/snowfall-on-linux-desktop-1.webm) + +你可以再次点击该图标来禁止雪花落下。 ### 在 Linux 终端下显示圣诞树 -圣诞树的效果如 [这个页面](https://giphy.com/embed/xUNda6KphvbpYxL3tm) 所示。 +![Display Christmas Tree in Linux Terminal](https://i.giphy.com/xUNda6KphvbpYxL3tm.gif) -使用以下命令在终端中显示一棵动画圣诞树: +如果你想要在终端里显示一个动画的圣诞树,你可以使用如下命令: ``` curl https://raw.githubusercontent.com/sergiolepore/ChristBASHTree/master/tree-EN.sh | bash @@ -40,7 +54,7 @@ perl -MCPAN -e 'install Acme::POE::Tree' 你可以阅读 [原文][5] 来了解更多信息。 -## 下载 Linux 圣诞主题壁纸 +### 下载 Linux 圣诞主题壁纸 所有这些 Linux 圣诞主题壁纸都是由 Mark Riedesel 制作的,你可以在 [他的网站][6] 上找到很多其他艺术品。 @@ -48,87 +62,95 @@ perl -MCPAN -e 'install Acme::POE::Tree' 注意一个小地方,这里显示的图片都是高度压缩的,因此你要通过图片下方提供的链接进行下载。 +![Christmas Linux Wallpaper][56] + +*[下载此壁纸][57]* + ![Christmas Linux Wallpaper][7] -[下载此壁纸][8] +*[下载此壁纸][8]* [![Christmas Linux Wallpapers][9]][10] -[下载此壁纸][11] +*[下载此壁纸][11]* [![Christmas Linux Wallpapers][12]][13] -[下载此壁纸][14] +*[下载此壁纸][14]* [![Christmas Linux Wallpapers][15]][16] -[下载此壁纸][17] +*[下载此壁纸][17]* [![Christmas Linux Wallpapers][18]][19] -[下载此壁纸][20] +*[下载此壁纸][20]* [![Christmas Linux Wallpapers][21]][22] -[下载此壁纸][23] +*[下载此壁纸][23]* [![Christmas Linux Wallpapers][24]][25] -[下载此壁纸][26] +*[下载此壁纸][26]* [![Christmas Linux Wallpapers][27]][28] -[下载此壁纸][29] +*[下载此壁纸][29]* [![Christmas Linux Wallpapers][30]][31] -[下载此壁纸][32] +*[下载此壁纸][32]* [![Christmas Linux Wallpapers][33]][34] -[下载此壁纸][35] +*[下载此壁纸][35]* [![Christmas Linux Wallpapers][36]][37] -[下载此壁纸][38] +*[下载此壁纸][38]* [![Christmas Linux Wallpapers][39]][40] -[下载此壁纸][41] +*[下载此壁纸][41]* [![Christmas Linux Wallpapers][42]][43] -[下载此壁纸][44] +*[下载此壁纸][44]* [![Christmas Linux Wallpapers][45]][46] -[下载此壁纸][47] +*[下载此壁纸][47]* [![Christmas Linux Wallpapers][48]][49] -[下载此壁纸][50] +*[下载此壁纸][50]* ### 福利:Linux 圣诞颂歌 这是给你的一份福利,给像我们一样的 Linux 爱好者的关于 Linux 的圣诞颂歌。 -在 [计算机世界的一篇文章][51] 中,[Sandra Henry-Stocker][52] 分享了这些圣诞颂歌。摘录片段如下: +在 [《计算机世界》的一篇文章][51] 中,[Sandra Henry-Stocker][52] 分享了这些圣诞颂歌。摘录片段如下: 这一段用的 [Chestnuts Roasting on an Open Fire][53] 的曲调: -> Running merrily on open source +> Running merrily on open source +> > With users happy as can be +> > We’re using Linux and getting lots done + > And happy everything is free 这一段用的 [The Twelve Days of Christmas][54] 的曲调: -> On my first day with Linux, my admin gave to me a password and a login ID +> On my first day with Linux, my admin gave to me a password and a login ID +> > On my second day with Linux my admin gave to me two new commands and a password and a login ID 在 [这里][51] 阅读完整的颂歌。 -祝你享受 Linux! +Linux 快乐! ------ @@ -137,7 +159,7 @@ via: https://itsfoss.com/christmas-linux-wallpaper/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[jlztan](https://github.com/jlztan) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -197,3 +219,6 @@ via: https://itsfoss.com/christmas-linux-wallpaper/ [52]: https://twitter.com/bugfarm [53]: https://www.youtube.com/watch?v=dhzxQCTCI3E [54]: https://www.youtube.com/watch?v=oyEyMjdD2uk +[55]: https://itsfoss.com/gnome-shell-extensions/ +[56]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2016/12/ChristmasTux2018.jpeg?w=800&ssl=1 +[57]: http://www.klowner.com/wallery/christmas_tux_2018/download/ChristmasTux2018_4K_3840x2160.png From f4d4fcbd6a1450f476790a478e07b485f56987f7 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 25 Dec 2018 01:32:10 +0800 Subject: [PATCH 056/322] PUB:20171223 Celebrate Christmas In Linux Way With These Wallpapers.md @jlztan https://linux.cn/article-10381-1.html --- ... Celebrate Christmas In Linux Way With These Wallpapers.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md (99%) diff --git a/translated/tech/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md b/published/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md similarity index 99% rename from translated/tech/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md rename to published/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md index 5bd416a424..3aa2e6f3ea 100644 --- a/translated/tech/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md +++ b/published/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md @@ -1,11 +1,11 @@ [#]: collector: (lujun9972) [#]: translator: (jlztan) [#]: reviewer: (wxy) -[#]: publisher: ( ) +[#]: publisher: (wxy) [#]: subject: (Celebrate Christmas In Linux Way With These Wallpapers) [#]: via: (https://itsfoss.com/christmas-linux-wallpaper/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -[#]: url: ( ) +[#]: url: (https://linux.cn/article-10381-1.html) 以 Linux 的方式庆祝圣诞节 ====== From b79701152bd84f5d8ba01c4737947967656861f9 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 25 Dec 2018 08:44:40 +0800 Subject: [PATCH 057/322] translated --- ...1208 Play Tetris at your Linux terminal.md | 57 ------------------- ...1208 Play Tetris at your Linux terminal.md | 57 +++++++++++++++++++ 2 files changed, 57 insertions(+), 57 deletions(-) delete mode 100644 sources/tech/20181208 Play Tetris at your Linux terminal.md create mode 100644 translated/tech/20181208 Play Tetris at your Linux terminal.md diff --git a/sources/tech/20181208 Play Tetris at your Linux terminal.md b/sources/tech/20181208 Play Tetris at your Linux terminal.md deleted file mode 100644 index db1fe62c24..0000000000 --- a/sources/tech/20181208 Play Tetris at your Linux terminal.md +++ /dev/null @@ -1,57 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Play Tetris at your Linux terminal) -[#]: via: (https://opensource.com/article/18/12/linux-toy-tetris) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) - -Play Tetris at your Linux terminal -====== - -Recreate the magic of the 1980s with everyone's favorite tile-matching game, Tetris. - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-tetris.png?itok=_UXtpgzN) - -Thanks for joining us for today's installment of the Linux command-line toys advent calendar. If this is your first visit to the series, you might be asking yourself, what’s a command-line toy. Even I'm not quite sure, but generally, it could be a game or any simple diversion that helps you have fun at the terminal. - -It's quite possible that some of you will have seen various selections from our calendar before, but we hope there’s at least one new thing for everyone. - -I promised when I started this series I'd be including games, but so far I've neglected to, so let's fix that with today's selection: Tetris. - -Tetris and I are almost exactly the same age, having first come into the world in the summer of 1984. Instead of rural North Carolina, though, Tetris originated in Moscow in what was at the time the Soviet Union. - -After taking the world by storm, Tetris was cloned many, many times. I would suspect you could find a Tetris clone for just about any operating system in any language you looked for. Seriously, go look. There are some fun ones out there. - -The [version][1] I'm bringing you for today's command-line toy is [written in Haskell,][1] and it's one of the better-done versions I've seen, with on-screen preview, score, help, and a clean look. - -If you're willing to run a compiled binary from an untrusted source (I wouldn't recommend it), you can grab that directly, but for a safer approach, it's also easy to use a containerized version with [dex][2], or to install from source with [stack][3]. - -This particular Tetris clone is by Sam Tay and available under a BSD license. [Check it out][1]! - -![](https://opensource.com/sites/default/files/uploads/linux-toy-tetris-animated.gif) - -If you've got your own favorite Tetris clone (or maybe you've written your own?), let us know! - -Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. - -Check out yesterday's toy, [Plan your own holiday calendar at the Linux command line][4], and check back tomorrow for another! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-tetris - -作者:[Jason Baker][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/jason-baker -[b]: https://github.com/lujun9972 -[1]: https://github.com/samtay/tetris -[2]: https://github.com/dockerland/dex -[3]: https://docs.haskellstack.org/en/stable/README/#how-to-install -[4]: https://opensource.com/article/18/12/linux-toy-cal diff --git a/translated/tech/20181208 Play Tetris at your Linux terminal.md b/translated/tech/20181208 Play Tetris at your Linux terminal.md new file mode 100644 index 0000000000..110990cc61 --- /dev/null +++ b/translated/tech/20181208 Play Tetris at your Linux terminal.md @@ -0,0 +1,57 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Play Tetris at your Linux terminal) +[#]: via: (https://opensource.com/article/18/12/linux-toy-tetris) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +在 Linux 终端上玩俄罗斯方块 +====== + +用每个人最喜欢的砖块配对游戏俄罗斯方块重新创造 20 世纪 80 年代的魔力。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-tetris.png?itok=_UXtpgzN) + +感谢你来浏览我们今天的 Linux 命令行玩具日历。如果这是你第一次访问该系列,你可能会问自己,什么是命令行玩具。即使我不太确定,但一般来说,它可能是一个游戏或任何消遣,可以帮助你在终端获得乐趣。 + +很可能你们中的一些人之前会看到过我们日历中的各种选择,但我们希望每个人至少遇到一件新事物。 + +我承诺在我开始这个系列时,我会介绍游戏,但到目前为止,我忽略了它,所以我们今天的选择就是游戏:俄罗斯方块。 + +俄罗斯方块和我差不多年纪,都在 1984 年夏天来到世界。不过,俄罗斯方块不是来自北卡罗来纳州的农村地区,而是来自当时苏联的莫斯科。。 + +在风靡世界之后,俄罗斯方块被克隆过很多次。我怀疑你可以找到任何你想找的任何语言、操作系统的俄罗斯方块的克隆。说真的,去看看吧。会有一些有趣的。 + +我今天带来的命令行[版本][1]是[用 Haskell 编写]的,它是我见过的做得更好的版本之一,有屏幕预览、得分、帮助、干净的外观。 + +如果你愿意从不受信任的来源运行已编译的二进制文件(我不推荐它),你可以直接获取它,但有个更安全的方法,使用 [dex][2] 的容器化版本也很容易,或者使用 [stack][3] 从源代码安装。 + +这个俄罗斯方块克隆版是由 Sam Tay 编写的,并且在 BSD 许可证下。[请看这里][1]! + +![](https://opensource.com/sites/default/files/uploads/linux-toy-tetris-animated.gif) + +如果你有自己喜欢的俄罗斯方块克隆版(或者你自己写的?),请告诉我们! + +你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。如果你有特别想了解的可以评论留言,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 + +查看昨天的玩具,[在 Linux 命令行中计划你自己的假期日历][4],明天再回来查看! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-tetris + +作者:[Jason Baker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jason-baker +[b]: https://github.com/lujun9972 +[1]: https://github.com/samtay/tetris +[2]: https://github.com/dockerland/dex +[3]: https://docs.haskellstack.org/en/stable/README/#how-to-install +[4]: https://opensource.com/article/18/12/linux-toy-cal \ No newline at end of file From 4f3d40b41af408e55a32f63aaacfb6da58c1b084 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 25 Dec 2018 09:00:02 +0800 Subject: [PATCH 058/322] Rename \20181219 Fragmentation is Why Linux Hasn-t Succeeded on Desktop- Linus Torvalds.md to 20181219 Fragmentation is Why Linux Hasn-t Succeeded on Desktop- Linus Torvalds.md --- ...on is Why Linux Hasn-t Succeeded on Desktop- Linus Torvalds.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename "sources/talk/\\20181219 Fragmentation is Why Linux Hasn-t Succeeded on Desktop- Linus Torvalds.md" => sources/talk/20181219 Fragmentation is Why Linux Hasn-t Succeeded on Desktop- Linus Torvalds.md (100%) diff --git "a/sources/talk/\\20181219 Fragmentation is Why Linux Hasn-t Succeeded on Desktop- Linus Torvalds.md" b/sources/talk/20181219 Fragmentation is Why Linux Hasn-t Succeeded on Desktop- Linus Torvalds.md similarity index 100% rename from "sources/talk/\\20181219 Fragmentation is Why Linux Hasn-t Succeeded on Desktop- Linus Torvalds.md" rename to sources/talk/20181219 Fragmentation is Why Linux Hasn-t Succeeded on Desktop- Linus Torvalds.md From 4a1613b4caef0c54d8fde93b3e4c3870fb3b7ac6 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 25 Dec 2018 09:04:33 +0800 Subject: [PATCH 059/322] translating --- .../tech/20181221 Listen to the radio at the Linux terminal.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181221 Listen to the radio at the Linux terminal.md b/sources/tech/20181221 Listen to the radio at the Linux terminal.md index 268ba37568..1d4b241ccb 100644 --- a/sources/tech/20181221 Listen to the radio at the Linux terminal.md +++ b/sources/tech/20181221 Listen to the radio at the Linux terminal.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From a6af6f8bc235092736ed32104a87ead725d4aef1 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Tue, 25 Dec 2018 13:36:29 +0800 Subject: [PATCH 060/322] Translating How to Update Ubuntu. --- ...buntu -Terminal - GUI Methods- It-s FOSS.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md b/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md index 85d88129e7..13d393b381 100644 --- a/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md +++ b/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md @@ -121,25 +121,25 @@ apt list --upgradable sudo apt autoremove ``` -#### 在 Ubuntu Server 中热修复内核以避免重启 +#### 在 Ubuntu Server 中内核热修复以避免重启 -In case of a Linux kernel updates, you’ll have to restart the system after the update. This is an issue when you don’t want downtime for your server. +如果是 Linux 内核更新,你将需要在系统更新后重启。当你不希望服务器停机时,这将是一个问题。 -[Live patching][15] feature allows the patching of Linux kernel while the kernel is still running. In other words, you don’t have to reboot your system. +[热修复][15]功能允许Linux内核在持续运行时打补丁。换句话说就是你不需要重启你的系统。 -If you manage servers, you may want to [enable live patching in Ubuntu][16]. +如果你在管理服务器,你可能需要[在 Ubuntu 中启用热修复][16]。 #### 版本升级是不同的 -The updates discussed here is to keep your Ubuntu install fresh and updated. It doesn’t cover the [version upgrades][17] (for example upgrading Ubuntu 16.04 to 18.04). +本文讨论的更新是使你安装的 Ubuntu 保持最新。它不包括[版本升级][17](例如从 Ubuntu 16.04 升级到 18.04)。 -[Ubuntu version][18] upgrades are entirely a different thing. It updates the entire operating system core. You need to make proper backups before starting this lengthy process. +[Ubuntu 版本][18] 升级完全是另一回事。它更新整个操作系统核心。你需要在这个漫长的过程开始前做好备份。 ### 总结 -I hope you liked this tutorial on updating the Ubuntu system and you learned a few new things. +我希望你喜欢这个关于 Ubuntu 系统更新的教程并学到一些新东西。 -If you have any questions, please fee free to ask. If you are an experienced Linux users and have some tip that can make this tutorial more useful, please share it with the rest of us. +如果你有其他问题,请随时提出。如果你是一位经验丰富的 Linux 用户并且有些更好的技巧,请同我们分享。 -------------------------------------------------------------------------------- @@ -147,7 +147,7 @@ via: https://itsfoss.com/update-ubuntu/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[LazyWolfLin](https://github.com/LazyWolfLin) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 71af7c7c1083d003517db5621245fd2f95b3a9f4 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 25 Dec 2018 14:48:05 +0800 Subject: [PATCH 061/322] PRF:20180623 The IBM 029 Card Punch.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @wwhio 翻译的很棒!经典的文章。 --- .../talk/20180623 The IBM 029 Card Punch.md | 42 +++++++++++-------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/translated/talk/20180623 The IBM 029 Card Punch.md b/translated/talk/20180623 The IBM 029 Card Punch.md index e13a10593c..07002cef6e 100644 --- a/translated/talk/20180623 The IBM 029 Card Punch.md +++ b/translated/talk/20180623 The IBM 029 Card Punch.md @@ -1,46 +1,49 @@ IBM 029 型打孔机 ====== -我知道这很学院派,可一行超过 80 个字符的代码还是让我抓狂。我也在网上见过不少人认为即在现代视网膜屏幕下也应当采用行长度为 80 个字符的标准,可他们都不理解我对破坏这一标准的怒火,就算 1 个字符也不行。 -在这一标准的黄金时期,一行代码的长度几乎不会超过 80 个字符的限制。在那时,这一限制是物理的,没有第 81 列用于存放第 81 个字符。每一个试图把函数名起的又长又臭的程序员都会在短暂的愉悦后迎来更多的麻烦,而这仅仅时因为没有足够的空间放下整个函数的声明。 +我知道这很学院派,可一行超过 80 个字符的代码还是让我抓狂。我也在网上见过不少人认为即使在现代的视网膜屏幕下也应当采用行长度为 80 个字符的标准,可他们都不理解我对破坏这一标准的怒火,就算多 1 个字符也不行。 -这一黄金时期也是打孔卡编程时期。在 20 世纪 60 年代, IBM 打孔卡的特性,也就是打孔卡的长度为 80 个字符成为了打孔卡的标准。这一标准在后来的电传打字机和哑终端时期得以延续,并逐渐成为操作系统中隐藏的细节。时至今日,即使我们用上了更大、更好的屏幕,偏向于使用更长的标识符而不是类似 `iswcntrl()` 这样令人难以猜测的函数名,可当你打开新的终端模拟器窗口时,默认的宽度依然是 80 个字符。 +在这一标准的黄金时期,一行代码的长度几乎不会超过 80 个字符的限制。在那时,这一限制是物理的,没有第 81 列用于存放第 81 个字符。每一个试图把函数名起的又长又臭的程序员都会在短暂的愉悦后迎来更多的麻烦,而这仅仅是因为没有足够的空间放下整个函数的声明。 -从 Quora 上的很多问题中可以发现,很多人并不能想象如何使用打孔卡给计算机编程。我承认,在很长的一段时间里我也不能理解卡编程成是如何工作的,因为这让我想到有很多劳工不停的给这些打孔卡打孔。当然,这是一个误解,程序员不需要亲自给打孔卡打孔,就像是火车调度员不用亲自扳道岔。程序员们有打孔机(也被称为键控打孔机key punches),这让他们可以使用打字机式的键盘给打孔卡打孔。这样的设备在 19 世纪 90 年代时就已经不是什么新技术了。 +这一黄金时期也是打孔卡punch card编程时期。在 20 世纪 60 年代,IBM 打孔卡设立了标准,这个标准就是打孔卡的宽度为 80 列。这个 80 列标准在后来的电传打字机和哑终端时期得以延续,并逐渐成为操作系统中隐藏的细节。时至今日,即使我们用上了更大、更好的屏幕,偏向于使用更长的标识符而不是类似 `iswcntrl()` 这样令人难以猜测的函数名,可当你打开新的终端模拟器窗口时,默认的宽度依然是 80 个字符。 + +从 Quora 上的很多问题中可以发现,很多人并不能想象如何使用打孔卡给计算机编程。我承认,在很长的一段时间里我也不能理解打孔卡编程是如何工作的,因为这让我想到就像劳工一样不停的给这些打孔卡打孔。当然,这是一个误解,程序员不需要亲自给打孔卡打孔,就像是火车调度员不用亲自扳道岔。程序员们有打孔机card punch machines(也被称为键控打孔机key punches),这让他们可以使用打字机式的键盘给打孔卡打孔。这样的设备在 19 世纪 90 年代时就已经不是什么新技术了。 那时,最为广泛使用的打孔机之一便是 IBM 029 型打孔机。就算在今天,它也许是最棒的打孔机。 ![][1] -IBM 029 型打孔机在 1964 年作为 IBM 的 System/360 大型电脑的配件发售的。 System/360 是计算系统与外设所组成的一个系列,在 20 世纪 60 年代晚期,它几乎垄断了整个大型计算机市场。就像其它 System/360 外设一样, 029 型打孔机也是个大块头。那时,计算机和家具的界限还很模糊,但 029 型打孔机可不是那种会占领你的整张桌子的机器。它改进自 026 型打孔机,增加了新的字符支持,如括号,总体上也更加安静。与前辈 026 型所展出 20 世纪 40 年代的圆形按钮与工业化的样貌相比, 029 型的按键方正扁平、功能按键还有酷炫的蓝色高亮提示。它的另一个重要买点是它能够在数字区numeric fields左侧自动的填充 0 ,这证明了 JavaScript 程序员不是第一批懒得自己做左填充left-padding的程序员。 -(译者注:这项功能需要额外的 4 张 [标准模块系统卡SMS card](https://en.wikipedia.org/wiki/IBM_Standard_Modular_System)才能使用。例如设置数字区域长度为 6 列时,操作员只需要输入 73 ,打孔机会自动填充起始位置上的 4 个 0 ,故最终输出 000073。[更多信息](https://en.wikipedia.org/wiki/Keypunch#IBM_029_Card_Punch)) +IBM 029 型打孔机在 1964 年作为 IBM 的 System/360 大型电脑的配件发售的。System/360 是计算系统与外设所组成的一个系列,在 20 世纪 60 年代晚期,它几乎垄断了整个大型计算机市场。就像其它 System/360 外设一样,029 型打孔机也是个大块头。那时,计算机和家具的界限还很模糊,但 029 型打孔机可不是那种会占领你的整张桌子的机器。它改进自 026 型打孔机,增加了新的字符支持,如括号,总体上也更加安静。与前辈 026 型所展出 20 世纪 40 年代的圆形按钮与工业化的样貌相比,029 型的按键方正扁平、功能按键还有酷炫的蓝色高亮提示。它的另一个重要买点是它能够在数字区numeric field左侧自动的填充 0 ,这证明了 JavaScript 程序员不是第一批懒得自己做左填充left-padding的程序员。(LCTT 译注:这项功能需要额外的 4 张 [标准模块系统卡](https://en.wikipedia.org/wiki/IBM_Standard_Modular_System)SMS card才能使用。例如设置数字区域长度为 6 列时,操作员只需要输入 73 ,打孔机会自动填充起始位置上的 4 个 0 ,故最终输出 000073。[更多信息](https://en.wikipedia.org/wiki/Keypunch#IBM_029_Card_Punch)) -等等!你说的是 IBM 在 1964 年发布了全新的打孔机?你知道那张在贝尔实验室拍摄的 Unix 之父正在使用电传打字机的照片吗?那是哪一年的来着?1970?打孔机不是应该在 20 世纪 60 年代中期到晚期时就过时了吗?是的,你也许会奇怪,为什么直到 1984 年, IBM 的产品目录中才出现 029 型打孔机的身影。事实上,直到 20 世纪 70 年代,大多数程序员仍然在使用打孔卡编程。其实二战期间就已经有人在用电传打字机了,可那时并没能普及。客观的讲,电传打字机几乎和打孔卡一样古老。也许和你想象的恰恰相反,并不是电传打字机本身限制了他的普及,而是计算时间。人们拒绝使用电传打字机的原因是,它是可交互的,它和计算机使用“在线”的传输方式"online" mode of communication。在以 Unix 为代表的分时操作系统被发明前,你和电脑的交互会被任何人的使用而打断,而这一点延迟通常意味着几千美元的损失。所以程序员们普遍选择离线地使用打孔机编程,再将打孔卡放入大型计算机中,作为批任务batch job执行。在那时,还没有即廉价又可靠的存储设备,可打孔卡的廉价优势已经足够让他成为那时最流行的数据存储方式了。那时的程序是书架上一落的打孔卡而不是硬盘里的一堆文件。 +等等!你说的是 IBM 在 1964 年发布了全新的打孔机?你知道那张在贝尔实验室拍摄的 Unix 之父正在使用电传打字机的照片吗?那是哪一年的来着?1970?打孔机不是应该在 20 世纪 60 年代中期到晚期时就过时了吗?是的,你也许会奇怪,为什么直到 1984 年,IBM 的产品目录中还会出现 029 型打孔机的身影 [^1]。事实上,直到 20 世纪 70 年代,大多数程序员仍然在使用打孔卡编程。其实二战期间就已经有人在用电传打字机了,可那时并没能普及。客观的讲,电传打字机几乎和打孔卡一样古老。也许和你想象的恰恰相反,并不是电传打字机本身限制了它的普及,而是计算时间。人们拒绝使用电传打字机的原因是,它是可交互的,它和计算机使用“在线”的传输方式"online" mode of communication。在以 Unix 为代表的分时操作系统被发明前,你和电脑的交互会被任何人的使用而打断,而这一点延迟通常意味着几千美元的损失。所以程序员们普遍选择离线地使用打孔机编程,再将打孔卡放入大型计算机中,作为批任务batch job执行。在那时,还没有即廉价又可靠的存储设备,可打孔卡的廉价优势已经足够让它成为那时最流行的数据存储方式了。那时的程序是书架上一摞打孔卡而不是硬盘里的一堆文件。 -那么实际使用 IBM 029 型打孔机是个什么样子呢?这很难向没有实际看过打孔卡的人解释。一张打孔卡通常有12行80列。打孔卡下面是从 1 到 9 的数字行digit rows,打孔卡上的每一列都有这些行所对应的数字。最上面的三行是空间行"zone" rows,通常由两行空白行和一行 0 行组成。第 12 行是打孔卡最顶层的行,接下来是 11 行,随后是从数字 0 到 9 所在的行。这个有点让人感到困惑的顺序的原因是打孔卡的上边缘被称为12 边12 edge、下边缘被称为 9 边9 edge。那时,为了让打孔卡便于整理,常常会剪去打孔卡的一个角。 +那么实际使用 IBM 029 型打孔机是个什么样子呢?这很难向没有实际看过打孔卡的人解释。一张打孔卡通常有 12 行 80 列。打孔卡下面是从 1 到 9 的数字行digit rows,打孔卡上的每一列都有这些行所对应的数字。最上面的三行是空间行"zone" rows,通常由两行空白行和一行 0 行组成。第 12 行是打孔卡最顶部的行,接下来是 11 行,随后是从数字 0 到 9 所在的行。这个有点让人感到困惑的顺序的原因是打孔卡的上边缘被称为12 边12 edge、下边缘被称为 9 边9 edge。那时,为了让打孔卡便于整理,常常会剪去打孔卡的一个角。 ![][2] -(译者注:可参考[EBCDIC 编码](https://zh.wikipedia.org/wiki/EBCDIC)) -在打孔卡发明之初,孔洞的形状是圆形的,但是 IBM 最终意识到如果使用窄长方形作为孔洞,一张卡就可以放下更多的列了。每一列中孔洞的不同组合就可以表达不同的字符。像 029 型这样的拥有人性化设计的打孔机除了完成本质的打孔任务外,还会在打孔卡最上方打印出每一列所对应的字符。输入是数字就在对应的数字行上打孔。输入的是字母或符号就用一个在空间列的孔和一或俩个在数字列的孔的组合表示,例如字母 A 就用一个在第 12 空间行的空和一个数字 1 所在行的孔表示。这是一种顺序编码,在第一台打孔机被发明后,也叫 Hollerith 编码。这种编码只能表示相对较小的一套字符集,小写字母就没有包含在这套字符集中,但它的优势在于保留了打孔卡的结构强度。如果直接使用二进制编码,打孔卡可能会因为孔洞过于密集而断裂。 +(LCTT 译注:可参考[EBCDIC 编码](https://zh.wikipedia.org/wiki/EBCDIC)) -打孔卡也有不同。在 20 世纪 60 年代,80 列虽然是标准,但表达的方式不一定相同。基础打孔卡是无标注的,但用于 COBOL 编程的打孔卡会把最后的 8 列保留,供标识数保存使用。这一标识数可以在打孔卡被打乱 (例如一叠打孔卡掉在地上了) 后用于自动排序。此外,第 7 列被用于表示本张打孔卡上的是否是上一张打孔卡一起构成一条语句。也就是说当你真的对 80 字符的限制感到绝望的时候,还可以用两张卡甚至更多的卡拼接成一条长语句。用于 FORTRAN 编程的打孔卡和 COBOL 打孔卡类似,但是定义的列不同。大学里使用的打孔卡通常会由其计算机中心加上水印,其他的设计则会在如 [1976 年美国独立 200 周年][3] 的特殊场合才会加入。 +在打孔卡发明之初,孔洞的形状是圆形的,但是 IBM 最终意识到如果使用窄长方形作为孔洞,一张卡就可以放下更多的列了。每一列中孔洞的不同组合就可以表达不同的字符。像 029 型这样的拥有人性化设计的打孔机除了完成本质的打孔任务外,还会在打孔卡最上方打印出每一列所对应的字符。输入是数字就在对应的数字行上打孔。输入的是字母或符号就用一个在空间列的孔和一或俩个在数字列的孔的组合表示,例如字母 A 就用一个在第 12 空间行的空和一个数字 1 所在行的孔表示。这是一种顺序编码,在第一台打孔机被发明后,也叫 Hollerith 编码。这种编码只能表示相对较小的一套字符集,小写字母就没有包含在这套字符集中。如今一些聪明的工程师可能想知道为什么打卡不干脆使用二进制编码 —— 毕竟,有 12 行,你可以编码超过 4000 个字符。 使用 Hollerith 编码是因为它确保在单个列中出现不超过三个孔。这保留了卡的结构强度。二进制编码会带来太多的孔,会因为孔洞过于密集而断裂。 -最终,这些打孔卡都要被计算机读取和计算。 IBM 出售的 System/360 大型计算机的外设 IBM 2540 可以以每分钟 1000 张打孔卡的速度读取这些卡片。IBM 2540 使用电刷扫过每张打孔卡,电刷通过孔洞就可以接触到卡片后面的金属板完成一次读取。一旦读取完毕, System/360 大型计算机就会把每张打孔卡上的数据使用一种定长的 8 位编码保存,这种编码是扩展的二进制十数交换码Extended Binary Coded Decimal Interchange Code,简写为 EBCDIC 编码。它的源自于早期打孔卡所使用的 BCDIDC 编码,这一 6 位编码使用低 4 位表示数字行,高 2 位表示空间行。程序员们在打孔卡上编写玩程序后,会把卡片们交给计算机操作员,操作员们会把这些卡片放入 IBM 2540 ,再把打印结果交给程序员。那时的程序员大多都没有见过计算机长什么样。 +打孔卡也有不同。在 20 世纪 60 年代,80 列虽然是标准,但表达的方式不一定相同。基础打孔卡是无标注的,但用于 COBOL 编程的打孔卡会把最后的 8 列保留,供标识数保存使用。这一标识数可以在打孔卡被打乱 (例如一叠打孔卡掉在地上了) 后用于自动排序。此外,第 7 列被用于表示本张打孔卡上的是否与上一张打孔卡一起构成一条语句。也就是说当你真的对 80 字符的限制感到绝望的时候,还可以用两张卡甚至更多的卡拼接成一条长语句。用于 FORTRAN 编程的打孔卡和 COBOL 打孔卡类似,但是定义的列不同。大学里使用的打孔卡通常会由其计算机中心加上水印,其它的设计则会在如 [1976 年美国独立 200 周年][3] 的特殊场合才会加入。 -程序员们真正能见到的是很多打孔机。 029 型打孔机虽然不是计算机,但这并不意味着它不是一台复杂的机器。看看这个由密歇根大学University of Michigan在 1967 年制作的[教学视频][4],你就能更好的理解使用一台 029 型打孔机是什么情形了。我会尽可能在这里总结这段视频,但如果你不去亲自看看的话,你会错过许多惊奇和感叹。 +最终,这些打孔卡都要被计算机读取和计算。IBM 出售的 System/360 大型计算机的外设 IBM 2540 可以以每分钟 1000 张打孔卡的速度读取这些卡片[^2] 。IBM 2540 使用电刷扫过每张打孔卡,电刷通过孔洞就可以接触到卡片后面的金属板完成一次读取。一旦读取完毕,System/360 大型计算机就会把每张打孔卡上的数据使用一种定长的 8 位编码保存,这种编码是扩增二进式十进交换码Extended Binary Coded Decimal Interchange Code,简写为 EBCDIC 编码。它是一种二进制编码,可以追溯自早期打孔卡所使用的 BCDIDC 编码 —— 其 6 位编码使用低 4 位表示数字行,高 2 位表示空间行。程序员们在打孔卡上编写完程序后,会把卡片们交给计算机操作员,操作员们会把这些卡片放入 IBM 2540 ,再把打印结果交给程序员。那时的程序员大多都没有见过计算机长什么样。 + +程序员们真正能见到的是很多打孔机。029 型打孔机虽然不是计算机,但这并不意味着它不是一台复杂的机器。看看这个由密歇根大学University of Michigan计算机中心在 1967 年制作的[教学视频][4],你就能更好的理解使用一台 029 型打孔机是什么情形了。我会尽可能在这里总结这段视频,但如果你不去亲自看看的话,你会错过许多惊奇和感叹。 029 型打孔机的结构围绕着一个打孔卡穿过机器的 U 形轨道开始。使用打孔机时,右手边也就是 U 形轨道的右侧顶部是进卡卡槽hopper,使用前通常在里面放入一叠未使用的打孔卡。虽然 029 型打孔机主要使用 80 列打孔卡,但在需要的情况下也可以使用更小号的打孔卡。在打孔机的使用过程中,打孔卡离开轨道右上端的进卡卡槽,顺着 U 形轨道移动并最终进入左上端的出卡卡槽stacker。这一流程可以保证出卡卡槽中的打孔卡按打孔时的先后顺序排列。 -029 型打孔机的开关在桌面下膝盖高度的位置。在开机后,连按两次 “装入FEED” 键让机器自动将打孔卡从进卡卡槽中取出并移动到机器内。 U 形轨道的底部是打孔机的核心区域,它由三个部分组成:右侧是等待区,中间是打孔操作区,左侧是阅读区。连按两次 “装入” 键,机器就会把一张打孔卡装入打孔机的打孔操作区,另一张打孔卡进入等待区。在打孔操作区上方有一个列数指示器来显示当前打孔所在的列的位置。这时,每按下一个按键,机器就会在打孔卡对应的位置打孔并在卡片的顶部打印按键对应的字符,随后将打孔卡向左移动一列。如果一张卡片的 80 列全部被打上了数据,这张卡片会被打孔操作区自动释放并进入阅读区,同时,一张新的打孔卡会被装入打孔操作区。如果没有打完全部的 80 列,可以使用 “释放REL (for release)” 键完成上面的操作。 +029 型打孔机的开关在桌面下膝盖高度的位置。在开机后,连按两次 “装入FEED” 键让机器自动将打孔卡从进卡卡槽中取出并移动到机器内。 U 形轨道的底部是打孔机的核心区域,它由三个部分组成:右侧是等待区,中间是打孔操作区,左侧是阅读区。连按两次 “装入” 键,机器就会把一张打孔卡装入打孔机的打孔操作区,另一张打孔卡进入等待区。在打孔操作区上方有一个列数指示器来显示当前打孔所在的列的位置。这时,每按下一个按键,机器就会在打孔卡对应的位置打孔并在卡片的顶部打印按键对应的字符,随后将打孔卡向左移动一列。如果一张卡片的 80 列全部被打上了数据,这张卡片会被打孔操作区自动释放并进入阅读区,同时,一张新的打孔卡会被装入打孔操作区。如果没有打完全部的 80 列,可以使用 “释放REL” 键完成上面的操作。 -在打孔卡上打印对应的字符这一设计让人很容易分辨出错误。但就像密歇根大学的视频中警告的那样,打孔卡上修正一个错误可不像擦掉一个打印的字符然后再写上一个新的那样容易,因为计算机只会根据卡片上的孔来读取信息。因为被打出的孔不能被复原unpunched,所以并不能直接退回一列然后再打上一个新的字符。打出更多的孔也只能让这一列的组合变成一个无效字符。 IBM 029 型打孔机上虽然有一个可以让打孔卡回退一列的退格按键,但这个按键被放置在机器上而非在键盘上。这样的设计也许是为了阻止这个按键的使用,因为实际上很少有用户需要这个功能。 +在打孔卡上打印对应的字符这一设计让人很容易分辨出错误。但就像密歇根大学的视频中警告的那样,打孔卡上修正一个错误可不像擦掉一个打印的字符然后再写上一个新的那样容易,因为计算机只会根据卡片上的孔来读取信息。因为被打出的孔不能被复原unpunched,所以并不能直接退回一列然后再打上一个新的字符。打出更多的孔也只能让这一列的组合变成一个无效字符。IBM 029 型打孔机上虽然有一个可以让打孔卡回退一列的退格按键,但这个按键被放置在机器上而非在键盘上。这样的设计也许是为了阻止这个按键的使用,因为实际上很少有用户需要这个功能。 -实际上,只有废弃错误的打孔卡再在新的打孔卡上重新打孔这一种修正错误的方式。这就是阅读区的用武之处了。当你发现打孔卡上的第 68 列出错时,你需要在新的打孔卡上小心的给前 67 列打孔,然后给第 68 列打上正确的字母。另一种操作方式是把带有错误信息的打孔卡放在阅读区,同时在打孔操作区载入一张新的打孔卡,然后按下 “重复DUP (for duplicate)” 按键直到列数指示器显示 68 列。这时按下正确的字符来修正错误。阅读区和重复按键使得 029 型打孔机很容易复制打孔卡上的内容。当然,这一功能的使用可能有各种各样的原因,但改错是最常见的。 +实际上,只有废弃错误的打孔卡再在新的打孔卡上重新打孔这一种修正错误的方式。这就是阅读区的用武之处了。当你发现打孔卡上的第 68 列出错时,你需要在新的打孔卡上小心的给前 67 列重新打孔,然后给第 68 列打上正确的字母。另一种操作方式是把带有错误信息的打孔卡放在阅读区,同时在打孔操作区载入一张新的打孔卡,然后按下 “重复DUP” 按键直到列数指示器显示 68 列。这时按下正确的字符来修正错误。阅读区和重复按键使得 029 型打孔机很容易复制打孔卡上的内容。当然,这一功能的使用可能有各种各样的原因,但改错是最常见的。 + +(LCTT 译注:有一种说法是“补丁”这个用于对已经发布的软件进行修复的术语来源于对打孔纸带或打孔卡上打错的孔贴上补丁的做法。可能对于长长的一卷打孔纸带来说,由于个别字母的错误而整个废弃成本过高,会采用“补丁”的方式;而对于这种单张式的打孔卡来说,重新打印一张正确的更为方便。) “重复”按键允许 029 型打孔机的操作员手动调用重复的函数。但是 029 型打孔机还可以设置为自动重复。当用于记录数据而不是编程时,这项功能十分有效。举个例子,当用打孔卡来记录大学生的信息时,每张卡片上都需要输入学生的宿舍楼的名字,如果发现所输入信息的学生都在同一栋楼,就可以使用 029 型打孔机的自动重复功能来完成宿舍楼名称的填写。 -像这样的自动化操作可以通过打孔卡给 029 型打孔机编程控制。安装打孔卡的圆柱形装置drum就在 U 形轨道中间部分的右上角。通过使用 029 型在打孔卡上写下程序,然后把打孔卡的装入圆柱形装置,再将其安装到打孔机内后,就完成了一次给 029 型打孔机的编程任务。用户可以通过这种方式对打孔卡的每一列都按需要定义不同的自动化操作。029 型打孔机允许指定某些列重复上一张打孔卡相同位置的字符,这就是它能更快的输入学生信息的理由。它还允许指定某些列只能输入数字或者字母,指定特定的列为空或者到某一列时就直接跳过一整张打孔卡。这样的可编程特性使它在输入拥有固定格式的数据时效率很高。密歇根大学制作的[进阶教学视频][5]包括了给 029 型打孔机编程的过程,如果你已经掌握了它的基础操作,就快去看看吧。 +像这样的自动化操作可以通过程序鼓program drum编程到 029 型打孔机里面。程序鼓就安装在打孔操作区上方的 U 形轨道中间部分的右上角。通过在打孔卡上写下程序,然后把打孔卡装入程序鼓中,就完成了一次给 029 型打孔机的编程任务。用户可以通过这种方式对打孔卡的每一列都按需要定义不同的自动化操作。029 型打孔机允许指定某些列重复上一张打孔卡相同位置的字符,这就是它能更快的输入学生信息的理由。它还允许指定某些列只能输入数字或者字母,指定特定的列为空或者到某一列时就直接跳过一整张打孔卡。编程鼓使它在打孔特定列有特殊含义的固定模式卡片时很容易。密歇根大学制作的另一个[进阶教学视频][5]包括了给 029 型打孔机编程的过程,如果你已经掌握了它的基础操作,就快去看看吧。 这会儿,无论你是否看了密歇根大学制作的视频,都会感叹打孔机的操作之简便。虽然修正错误的过程很乏味,但除此之外,操作一台打孔机并不像想象的那样复杂。我甚至可以想象打孔卡之间的无缝切换让 COBOL 和 FORTRAN 程序员忘记了他们的程序是打在不同的打孔卡上而不是写在一个连续的文本文件内。另一方面,思考一下打孔机是如何影响编程语言的发展也是很有趣的,虽然它仅仅是一台输入设备。结构化编程最终会出现并鼓励程序员把整个代码块视为一个整体,但可以想象打孔卡程序员们强调每一行的作用且难以认同结构化编程的场景。同时你能够理解他们为什么不把代码块闭合所使用的括号放在单独的一行,只是因为这样会浪费打孔卡。 @@ -48,6 +51,9 @@ IBM 029 型打孔机在 1964 年作为 IBM 的 System/360 大型电脑的配件 喜欢吗?这里每两周都会发表一篇这样的文章。请在推特上关注我们 [@TwoBitHistory][7] 或者订阅我们的 [RSS][8],这样你就能在第一时间收到新文章的通知。 +[^1]: “IBM 29 Card Punch,” IBM Archives, accessed June 23, 2018, https://www-03.ibm.com/ibm/history/exhibits/vintage/vintage_4506VV4002.html. +[^2]: IBM, IBM 2540 Component Description and Operation Procedures (Rochester, MN: IBM Product Publications, 1965), September 06, 2009, accessed June 23, 2018, http://bitsavers.informatik.uni-stuttgart.de/pdf/ibm/25xx/A21-9033-1_2540_Card_Punch_Component_Description_1965.pdf. + -------------------------------------------------------------------------------- via: https://twobithistory.org/2018/06/23/ibm-029-card-punch.html @@ -55,7 +61,7 @@ via: https://twobithistory.org/2018/06/23/ibm-029-card-punch.html 作者:[Two-Bit History][a] 选题:[lujun9972][b] 译者:[wwhio](https://github.com/wwhio) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 441afeddb9a87fdf9b6dbf9d24e3fc9e3aefcd03 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 25 Dec 2018 14:48:32 +0800 Subject: [PATCH 062/322] PUB:20180623 The IBM 029 Card Punch.md @wwhio https://linux.cn/article-10382-1.html --- {translated/talk => published}/20180623 The IBM 029 Card Punch.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/20180623 The IBM 029 Card Punch.md (100%) diff --git a/translated/talk/20180623 The IBM 029 Card Punch.md b/published/20180623 The IBM 029 Card Punch.md similarity index 100% rename from translated/talk/20180623 The IBM 029 Card Punch.md rename to published/20180623 The IBM 029 Card Punch.md From 4948a9861a515121340154a44b4b5bf65f3a8cee Mon Sep 17 00:00:00 2001 From: amwps290 Date: Tue, 25 Dec 2018 21:10:16 +0800 Subject: [PATCH 063/322] Delete 20181217 Take a swim at your Linux terminal with asciiquarium.md --- ...t your Linux terminal with asciiquarium.md | 48 ------------------- 1 file changed, 48 deletions(-) delete mode 100644 sources/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md diff --git a/sources/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md b/sources/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md deleted file mode 100644 index 63741b5ccd..0000000000 --- a/sources/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md +++ /dev/null @@ -1,48 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( amwps290) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Take a swim at your Linux terminal with asciiquarium) -[#]: via: (https://opensource.com/article/18/12/linux-toy-asciiquarium) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) - -Take a swim at your Linux terminal with asciiquarium -====== -Darling it's better, when your command line is wetter, thanks to ASCII. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-asciiquarium.png?itok=ZhJ9P2Ft) - -We're now nearing the end of our 24-day-long Linux command-line toys advent calendar. Just one week left after today! If this is your first visit to the series, you might be asking yourself what a command-line toy even is. We’re figuring that out as we go, but generally, it could be a game, or any simple diversion that helps you have fun at the terminal. - -Some of you will have seen various selections from our calendar before, but we hope there’s at least one new thing for everyone. - -Today's selection is a fishy one. Say hello to **asciiquarium** , an undersea adventure for your terminal. I found **asciiquarium** in my Fedora repositories, so installing it was as simple as: - -``` -$ sudo dnf install asciiquarium -``` - -If you're running a different distribution, chances are it's packaged for you too. Just run **asciiquarium** at your terminal to feel happy as a clam. The project has been translated outside of the terminal as well, with screensavers of all of the aquatic pals being made for several non-Linux operating systems, and even an Android live wallpaper version is floating around out there. - -Visit the **asciiquarium** [homepage][1] for more information or to download the Perl source code. The project is open source under a GPL version 2 license. And if you want to learn more about how open source, open data, and open science are making a difference in the actual oceans, take a moment to go learn about the [Ocean Health Index][2]. -![](https://opensource.com/sites/default/files/uploads/linux-toy-asciiquarium-animated.gif) -Do you have a favorite command-line toy that you think I ought to profile? We're running out of time, but I'd still love to hear your suggestions. Let me know in the comments below, and I'll check it out. And let me know what you thought of today's amusement. - -Be sure to check out yesterday's toy, [Schedule a visit with the Emacs psychiatrist][3], and come back tomorrow for another! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-asciiquarium - -作者:[Jason Baker][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/jason-baker -[b]: https://github.com/lujun9972 -[1]: https://robobunny.com/projects/asciiquarium/html/ -[2]: https://opensource.com/article/18/12/protecting-world-oceans -[3]: https://opensource.com/article/18/12/linux-toy-eliza From b7feec1a6143dffedd57a04d4dbe7441b3dfe9f0 Mon Sep 17 00:00:00 2001 From: amwps290 Date: Tue, 25 Dec 2018 21:13:26 +0800 Subject: [PATCH 064/322] Create 20181217 Take a swim at your Linux terminal with asciiquarium.md --- ...t your Linux terminal with asciiquarium.md | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 translated/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md diff --git a/translated/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md b/translated/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md new file mode 100644 index 0000000000..04ba82841c --- /dev/null +++ b/translated/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md @@ -0,0 +1,51 @@ +[#]: collector: "lujun9972" +[#]: translator: " amwps290" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "Take a swim at your Linux terminal with asciiquarium" +[#]: via: "https://opensource.com/article/18/12/linux-toy-asciiquarium" +[#]: author: "Jason Baker https://opensource.com/users/jason-baker" + +# 使用 asciiquarium 在你的终端里探索海洋的秘密 + +亲爱的,当您的命令行变得更湿润的时候会更好。这多亏了 ASCII。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-asciiquarium.png?itok=ZhJ9P2Ft) + +现在,我们即将数完长达 24 天的 Linux 命令行玩具倒数日历。离今天只剩一周了!如果这是您第一次访问本系列文章,那么您可能会问自己什么是命令行玩具。我们一边走,一边说,但一般来说,这可能是一个游戏,或者可以帮助你在终端玩得开心的任何简单的娱乐活动。 + +你们其中的一些人可能已经在以前的系列文章中看到了各种各样的命令行玩具。但是,我们希望每个人都能够获得一个新玩具。 + +今天的玩具有一点鱼的味道。先和 **asciiquarium** 打个招呼,一个在你终端里海底冒险的玩具。我是在我的 Fedora 仓库里发现 asciiquarium 的,因此安装它非常容易: + +``` +$ sudo dnf install asciiquarium +``` + +如果您正在运行不同的发行版,那么它也可能已经为您打包。 只需在您的终端中运行 **asciiquarium** 即可感受到蛤蜊的快乐。 该项目也在终端之外进行了“翻译”,所有水族伙伴的屏保都是为非 Linux 操作系统制作的,甚至还有一个 Android 动态壁纸版本。 + +访问 **asciiquarium** [主页][1]了解更多信息或下载 Perl 源代码。 该项目是 GPL 第 2 版许可证下的开源项目。 如果你想更多地了解开源,开放数据和开放科学如何在实际的海洋中发挥作用,请花点时间去了解[海洋健康指数][2]。 + +![](https://opensource.com/sites/default/files/uploads/linux-toy-asciiquarium-animated.gif) + + +你觉得我应该介绍一下你最喜欢的命令行玩具吗?时间不多了,但我还是想听听你的建议。请在下面的评论中告诉我,我会查阅的。让我知道你对今天的娱乐有什么看法。 + +一定要看看昨天的玩具,[安排一次与 Emacs 精神病医生的访问][3],明天再来看另一个玩具! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-asciiquarium + +作者:[Jason Baker][a] +选题:[lujun9972][b] +译者:[amwps290](https://github.com/amwps290) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jason-baker +[b]: https://github.com/lujun9972 +[1]: https://robobunny.com/projects/asciiquarium/html/ +[2]: https://opensource.com/article/18/12/protecting-world-oceans +[3]: https://opensource.com/article/18/12/linux-toy-eliza From 75ad593185d633f2465bf9d65dd2512d0494154c Mon Sep 17 00:00:00 2001 From: amwps290 Date: Tue, 25 Dec 2018 21:49:24 +0800 Subject: [PATCH 065/322] Update 20171114 Finding Files with mlocate- Part 2.md --- sources/tech/20171114 Finding Files with mlocate- Part 2.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20171114 Finding Files with mlocate- Part 2.md b/sources/tech/20171114 Finding Files with mlocate- Part 2.md index 19c546a917..7a99b3793a 100644 --- a/sources/tech/20171114 Finding Files with mlocate- Part 2.md +++ b/sources/tech/20171114 Finding Files with mlocate- Part 2.md @@ -1,3 +1,4 @@ +translating by amwps290 Finding Files with mlocate: Part 2 ====== From ca79380c77093ceef4ad9c53feaa6e71745ecd7c Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 25 Dec 2018 22:01:13 +0800 Subject: [PATCH 066/322] zhs852 is translating --- .../tech/20181213 Relax by the fire at your Linux terminal.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sources/tech/20181213 Relax by the fire at your Linux terminal.md b/sources/tech/20181213 Relax by the fire at your Linux terminal.md index f9a53fc4c4..7eae421047 100644 --- a/sources/tech/20181213 Relax by the fire at your Linux terminal.md +++ b/sources/tech/20181213 Relax by the fire at your Linux terminal.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (zhs852) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -7,6 +7,8 @@ [#]: via: (https://opensource.com/article/18/12/linux-toy-aafire) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) +zhs852 is translating. + Relax by the fire at your Linux terminal ====== Chestnuts roasting on an open command prompt? Why not, with this fun Linux toy. From 5f03c1fc10ecd3f1ae32aa5add57034fe44f2a39 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 25 Dec 2018 22:17:47 +0800 Subject: [PATCH 067/322] PRF:20171012 7 Best eBook Readers for Linux.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @zjon 翻译后,应该再次阅读以保证通顺。 --- ...20171012 7 Best eBook Readers for Linux.md | 102 +++++++++--------- 1 file changed, 54 insertions(+), 48 deletions(-) diff --git a/translated/tech/20171012 7 Best eBook Readers for Linux.md b/translated/tech/20171012 7 Best eBook Readers for Linux.md index 520c9c4533..346eed6bb6 100644 --- a/translated/tech/20171012 7 Best eBook Readers for Linux.md +++ b/translated/tech/20171012 7 Best eBook Readers for Linux.md @@ -1,63 +1,65 @@ 7 个最佳 Linux 电子书阅读器 ====== -**摘要:** 文章中我们涉及一些 Linux 最佳电子书阅读器。这些应用提供更佳阅读体验甚至会管理你的电子书。 + +**摘要:** 本文中我们涉及一些 Linux 最佳电子书阅读器。这些应用提供更佳的阅读体验甚至可以管理你的电子书。 ![最佳 Linux 电子书阅读器][1] -最近,随着人们发现在手持设备,Kindle 或者 PC 上阅读更佳舒适,对电子图书的需求有所增加。谈到 Linux 用户,有各种电子书应用满足你阅读和整理电子书的需求。 +最近,随着人们发现在手持设备、Kindle 或者 PC 上阅读更加舒适,对电子图书的需求有所增加。至于 Linux 用户,也有各种电子书应用满足你阅读和整理电子书的需求。 -在本文中,我们选出了七个最佳 Linux 电子书阅读器。这些电子书阅读器最适合 pdf,epubs 和其他电子书格式。 +在本文中,我们选出了七个最佳 Linux 电子书阅读器。这些电子书阅读器最适合 pdf、epub 和其他电子书格式。 -## 最佳 Linux 电子书阅读器 - -我提供 Ubuntu 安装说明,因为我现在使用。如果你使用[非 Ubuntu 发行版][2],你能在你的发行版软件仓库中找到大多数这些电子书应用。 +我提供的是 Ubuntu 安装说明,因为我现在使用它。如果你使用的是[非 Ubuntu 发行版][2],你能在你的发行版软件仓库中找到大多数这些电子书应用。 ### 1. Calibre -[Calibre][3] 是 Linux 最受欢迎的电子书应用。老实说,这不仅仅是一个简单的电子书阅读器。它是一个完整的电子书解决方案。你甚至能[通过 Calibre 创建私人电子][4] +[Calibre][3] 是 Linux 最受欢迎的电子书应用。老实说,这不仅仅是一个简单的电子书阅读器。它是一个完整的电子书解决方案。你甚至能[通过 Calibre 创建专业的电子书][4]。 -通过强大的电子书管理和易用的接口,它具有创建和编辑电子书。Calibre 支持多种格式和与其他电子书阅读器同步。它也可以让你轻松转换一种电子书格式到另一种。 +通过强大的电子书管理和易用的界面,它提供了创建和编辑电子书的功能。Calibre 支持多种格式和与其它电子书阅读器同步。它也可以让你轻松转换一种电子书格式到另一种。 -Calibre 最大的缺点是,资源上太沉重,让它成为一个艰难的选择作为一个独立的电子阅读器。 +Calibre 最大的缺点是,资源消耗太多,因此作为一个独立的电子阅读器来说是一个艰难的选择。 ![Calibre][5] #### 特性 - * 管理电子书:Calibre 通过管理云数据允许存储和分组电子书。你能下载一本电子书的元数据从各种来源或创建和编辑现有的字段。 - * 支持所有主流电子书格式: Calibre 支持所有主流电子书格式并兼容多种电子阅读器。 - * 文件转换: 在转换时,你能通过改变电子书风格,创建内容表和调整边距的选项来转换任何一种电子书格式到另一种。你也能转换个人文档为电子书。 + * 管理电子书:Calibre 通过管理元数据来排序和分组电子书。你能从各种来源下载一本电子书的元数据或创建和编辑现有的字段。 + * 支持所有主流电子书格式:Calibre 支持所有主流电子书格式并兼容多种电子阅读器。 + * 文件转换:在转换时,你能通过改变电子书风格,创建内容表和调整边距的选项来转换任何一种电子书格式到另一种。你也能转换个人文档为电子书。 * 从 web 下载杂志期刊:Calibre 能从各种新闻源或者通过 RSS 订阅源传递故事。 - * 分享和备份你的电子图书馆:它提供了一个选项,托管你电子书集合到它的服务端,从而你能与好友共享或用任何设备从任何地方访问。备份和导入/导出特性允许你保证你的收藏安全和方便携带。 + * 分享和备份你的电子图书馆:它提供了一个选项,可以托管你电子书集合到它的服务端,从而你能与好友共享或用任何设备从任何地方访问。备份和导入/导出特性可以确保你的收藏安全和方便携带。 #### 安装 你能在主流 Linux 发行版的软件库中找到它。对于 Ubuntu,在软件中心搜索它或者使用下面的命令: -`sudo apt-get install calibre` +``` +sudo apt-get install calibre +``` ### 2. FBReader ![FBReader: Linux 电子书阅读器][6] -[FBReader][7] 是一个开源的轻量级多平台电子书阅读器,它支持多种格式,比如 ePub,fb2,mobi,rtf,html 等。它包含一些允许访问的流行网络电子图书馆,那里你能免费或付费下载电子书。 +[FBReader][7] 是一个开源的轻量级多平台电子书阅读器,它支持多种格式,比如 ePub、fb2、mobi、rtf、html 等。它包括了一些可以访问的流行网络电子图书馆,那里你能免费或付费下载电子书。 #### 特性 - * 支持多种文件格式和设备比如 Android,iOS,Windows,Mac 和更多。 - * 同步书籍收藏,阅读位置和书签。 - * 在线管理你图书馆中从你的 Linux 桌面添加到所有设备的任何书。 - * 支持 Web 浏览器允许你的存储集。 - * 支持 Google Drive 做书籍的存储和通过作者,系列或其他属性整理书籍。 + * 支持多种文件格式和设备比如 Android、iOS、Windows、Mac 和更多。 + * 同步书集、阅读位置和书签。 + * 在线管理你图书馆,可以从你的 Linux 桌面添加任何书到所有设备。 + * 支持 Web 浏览器访问你的书集。 + * 支持将书籍存储在 Google Drive ,可以通过作者,系列或其他属性整理书籍。 #### 安装 -你能从官方库或者在终端中输入一下命令安装 FBReader 电子阅读器。 +你能从官方库或者在终端中输入以下命令安装 FBReader 电子阅读器。 + ``` sudo apt-get install fbreader ``` -或者你能从[这里][8]抓取一个以 .deb 包并在你的基于 Debian 发行版的系统上安装它。 +或者你能从[这里][8]抓取一个以 .deb 包,并在你的基于 Debian 发行版的系统上安装它。 ### 3. Okular @@ -67,29 +69,30 @@ sudo apt-get install fbreader #### 特性 - * Okular 支持多种文档格式像 PDF,Postscript,DjVu,DHM,XPS,ePub 和其他。 - * 支持在 PDF 文档中评论,高亮和绘制不通的形状等。 - * 无需修改原始 PDF 文件分别保存这些更改。 - * 电子书中的文本能被提取到一个文本文件,这个内置文本阅读服务叫 Jovie。 + * Okular 支持多种文档格式像 PDF、Postscript、DjVu、CHM、XPS、ePub 和其他。 + * 支持在 PDF 文档中评论、高亮和绘制不同的形状等。 + * 无需修改原始 PDF 文件,分别保存上述这些更改。 + * 电子书中的文本能被提取到一个文本文件,并且有个名为 Jovie 的内置文本阅读服务。 -备注:检查应用的时候,我发现这个应用在 Ubuntu 和它的衍生系统不支持 ePub 文件格式。其他发行版用户仍然可以发挥它全部的潜力。 +备注:查看这个应用的时候,我发现这个应用在 Ubuntu 和它的衍生系统中不支持 ePub 文件格式。其他发行版用户仍然可以发挥它全部的潜力。 #### 安装 Ubuntu 用户可以在终端中键入下面的命令来安装它: + ``` sudo apt-get install okular ``` ### 4. Lucidor -Lucidor 是一个易用的支持 epub 文件格式和在 OPDS 格式中编目的电子阅读器。它也具有电子书集合在本地书柜里,搜索和下载互联网和 web 订阅和网页转换成电子书的功能。 +Lucidor 是一个易用的、支持 epub 文件格式和在 OPDS 格式中编目的电子阅读器。它也具有在本地书架里组织电子书集、从互联网搜索和下载,和将 Web 订阅和网页转换成电子书的功能。 -Lucidor 是 XULRunner 应用程序,它向您展示了具有类火狐的选项卡式布局,和存储数据和配置时的展现。他是列表中最简单的电子阅读器,包括诸如文本说明和滚动选项之类的配置。 +Lucidor 是 XULRunner 应用程序,它向您展示了具有类似火狐的选项卡式布局,和存储数据和配置时的行为。它是这个列表中最简单的电子阅读器,包括诸如文本说明和滚动选项之类的配置。 ![lucidor][11] -你可以通过选择单词并右击 > 查找单词来查找 Wiktionary.org 的定义。它也包含 web 订阅或 web 页面作为电子书的选项。 +你可以通过选择单词并右击“查找单词”来查找该单词在 Wiktionary.org 的定义。它也包含 web 订阅或 web 页面作为电子书的选项。 你能从[这里][12]下载和安装 deb 或者 RPM 包。 @@ -97,9 +100,10 @@ Lucidor 是 XULRunner 应用程序,它向您展示了具有类火狐的选项 ![Bookworm Linux 电子阅读器][13] -Bookworm 是另一个支持多种文件格式诸如 epub, pdf, mobi, cbr and cbz 的免费开源的电子阅读器。我写了一篇关于 Bookworm 应用程序的特性和安装的专题文章,到这里阅读: [Bookworm: 一个简单而强大的 Linux 电子阅读器][14] +Bookworm 是另一个支持多种文件格式诸如 epub、pdf、mobi、cbr 和 cbz 的自由开源的电子阅读器。我写了一篇关于 Bookworm 应用程序的特性和安装的专题文章,到这里阅读:[Bookworm:一个简单而强大的 Linux 电子阅读器][14] #### 安装 + ``` sudo apt-add-repository ppa:bookworm-team/bookworm sudo apt-get update @@ -108,15 +112,16 @@ sudo apt-get install bookworm ### 6. Easy Ebook Viewer -[Easy Ebook Viewer][15] 是另外一个用于读取 ePub 文件的很棒的 GTK python 应用.具有基本章节导航、从上次阅读位置继续、从其他电子书文件格式导入、章节跳转等功能,Easy Ebook Viewer 是一个简单而简约的 ePub 阅读器. +[Easy Ebook Viewer][15] 是又一个用于读取 ePub 文件的很棒的 GTK Python 应用。具有基本章节导航、从上次阅读位置继续、从其他电子书文件格式导入、章节跳转等功能,Easy Ebook Viewer 是一个简单而简约的 ePub 阅读器. ![Easy-Ebook-Viewer][16] -这个应用仍然处于初始阶段,只支持ePub文件。 +这个应用仍然处于初始阶段,只支持 ePub 文件。 #### 安装 -你可以从 [github][17] 下载源代码和自己编译以及依赖项来安装 Easy Ebook Viewer。或者,以下终端命令将执行完全相同的工作。 +你可以从 [GitHub][17] 下载源代码,并自己编译它及依赖项来安装 Easy Ebook Viewer。或者,以下终端命令将执行完全相同的工作。 + ``` sudo apt install git gir1.2-webkit-3.0 libwebkitgtk-3.0-0 gir1.2-gtk-3.0 python3-gi git clone https://github.com/michaldaniel/Ebook-Viewer.git @@ -124,19 +129,20 @@ cd Ebook-Viewer/ sudo make install ``` -成功完成上述步骤后,你可以从Dash启动它。 +成功完成上述步骤后,你可以从 Dash 启动它。 ### 7. Buka -Buka 主要是一个具有简单而清爽的用户界面的电子书管理器。它目前支持 PDF 格式,旨在帮助用户更加关注内容。拥有 pdf 阅读器的所有基本特性,Buka 允许你通过箭头键导航,具有缩放选项,并且能并排查看 2 页。 +Buka 主要是一个具有简单而清爽的用户界面的电子书管理器。它目前支持 PDF 格式,旨在帮助用户更加关注内容。拥有 PDF 阅读器的所有基本特性,Buka 允许你通过箭头键导航,具有缩放选项,并且能并排查看两页。 -你可以创建单独的 PDF 文件列表并轻松地在它们之间切换。Buka也提供了一个内置翻译工具,但是你需要有效的互联网连接来使用这个特性。 +你可以创建单独的 PDF 文件列表并轻松地在它们之间切换。Buka 也提供了一个内置翻译工具,但是你需要有效的互联网连接来使用这个特性。 ![Buka][19] #### 安装 -你能从[官方下载页面][20]下载一个 AppImage。如果你不知道,请阅读[如何在 Linux 下使用 AppImage][21]。或者,你可以通过命令行安装它: +你能从[官方下载页面][20]下载一个 AppImage。如果你不知道如何做,请阅读[如何在 Linux 下使用 AppImage][21]。或者,你可以通过命令行安装它: + ``` sudo snap install buka ``` @@ -153,30 +159,30 @@ sudo snap install buka via: https://itsfoss.com/best-ebook-readers-linux/ 作者:[Ambarish Kumar][a] -译者:[zjon](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[zjon](https://github.com/zjon) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]:https://itsfoss.com/author/ambarish/ -[1]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/10/best-ebook-readers-linux-800x450.png +[1]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2017/10/best-ebook-readers-linux.png [2]:https://itsfoss.com/non-ubuntu-beginner-linux/ [3]:https://www.calibre-ebook.com [4]:https://itsfoss.com/create-ebook-calibre-linux/ -[5]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Calibre-800x603.jpeg -[6]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/10/fbreader-800x624.jpeg +[5]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2017/09/Calibre-800x603.jpeg +[6]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2017/10/fbreader-800x624.jpeg [7]:https://fbreader.org [8]:https://fbreader.org/content/fbreader-beta-linux-desktop [9]:https://okular.kde.org/ -[10]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Okular-800x435.jpg -[11]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/lucidor-2.png +[10]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2017/09/Okular-800x435.jpg +[11]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2017/09/lucidor-2.png [12]:http://lucidor.org/lucidor/download.php -[13]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/08/bookworm-ebook-reader-linux-800x450.jpeg +[13]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2017/08/bookworm-ebook-reader-linux-800x450.jpeg [14]:https://itsfoss.com/bookworm-ebook-reader-linux/ [15]:https://github.com/michaldaniel/Ebook-Viewer -[16]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Easy-Ebook-Viewer.jpg +[16]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2017/09/Easy-Ebook-Viewer.jpg [17]:https://github.com/michaldaniel/Ebook-Viewer.git [18]:https://github.com/oguzhaninan/Buka -[19]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2017/09/Buka2-800x555.png +[19]:https://i0.wp.com/itsfoss.com/wp-content/uploads/2017/09/Buka2-800x555.png [20]:https://github.com/oguzhaninan/Buka/releases [21]:https://itsfoss.com/use-appimage-linux/ From 7359ce880cbe791ae06b95f4d0d1ac78d0417945 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 25 Dec 2018 22:20:12 +0800 Subject: [PATCH 068/322] PUB:20171012 7 Best eBook Readers for Linux.md @zjon https://linux.cn/article-10383-1.html --- .../tech => published}/20171012 7 Best eBook Readers for Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20171012 7 Best eBook Readers for Linux.md (100%) diff --git a/translated/tech/20171012 7 Best eBook Readers for Linux.md b/published/20171012 7 Best eBook Readers for Linux.md similarity index 100% rename from translated/tech/20171012 7 Best eBook Readers for Linux.md rename to published/20171012 7 Best eBook Readers for Linux.md From 2244788472742c5dd92fd8836da7e68cc96cbe19 Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Tue, 25 Dec 2018 22:59:31 +0800 Subject: [PATCH 069/322] Translated by qhwdw --- ...1 How to Build a Netboot Server, Part 3.md | 72 +++++++++---------- 1 file changed, 36 insertions(+), 36 deletions(-) rename {sources => translated}/tech/20181221 How to Build a Netboot Server, Part 3.md (59%) diff --git a/sources/tech/20181221 How to Build a Netboot Server, Part 3.md b/translated/tech/20181221 How to Build a Netboot Server, Part 3.md similarity index 59% rename from sources/tech/20181221 How to Build a Netboot Server, Part 3.md rename to translated/tech/20181221 How to Build a Netboot Server, Part 3.md index 08c1a8a12e..e174248f62 100644 --- a/sources/tech/20181221 How to Build a Netboot Server, Part 3.md +++ b/translated/tech/20181221 How to Build a Netboot Server, Part 3.md @@ -1,22 +1,22 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: () +[#]: publisher: () +[#]: url: () [#]: subject: (How to Build a Netboot Server, Part 3) [#]: via: (https://fedoramagazine.org/how-to-build-a-netboot-server-part-3/) [#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/) -How to Build a Netboot Server, Part 3 +如何构建一台网络引导服务器(第三部分) ====== ![](https://fedoramagazine.org/wp-content/uploads/2018/12/netboot3-816x345.jpg) -The [How to Build a Netboot Server, Part 1][1] article provided a minimal [iPXE][2] boot script for your netboot image. Many users probably have a local operating system that they want to use in addition to the netboot image. But switching bootloaders using the typical workstation’s BIOS can be cumbersome. This part of the series shows how to set up some more complex iPXE configurations. These allow the end user to easily choose which operating system they want to boot. They also let the system administrator manage the boot menus from a central server. +在 [如何构建一台网络引导服务器(第一部分)][1] 的文章中,我们提供了一个极简的 [iPXE][2] 引导脚本来引导你的网络引导镜像。许多用户除了使用网络引导镜像外,可能在机器本地也有一个操作系统。但是使用常见的工作站的 BIOS 去切换引导加载器是很笨拙的。在本系列文件的第三部分,我们将向你展示如何设置一个更复杂的 iPXE 配置。它将允许终端用户以更容易的方式去选择引导哪个操作系统。它也可以配置为让系统管理员从一台中央服务器来统一管理引导菜单。 -### An interactive iPXE boot menu +### 一个交互式 iPXE 引导菜单 -The commands below redefine the netboot image’s boot.cfg as an interactive iPXE boot menu with a 5 second countdown timer: +下面这些命令重定义了网络引导镜像的 boot.cfg 来作为一个交互式的 iPXE 引导菜单,并使用了一个 5 秒倒计时的定时器: ``` $ MY_FVER=29 @@ -59,32 +59,33 @@ boot || goto failed END ``` -The above menu has five sections: +上述菜单有五个节: - * **menu** defines the actual menu that will be shown on the screen. - * **failed** notifies the user that something went wrong and drops the user to a shell so they can troubleshot the problem. - * **shell** provides an interactive command prompt. You can reach it either by pressing the **Esc** key while at the boot menu or if the “boot” command returns with a failure code. - * **lcl** contains a single command that tells iPXE to exit and return control back to the BIOS. Whatever you want to boot by default (e.g. the workstation’s local hard drive) **must** be listed as the next boot item right after iPXE in your workstation’s BIOS. - * **f29** contains the same netboot code used earlier but with the final exit replaced with goto failed. + * **menu** 定义了显示在屏幕上的实际菜单内容。 + * **failed** 提示用户发生了错误,并将用户带到 shell 以错误错误。 + * **shell** 提供了交互式命令提示符。你可以在引导菜单出现时按下 **Esc** 键进入,或者是 + “boot” 命令失败时也会进入到命令提示符。 + * **lcl** 包含一个提供给 iPXE 退出的简单命令,以及返还控制权给 BIOS。在 iPXE 之后,无论你希望缺省引导的设备(即:工作站的本地硬件)是什么,都必须在你的工作站的 BIOS 中正确地作为下一个引导设备列出来。 + * **f29** 包含前面文章提到同一个网络引导代码,但使用最终的退出代码来替换掉 goto failed。 -Copy the updated boot.cfg from your $HOME/esp/linux directory out to the ESPs of all your client systems. If all goes well, you should see results similar to the image below: +从你的 `$HOME/esp/linux` 目录中复制更新后的 boot.cfg 到所有客户端系统的 ESP 中。如果一切顺利,你应该会看到类似下面图片的结果: ![][3] -### A server hosted boot menu +### 一个服务器托管的引导菜单 -Another feature you can add to the netboot server is the ability to manage all the client boot menus from one central location. This feature can be especially useful when rolling out a new version of the OS. It lets you perform a sort of [atomic transaction][4] to switch all clients over to the new OS after you’ve copied the new kernel and initramfs out to the ESPs of all the clients. +你可以添加到网络引导服务器的另一个特性是,能够从一台中央位置去管理所有客户端的引导菜单。这个特性尤其适用于批量安装(升级)一个新版本的操作系统。在你将新内核和新的 initramfs 复制到所有客户端的 ESP 之后,这个特性可以让你执行一种 [原子事务][4] 去切换所有客户端到新操作系统。 -Install Mojolicious: +安装 Mojolicious: ``` $ sudo -i # dnf install -y perl-Mojolicious ``` -Define the “bootmenu” app: +定义 “bootmenu” 应用程序: ``` # mkdir /opt/bootmenu @@ -102,7 +103,7 @@ END # chmod 755 /opt/bootmenu/bootmenu.pl ``` -Define the configuration file for the bootmenu app: +为 “bootmenu” 应用程序定义配置文件: ``` # cat << END > /opt/bootmenu/bootmenu.conf @@ -115,16 +116,16 @@ Define the configuration file for the bootmenu app: END ``` -This is an extremely simple Mojolicious application that listens on port 80 and only answers to /menu requests. If you want a quick introduction to what Mojolicious can do, run man Mojolicious::Guides::Growing to view the manual. Use the **Q** key to quit the manual. +这是一个非常简单的 Mojolicious 应用程序,它监听 80 端口,并且只回复到 /menu 的请求。如果你想快速了解 Mojolicious 能做什么,运行 `man Mojolicious::Guides::Growing` 去查看手册。按 **Q** 键退出手册。 -Move boot.cfg over to our netboot app as a template named menu.html.ep: +将 boot.cfg 移到我们的网络引导应用程序中作为一个名为 menu.html.ep 的模板: ``` # mkdir /opt/bootmenu/templates # mv $HOME/esp/linux/boot.cfg /opt/bootmenu/templates/menu.html.ep ``` -Define a systemd service to manage the bootmenu app: +定义一个 systemd 服务去管理引导菜单应用程序: ``` # cat << END > /etc/systemd/system/bootmenu.service @@ -147,7 +148,7 @@ WantedBy=multi-user.target END ``` -Add an exception for the HTTP service to the local firewall and start the bootmenu service: +在本地防火墙中为 HTTP 服务添加一个例外规则,并启动 bootmenu 服务: ``` # firewall-cmd --add-service http @@ -156,7 +157,7 @@ Add an exception for the HTTP service to the local firewall and start the bootme # systemctl start bootmenu.service ``` -Test it with wget: +用 wget 测试它: ``` $ sudo dnf install -y wget @@ -164,7 +165,7 @@ $ MY_BOOTMENU_SERVER=server-01.example.edu $ wget -q -O - http://$MY_BOOTMENU_SERVER/menu ``` -The above command should output something similar to the following: +以上的命令应该会输出类似下面的内容: ``` #!ipxe @@ -198,9 +199,9 @@ initrd --name initrd.img ${prefix}/initramfs-4.19.4-300.fc29.x86_64.img boot || goto failed ``` -Now that the boot menu server is working, rebuild the ipxe.efi bootloader with an init script that points to it. +现在,引导菜单服务器已经正常工作了,重新构建 ipxe.efi 引导加载器,使用一个 init 脚本指向它。 -First, update the init.ipxe script created in part one of this series: +第一步,先更新我们在本系列文章的第一部分中创建的 init.ipxe 脚本: ``` $ MY_BOOTMENU_SERVER=server-01.example.edu @@ -213,7 +214,7 @@ chain http://$MY_BOOTMENU_SERVER/menu || exit END ``` -Now, rebuild the boot loader: +现在,重新构建引导加载器: ``` $ cd $HOME/ipxe/src @@ -221,23 +222,23 @@ $ make clean $ make bin-x86_64-efi/ipxe.efi EMBED=../init.ipxe ``` -Copy the updated bootloader to your ESP: +将更新后的引导加载器复制到你的 ESP 中: ``` $ cp $HOME/ipxe/src/bin-x86_64-efi/ipxe.efi $HOME/esp/efi/boot/bootx64.efi ``` -After you’ve copied the updated bootloader to all your clients, you can make future updates to the boot menu simply by editing /opt/bootmenu/templates/menu.html.ep and running: +将更新后的引导加载器复制到所有的客户端中之后,以后更新引导菜单只需要简单地编辑 `/opt/bootmenu/templates/menu.html.ep` 文件,然后再运行如下命令: ``` $ sudo systemctl restart bootmenu.service ``` -### Making further changes +### 做一步的改变 -If the boot menu server is working properly, you’ll longer need the the boot.cfg file on your client systems. +如果引导菜单服务器工作正常,在你的客户端系统上的 boot.cfg 文件将更长。 -For example, re-add the Fedora 28 image to the boot menu: +比如,重新添加 Fedora 28 镜像到引导菜单中: ``` $ sudo -i @@ -259,18 +260,17 @@ END # systemctl restart bootmenu.service ``` -If all goes well, your clients should see results similar to the image below the next time they boot: +如果一切顺利,你的客户端下次引导时,应该看到如下图所示的结果: ![][5] - -------------------------------------------------------------------------------- via: https://fedoramagazine.org/how-to-build-a-netboot-server-part-3/ 作者:[Gregory Bartholomew][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[qhwdw](https://github.com/qhwdw) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 2d43837b186966010e7b4ea567c1dd2c07d7bec4 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 25 Dec 2018 23:33:33 +0800 Subject: [PATCH 070/322] Translated --- ...elax by the fire at your Linux terminal.md | 59 ------------------- ...elax by the fire at your Linux terminal.md | 59 +++++++++++++++++++ 2 files changed, 59 insertions(+), 59 deletions(-) delete mode 100644 sources/tech/20181213 Relax by the fire at your Linux terminal.md create mode 100644 translated/tech/20181213 Relax by the fire at your Linux terminal.md diff --git a/sources/tech/20181213 Relax by the fire at your Linux terminal.md b/sources/tech/20181213 Relax by the fire at your Linux terminal.md deleted file mode 100644 index 7eae421047..0000000000 --- a/sources/tech/20181213 Relax by the fire at your Linux terminal.md +++ /dev/null @@ -1,59 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (zhs852) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Relax by the fire at your Linux terminal) -[#]: via: (https://opensource.com/article/18/12/linux-toy-aafire) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) - -zhs852 is translating. - -Relax by the fire at your Linux terminal -====== -Chestnuts roasting on an open command prompt? Why not, with this fun Linux toy. - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-aafire.png?itok=pAttiVvG) - -Welcome back. Here we are, just past the halfway mark at day 13 of our 24 days of Linux command-line toys. If this is your first visit to the series, see the link to the previous article at the bottom of this one, and take a look back to learn what it's all about. In short, our command-line toys are anything that's a fun diversion at the terminal. - -Maybe some are familiar, and some aren't. Either way, we hope you have fun. - -If you're in the northern hemisphere outside of the tropics, perhaps winter is starting to rear its frigid face outside. At least it is where I live. And some I'd love nothing more than to curl up by the fire with a cup of tea and my favorite book (or a digital equivalent). - -The bad news is my house lacks a fireplace. The good news is that I can still pretend, thanks to the Linux terminal and today's command-line toy, **aafire**. - -On my system, I found **aafire** packed with **aalib** , a delightful library for converting visual images into the style of ASCII art and making it available at your terminal (or elsewhere). **aalib** enables all sorts of fun graphics at the Linux terminal, so we may revisit a toy or two that make use of it before the end of our series. On Fedora, this meant installation was as simple as: - -``` -$ sudo dnf install aalib -``` - -Then, it was simple to launch with the **aafire** command. By default, **aalib** attempted to draw to my GUI, so I had to manually override it to keep my fire in the terminal (this is a command-line series, after all). Fortunately, it comes with a [curses][1] driver, so this meant I just had to run the following to get my fire going: - -``` -$ aafire -driver curses -``` -![](https://opensource.com/sites/default/files/uploads/linux-toy-aafire-animated.gif) -You can find out more about the **aa-lib** library and download the source on [Sourceforge][2], under an LGPLv2 license. - -Do you have a favorite command-line toy that you think I ought to include? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. - -Check out yesterday's toy, [Patch into The Matrix at the Linux command line][3] , and check back tomorrow for another! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-aafire - -作者:[Jason Baker][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/jason-baker -[b]: https://github.com/lujun9972 -[1]: https://en.wikipedia.org/wiki/Curses_(programming_library) -[2]: http://aa-project.sourceforge.net/aalib/ -[3]: https://opensource.com/article/18/12/linux-toy-cmatrix diff --git a/translated/tech/20181213 Relax by the fire at your Linux terminal.md b/translated/tech/20181213 Relax by the fire at your Linux terminal.md new file mode 100644 index 0000000000..b3532cbd83 --- /dev/null +++ b/translated/tech/20181213 Relax by the fire at your Linux terminal.md @@ -0,0 +1,59 @@ +[#]: collector: (lujun9972) +[#]: translator: (zhs852) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Relax by the fire at your Linux terminal) +[#]: via: (https://opensource.com/article/18/12/linux-toy-aafire) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +在 Linux 终端中观看火焰 +====== +何不在命令行中进行一次“烧烤”呢? + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-aafire.png?itok=pAttiVvG) + +这里是《24 天了解 Linux 命令行小玩意》。如果你未曾读过本系列的文章,可以在本文的结尾部分获取上一篇文章的链接,以了解本系列的大概内容。我们所介绍的命令行小玩意可供你消遣无聊时光。 + +你或许知道它们其中的一些,也可能不曾知晓它们。无论如何,我们都希望你能度过一段愉快的时光。 + +如果你住在北半球的非热带地区,可能冬季来临时你会被冻得满脸通红。住在这里的我,最喜欢的事情便是在火炉旁惬意地边喝茶边读书。 + +不幸的是,我家刚好缺个放火炉的地方。不过,多亏了今天我要介绍的 **aafire** ,我仍然可以假装我坐在火炉旁。 + +在我所使用的系统里, **aafire** 被打包进了 **aalib** 。 **aalib** 是一个受人喜爱的库,它可以很方便地将图像转换成 ASCII 图并输出到终端(或其它任何地方)。 **aalib** 将多种多样的图像带入了 Linux 终端。你可以看看本系列的其它文章,了解一下其它小程序,以便配合使用并充分利用它们。在 Fedora 中,你可以通过以下命令来安装 **aalib** : + +``` +$ sudo dnf install aalib +``` + +接着,试着运行 **aafire** 命令。 **aalib** 默认会使用 GUI 模式,我们要进行一些操作来让它在终端中运行(毕竟这一系列文章都讲的是命令行)。十分幸运的是,仅需安装 [curses][1] 就能实现我们想要的效果。请执行: + +``` +$ aafire -driver curses +``` + +![](https://opensource.com/sites/default/files/uploads/linux-toy-aafire-animated.gif) + +如果你觉得 **aa-lib** 挺有意思,可以在 [Sourceforge][2] 上找到它的源码(以 LGPLv2 许可证开源)。 + +欢迎将你觉得有意思的命令行小程序投稿到原作者处,只需在原文下留言即可。 + +如果有兴趣,可以查看原作者的上一篇文章: [Patch into The Matrix at the Linux command line][3] 。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-aafire + +作者:[Jason Baker][a] +选题:[lujun9972][b] +译者:[zhs852](https://github.com/zhs852) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jason-baker +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Curses_(programming_library) +[2]: http://aa-project.sourceforge.net/aalib/ +[3]: https://opensource.com/article/18/12/linux-toy-cmatrix From 5d5abfae1b5eea9507e6d1d0ad0a3a03fe9d139a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 25 Dec 2018 23:43:20 +0800 Subject: [PATCH 071/322] PRF:20181208 Play Tetris at your Linux terminal.md @geekpi --- ...81208 Play Tetris at your Linux terminal.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/translated/tech/20181208 Play Tetris at your Linux terminal.md b/translated/tech/20181208 Play Tetris at your Linux terminal.md index 110990cc61..1998aad851 100644 --- a/translated/tech/20181208 Play Tetris at your Linux terminal.md +++ b/translated/tech/20181208 Play Tetris at your Linux terminal.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Play Tetris at your Linux terminal) @@ -10,25 +10,25 @@ 在 Linux 终端上玩俄罗斯方块 ====== -用每个人最喜欢的砖块配对游戏俄罗斯方块重新创造 20 世纪 80 年代的魔力。 +> 用每个人最喜欢的砖块配对游戏“俄罗斯方块”重新创造 20 世纪 80 年代的魔力。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-tetris.png?itok=_UXtpgzN) 感谢你来浏览我们今天的 Linux 命令行玩具日历。如果这是你第一次访问该系列,你可能会问自己,什么是命令行玩具。即使我不太确定,但一般来说,它可能是一个游戏或任何消遣,可以帮助你在终端获得乐趣。 -很可能你们中的一些人之前会看到过我们日历中的各种选择,但我们希望每个人至少遇到一件新事物。 +很可能你们中的一些人之前会看到过我们日历中的各种推荐,但我们希望每个人至少遇到一件新事物。 我承诺在我开始这个系列时,我会介绍游戏,但到目前为止,我忽略了它,所以我们今天的选择就是游戏:俄罗斯方块。 -俄罗斯方块和我差不多年纪,都在 1984 年夏天来到世界。不过,俄罗斯方块不是来自北卡罗来纳州的农村地区,而是来自当时苏联的莫斯科。。 +俄罗斯方块和我差不多年纪,都在 1984 年夏天来到世界。不过,俄罗斯方块不是来自北卡罗来纳州的农村地区,而是来自当时苏联的莫斯科。 在风靡世界之后,俄罗斯方块被克隆过很多次。我怀疑你可以找到任何你想找的任何语言、操作系统的俄罗斯方块的克隆。说真的,去看看吧。会有一些有趣的。 -我今天带来的命令行[版本][1]是[用 Haskell 编写]的,它是我见过的做得更好的版本之一,有屏幕预览、得分、帮助、干净的外观。 +我今天带来的命令行[版本][1]是[用 Haskell 编写][1]的,它是我见过的做得更好的版本之一,有屏幕预览、得分、帮助、干净的外观。 如果你愿意从不受信任的来源运行已编译的二进制文件(我不推荐它),你可以直接获取它,但有个更安全的方法,使用 [dex][2] 的容器化版本也很容易,或者使用 [stack][3] 从源代码安装。 -这个俄罗斯方块克隆版是由 Sam Tay 编写的,并且在 BSD 许可证下。[请看这里][1]! +这个俄罗斯方块克隆版是由 Sam Tay 编写的,并且在 BSD 许可证下发布。[请看这里获取][1]! ![](https://opensource.com/sites/default/files/uploads/linux-toy-tetris-animated.gif) @@ -44,8 +44,8 @@ via: https://opensource.com/article/18/12/linux-toy-tetris 作者:[Jason Baker][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -54,4 +54,4 @@ via: https://opensource.com/article/18/12/linux-toy-tetris [1]: https://github.com/samtay/tetris [2]: https://github.com/dockerland/dex [3]: https://docs.haskellstack.org/en/stable/README/#how-to-install -[4]: https://opensource.com/article/18/12/linux-toy-cal \ No newline at end of file +[4]: https://opensource.com/article/18/12/linux-toy-cal From f07f8ca2c8dfe4e96e35f520f28e21040f1e168c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 25 Dec 2018 23:44:27 +0800 Subject: [PATCH 072/322] PUB:20181208 Play Tetris at your Linux terminal.md @geekpi https://linux.cn/article-10384-1.html --- .../20181208 Play Tetris at your Linux terminal.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181208 Play Tetris at your Linux terminal.md (97%) diff --git a/translated/tech/20181208 Play Tetris at your Linux terminal.md b/published/20181208 Play Tetris at your Linux terminal.md similarity index 97% rename from translated/tech/20181208 Play Tetris at your Linux terminal.md rename to published/20181208 Play Tetris at your Linux terminal.md index 1998aad851..da78a64766 100644 --- a/translated/tech/20181208 Play Tetris at your Linux terminal.md +++ b/published/20181208 Play Tetris at your Linux terminal.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10384-1.html) [#]: subject: (Play Tetris at your Linux terminal) [#]: via: (https://opensource.com/article/18/12/linux-toy-tetris) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) From 008cead5e38521babe20e486787ca6946789a14d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 26 Dec 2018 00:53:18 +0800 Subject: [PATCH 073/322] PRF:20180826 How to Install and Use FreeDOS on VirtualBox.md @WangYueScream --- ...o Install and Use FreeDOS on VirtualBox.md | 38 +++++++++---------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/translated/talk/20180826 How to Install and Use FreeDOS on VirtualBox.md b/translated/talk/20180826 How to Install and Use FreeDOS on VirtualBox.md index e8b0d30183..3474815526 100644 --- a/translated/talk/20180826 How to Install and Use FreeDOS on VirtualBox.md +++ b/translated/talk/20180826 How to Install and Use FreeDOS on VirtualBox.md @@ -1,28 +1,27 @@ - 如何在 VirtualBox 上安装并使用 FreeDOS? ====== -这份指南将带你如何一步一步在 Linux 平台下利用 VirtualBox 安装 FreeDOS。 + +> 这份指南将带你如何一步一步在 Linux 平台下利用 VirtualBox 安装 FreeDOS。 ### Linux 下借助 VirtualBox 安装 FreeDOS - +- [How to Install FreeDOS in Linux using Virtual Box](https://www.youtube.com/p1MegqzFAqA) -2017 年的 11 月份,我[采访了 Jim Hall][1] 关于 [FreeDOS project][2] 背后的历史故事。今天,我将告诉你如何安装并使用 FreeDOS。需要注意到是:我将在 [Solus][4](一种针对家庭用户的 Linux 桌面发行版)下使用 5.2.14 版本的 [VirtualBox][3] 来完成这些操作。 - -注意:在本教程我将使用 Solus 作为主机系统因为它很容易设置。另一个你需要注意的事情是 Solus 的软件中心有两个版本的 VirtualBox:`virtualbox` 和 `virtualbox-current`。Solus 会让你选择是使用 linux-lts 内核还是 linux-current 内核。最终区别就是,`virtualbox` 适用于 linux-lts 而 `virtualbx-current` 适用于 linux-current。 +2017 年的 11 月份,我[采访了 Jim Hall][1] 关于 [FreeDOS 项目][2] 背后的历史故事。今天,我将告诉你如何安装并使用 FreeDOS。需要注意到是:我将在 [Solus][4](一种针对家庭用户的 Linux 桌面发行版)下使用 5.2.14 版本的 [VirtualBox][3] 来完成这些操作。 +> 注意:在本教程我将使用 Solus 作为主机系统因为它很容易设置。另一个你需要注意的事情是 Solus 的软件中心有两个版本的 VirtualBox:`virtualbox` 和 `virtualbox-current`。Solus 会让你选择是使用 linux-lts 内核还是 linux-current 内核。最终区别就是,`virtualbox` 适用于 linux-lts 而 `virtualbx-current` 适用于 linux-current。 #### 第一步 – 创建新的虚拟机 ![][5] -当你打开 VirtualBox,点击 "New" 按钮来新建一个虚拟机。你可以自定义这台虚拟机的名字,我将它命名为 “FreeDOS”。你也可以在标注栏内指明你正在安装的 FreeDOS 的版本。你还需要选择你将要安装的操作系统的类型和版本。选择 “Other” 下的 “DOS”。 +当你打开 VirtualBox,点击 “New” 按钮来新建一个虚拟机。你可以自定义这台虚拟机的名字,我将它命名为 “FreeDOS”。你也可以在标注栏内指明你正在安装的 FreeDOS 的版本。你还需要选择你将要安装的操作系统的类型和版本。选择 “Other” 下的 “DOS”。 #### 第二步 – 设置内存大小 ![][6] -下一个对话框会问你要给 FreeDOS 主机分配多少可用的内存空间。默认分配 32 MB。不必更改它。在 DOS 系统盛行的年代,32 MB 大小的内存对于一台搭载 FreeDOS 的机器已经很足够了。如果你有需要,你可以通过对你针对 FreeDOS 新建的虚拟机右键并选择 Setting -> Symtem 来增加内存。 +下一个对话框会问你要给 FreeDOS 主机分配多少可用的内存空间。默认分配 32 MB。不必更改它。在 DOS 系统盛行的年代,32 MB 大小的内存对于一台搭载 FreeDOS 的机器已经很足够了。如果你有需要,你可以通过对你针对 FreeDOS 新建的虚拟机右键并选择 “Setting -> Symtem” 来增加内存。 ![][7] @@ -38,8 +37,7 @@ ![][9] -现在,你可以选择虚拟磁盘的大小和位置。500 MB 已经很足够了。需要注意的是很多你之后用到的程序都是基于文本的,这意味着它们占据的空间非常小。在你做好这些调整后,点击 Creat。 - +现在,你可以选择虚拟磁盘的大小和位置。500 MB 已经很足够了。需要注意的是很多你之后用到的程序都是基于文本的,这意味着它们占据的空间非常小。在你做好这些调整后,点击 “Create”。 #### 第四步 – 关联 .iso 文件 @@ -47,12 +45,11 @@ ![][11] -当文件下载完毕后,返回到 VirtualBox。选中你的虚拟机并打开设置。你可以通过对虚拟机右键并选中 “Setting” 或者 选中虚拟机并点击 “Setting” 按钮。 +当文件下载完毕后,返回到 VirtualBox。选中你的虚拟机并打开设置。你可以通过对虚拟机右键并选中 “Setting” 或者选中虚拟机并点击 “Setting” 按钮。 接下来,点击 “Storage” 选项卡。在 “Storage Devices” 下面,选中 CD 图标。(它应该会在图标旁边显示 “Empty”。) 在右边的 “Attribute” 面板,点中 CD 图标然后在对应路径选中你刚下载的 .iso 文件。 -提示:通常,在你通过 VirtualBox 安装完一个操作系统后你就可以删除对应的 .iso 文件了。但这并不适合 FreeDOS 。如果你想通过 FreeDOS 的包管理器来安装应用程序,你需要这个 .iso 文件。我通常会让这个 .iso 文件连接到虚拟机以便我安装一些程序。如果你也这么做了,你必须要确认下你让 FreeDOS 虚拟机每次启动的时候是从硬盘启动因为虚拟机的默认设置是从已关联的 .iso 文件启动。如果你忘了关联 .iso 文件,也不用担心。你可以通过选择 FreeDOS 虚拟机窗口上方的 “Devices” 来关联。然后就会发现 .iso 文件列在 “Optical Drives”。 - +> 提示:通常,在你通过 VirtualBox 安装完一个操作系统后你就可以删除对应的 .iso 文件了。但这并不适合 FreeDOS 。如果你想通过 FreeDOS 的包管理器来安装应用程序,你需要这个 .iso 文件。我通常会让这个 .iso 文件连接到虚拟机以便我安装一些程序。如果你也这么做了,你必须要确认下你让 FreeDOS 虚拟机每次启动的时候是从硬盘启动因为虚拟机的默认设置是从已关联的 .iso 文件启动。如果你忘了关联 .iso 文件,也不用担心。你可以通过选择 FreeDOS 虚拟机窗口上方的 “Devices” 来关联。然后就会发现 .iso 文件列在 “Optical Drives”。 #### 第五步 – 安装 FreeDOS @@ -62,11 +59,11 @@ 首先,你需要知道关于最新版本的 VirtualBox 的一个 bug。当我们创建好虚拟硬盘然后选中 “Install to harddisk” 后,如果你开启虚拟机你会发现在 FreeDOS 的欢迎界面出现过后就是不断滚动无群无尽的机器代码。我最近就遇到过这个问题而且不管是 Linux 还是 Windows 平台的 VirtualBox 都会碰到这个问题。(我知道解决办法。) -为了避开这个问题,你需要做一个简单的修改。当你看到 FreeDOS 的欢迎界面的时候,按下 Tab 键。(确认 “Install to harddrive” 已经选中。)在 “fdboot.img” 之后输入 `raw` 然后按下 Enter 键。接下来就会启动 FreeDOS 的安装程序。 +为了避开这个问题,你需要做一个简单的修改。当你看到 FreeDOS 的欢迎界面的时候,按下 Tab 键。(确认 “Install to harddrive” 已经选中。)在 “fdboot.img” 之后输入 `raw` 然后按下回车键。接下来就会启动 FreeDOS 的安装程序。 ![][13] -安装程序会首先处理你的虚拟磁盘的格式化。当格式化完成后,安装程序会重启。当 FreeDOS 的欢迎界面再次出现的时候,你不得不重新输入 `raw` 就像你之前输入的内容那样。 +安装程序会首先处理你的虚拟磁盘的格式化。当格式化完成后,安装程序会重启。当 FreeDOS 的欢迎界面再次出现的时候,你必须重新输入 `raw` 就像你之前输入的内容那样。 要确保在安装过程中你遇到的所有问题你选的都是 “Yes”。但也要注意有一个很重要的问题:“What FreeDOS packages do you want to install?” 的答案并不是 “Yes” 或者 “No”。答案有两个选择分别是 “Base packages” 和 “Full installation”。“Base packages” 针对的是想体验类似原始的 MS-DOS 环境的人群。“Full installation” 则包括了一系列工具和实用的程序来提升 DOS。 @@ -82,15 +79,14 @@ ![][15] -现在,你可以通过输入 `fdimples` 来访问 FreeDOS 的软件包管理工具。你也可以借助方向键来浏览软件包管理器然后用空格键选择类别或者软件包。在 “Networking” 类别中,你需要选中 `fdnet`。FreeDOS project 推荐也安装 `mtcp` 和 `wget`。多次点击 “Tab” 键直到选中 “OK” 然后在按下 “Enter” 键。安装完成后,输入 `reboot` 并按下 “Enter” 键确认执行。系统重启后,引导你的系统驱动。如果网络安装成功的话,你会在终端看到一些关于你的网络信息的新消息。 +现在,你可以通过输入 `fdimples` 来访问 FreeDOS 的软件包管理工具。你也可以借助方向键来浏览软件包管理器,然后用空格键选择类别或者软件包。在 “Networking” 类别中,你需要选中 `fdnet`。FreeDOS project 推荐也安装 `mtcp` 和 `wget`。多次点击 Tab 键直到选中 “OK” 然后在按下回车键。安装完成后,输入 `reboot` 并按下回车键确认执行。系统重启后,引导你的系统驱动。如果网络安装成功的话,你会在终端看到一些关于你的网络信息的新消息。 ![][16] -##### 注意 +注意: 有时候 VirtualBox 的默认设置并没有生效。如果遇到这种情况,先关闭你的 FreeDOS 虚拟机窗口。在 VirtualBox 主界面右键你的虚拟机并选中 “Setting”。VirtualBox 默认的网络设置是 “NAT”。将它改为 “Bridged Adapter” 后再尝试安装 FreeDOS 的软件包。现在就应该能正常运作了。 - #### 第七步 – FreeDOS 的基本使用 ##### 常见命令 @@ -107,7 +103,7 @@ * `MKDIR NEWDIR` – 创建一个新目录 * `CLS` – 清除屏幕 -你可以借助互联网或者 Jim Hall 所创建的 [handy cheat sheet][17] 来找到更多基本的 DOS 命令。 +你可以借助互联网或者 Jim Hall 所创建的 [方便的速查表][17] 来找到更多基本的 DOS 命令。 ##### 运行一个程序 @@ -119,7 +115,7 @@ 对于游戏通常会有一个或者两个 .EXE 程序,你玩游戏之前不得不先运行它们。这些设置文件通常能够修复你遇到的声音,视频,或者控制问题。 -如果你遇到一些本教程中没指出的问题,别忘记访问 [home of FreeDOS][2] 来寻求解决办法。他们有一个 wiki 和一些其他的支持选项。 +如果你遇到一些本教程中没指出的问题,别忘记访问 [FreeDOS 主站][2] 来寻求解决办法。他们有一个 wiki 和一些其他的支持选项。 你使用过 FreeDOS 吗?你还想看关于 FreeDOS 哪些方面的教程?请在下面的评论区告诉我们。 @@ -132,7 +128,7 @@ via: https://itsfoss.com/install-freedos/ 作者:[John Paul][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[WangYueScream](https://github.com/WangYueScream) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From d5f2d0163e0aa0fe4265f143ee3ae117622d784b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 26 Dec 2018 00:53:40 +0800 Subject: [PATCH 074/322] PUB:20180826 How to Install and Use FreeDOS on VirtualBox.md @WangYueScream https://linux.cn/article-10385-1.html --- .../20180826 How to Install and Use FreeDOS on VirtualBox.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/20180826 How to Install and Use FreeDOS on VirtualBox.md (100%) diff --git a/translated/talk/20180826 How to Install and Use FreeDOS on VirtualBox.md b/published/20180826 How to Install and Use FreeDOS on VirtualBox.md similarity index 100% rename from translated/talk/20180826 How to Install and Use FreeDOS on VirtualBox.md rename to published/20180826 How to Install and Use FreeDOS on VirtualBox.md From ab64e2f074c2ecb25ee35cf781db1eead064990c Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 26 Dec 2018 08:41:29 +0800 Subject: [PATCH 075/322] translated --- ... Mode Or Emergency Mode In Ubuntu 18.04.md | 106 ------------------ ... Mode Or Emergency Mode In Ubuntu 18.04.md | 106 ++++++++++++++++++ 2 files changed, 106 insertions(+), 106 deletions(-) delete mode 100644 sources/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md create mode 100644 translated/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md diff --git a/sources/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md b/sources/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md deleted file mode 100644 index 379bbfd20a..0000000000 --- a/sources/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md +++ /dev/null @@ -1,106 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04) -[#]: via: (https://www.ostechnix.com/how-to-boot-into-rescue-mode-or-emergency-mode-in-ubuntu-18-04/) -[#]: author: (SK https://www.ostechnix.com/author/sk/) - -How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04 -====== -![](https://www.ostechnix.com/wp-content/uploads/2018/12/Boot-Into-Rescue-Mode-Or-Emergency-Mode-720x340.png) - -As you might already know, **Runlevels** are replaced with **Systemd targets** in many recent Linux distributions like RHEL 7 and Ubuntu 16.04 LTS. For more details about runlevels and systemd target, refer [**this guide**][1]. In this brief tutorial, we are going to see how to boot into **rescue mode** and/or **emergency mode**. This guide is tested in Ubuntu 18.04 LTS, however the steps given below would work on most Linux distributions that uses Systemd as default service manager. Before going further, let me clarify what is rescue mode and emergency mode and what is the purpose of the both modes. - -### What is Rescue mode? - -The **rescue mode** is equivalent to **single user mode** in Linux distributions that uses **SysV** as the default service manager. In rescue mode, all local filesystems will be mounted, only some important services will be started. However, no normal services (E.g network services) won’t be started. The rescue mode is helpful in situations where the system can’t boot normally. Also, we can perform some important rescue operations, such as [**reset root password**][2], in rescue mode. - -### What is Emergency mode? - -In contrast to the rescue mode, nothing is started in the **emergency mode**. No services are started, no mount points mounted, no sockets established, nothing. All you will have is just a **raw shell**. Emergency mode is suitable for debugging purposes. - -### Boot Into Rescue Mode In Ubuntu 18.04 LTS - -Boot your Ubuntu system. When Grub menu appears, choose the first entry and press **e** to edit. - -![](https://www.ostechnix.com/wp-content/uploads/2018/12/Grub-menu.png) - -If you don’t see the Grub menu, just hit ESC key right after the BIOS logo disappears. - -Find the line that starts with word **“linux”** and add the following line at the end of that line (To reach the end, just press **CTRL+e** or use END key or LEFT/RIGHT arrows in your keyboard): - -``` -systemd.unit=rescue.target -``` - -![](https://www.ostechnix.com/wp-content/uploads/2018/12/Edit-grub-menu.png) - -Once you added the above line, just press **CTRL+x** or **F10** to continue to boot into rescue mode. After a few seconds, you will be ended up in the rescue mode (single user mode) as root user. Here is how rescue mode looks like in Ubuntu 18.04 LTS server: - -![](https://www.ostechnix.com/wp-content/uploads/2018/12/Ubuntu-rescue-mode.png) - -Next, type the following command to mount root (/) file system into read/write mode. - -``` -mount -n -o remount,rw / -``` - -### Boot Into Emergency Mode - -Booting your Ubuntu into emergency is as same as above method. All you have to do is replace “systemd.unit=rescue.target” with “systemd.unit=emergency.target” when editing grub menu. - -[![emergency mode][3]][4] - -Once you added “systemd.unit=emergency.target”, press **Ctrl+x** or **F10** to continue booting into emergency mode. - -![](https://www.ostechnix.com/wp-content/uploads/2018/12/emergency-mode-1.png) - -Finally, you can mount root filesystem into read/write mode with command: - -``` -mount -n -o remount,rw / -``` - -### Switch between Rescue to Emergency mode and vice versa - -If you are in rescue mode, you don’t have to edit the grub boot entry as I mentioned above. Instead, just type the following command to switch to emergency mode instantly: - -``` -systemctl emergency -``` - -Similarly, to switch from emergency to rescue mode, type: - -``` -systemctl rescue -``` - -You know now what is rescue and emergency modes and how to boot into those modes in Ubuntu 18.04. Like I already mentioned, the steps provided here will work on many recent Linux versions that uses Systemd. - -And, that’s all for now. Hope this was useful. - -More good stuffs to come. Stay tuned! - -Cheers! - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/how-to-boot-into-rescue-mode-or-emergency-mode-in-ubuntu-18-04/ - -作者:[SK][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.ostechnix.com/author/sk/ -[b]: https://github.com/lujun9972 -[1]: https://www.ostechnix.com/check-runlevel-linux/ -[2]: https://www.ostechnix.com/how-to-reset-or-recover-root-user-password-in-linux/ -[3]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[4]: http://www.ostechnix.com/wp-content/uploads/2018/12/emergency-mode.png diff --git a/translated/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md b/translated/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md new file mode 100644 index 0000000000..9d5836b921 --- /dev/null +++ b/translated/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md @@ -0,0 +1,106 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04) +[#]: via: (https://www.ostechnix.com/how-to-boot-into-rescue-mode-or-emergency-mode-in-ubuntu-18-04/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +如何在 Ubuntu 18.04 中启动到救援模式或紧急模式 +====== +![](https://www.ostechnix.com/wp-content/uploads/2018/12/Boot-Into-Rescue-Mode-Or-Emergency-Mode-720x340.png) + +正如你可能已经知道的那样,**runlevel** 在许多最近的 Linux 发行版(如 RHEL 7 和 Ubuntu 16.04 LTS)中被 **systemd target** 替换。有关 runlevel 和 systemd target 的更多详细信息,请参阅[**本指南**][1]。在这个简短的教程中,我们将看到如何启动**救援模式**以及**紧急模式**。本指南在 Ubuntu 18.04 LTS 中进行了测试,但是下面给出的步骤适用于大多数使用 systemd 作为默认服务管理器的 Linux 发行版。在进一步讨论之前,让我澄清什么是救援模式和紧急模式以及这两种模式的目的是什么。 + +### 什么是救援模式? + +**救援模式**相当于使用 **SysV** 作为默认服务管理器的 Linux 发行版中的 **单用户模式**。在救援模式下,将挂载所有本地文件系统,仅启动一些重要服务。但是,不会启动正常服务(例如网络服务)。救援模式在系统无法正常启动的情况下很有用。此外,我们可以在救援模式下执行一些重要的救援操作,例如[**重置 root 密码**][2]。 + +### 什么是紧急模式? + +与救援模式相比,在**紧急模式**中不启动任何东西。没有服务启动、没有挂载点、没有建立套接字,什么也没有。你所拥有的只是一个**原始的 shell**。紧急模式适用于调试目的。 + +### 在 Ubuntu 18.04 LTS 中进入救援模式 + +启动你的 Ubuntu 系统。出现 Grub 菜单时,选择第一条并按下 **e** 进行编辑。 + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/Grub-menu.png) + +如果你没有看到 Grub 菜单,只需在 BIOS logo 消失后立即按下 ESC 键。 + +找到以单词 **“linux”** 开头的行,并在该行的末尾添加以下行(要到达末尾,只需按下 **CTRL+e** 或使用 END 键或左右箭头键): + +``` +systemd.unit=rescue.target +``` + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/Edit-grub-menu.png) + +添加完成后,只需按下 **CTRL+x** 或 **F10** 即可继续启动救援模式。几秒钟后,你将以 root 用户身份进入救援模式(单用户模式)。以下是 Ubuntu 18.04 LTS 服务器版中救援模式的样子: + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/Ubuntu-rescue-mode.png) + +接下来,输入以下命令将根 (/) 文件系统挂载成读/写模式。 + +``` +mount -n -o remount,rw / +``` + +### 启动到紧急模式 + +将 Ubuntu 引导到紧急模式与上述方法相同。你只需在编辑 grub 菜单时将 “systemd.unit=rescue.target” 替换为 “systemd.unit=emergency.target” 即可。 + +[![emergency mode][3]][4] + +添加 “systemd.unit=emergency.target” 后,按下 **Ctrl+x** 或 **F10** 继续启动到紧急模式。 + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/emergency-mode-1.png) + +最后,你可以使用以下命令将根文件系统挂载成读/写模式: + +``` +mount -n -o remount,rw / +``` + +### 在救援模式和紧急模式之间切换 + +如果你处于救援模式,则不必像上面提到的那样编辑 grub 条目。相反,只需输入以下命令即可立即切换到紧急模式: + +``` +systemctl emergency +``` + +同样,要从紧急模式切换到救援模式,请输入: + +``` +systemctl rescue +``` + +你现在知道了什么是救援模式和紧急模式以及如何在 Ubuntu 18.04 中启动这些模式。就像我已经提到的,这里提供的步骤将适用于许多使用 systemd 的 Linux 版本。 + +就是这些了。希望这篇文章有用。 + +还有更多好东西。敬请期待! + +干杯! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-boot-into-rescue-mode-or-emergency-mode-in-ubuntu-18-04/ + +作者:[SK][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: https://www.ostechnix.com/check-runlevel-linux/ +[2]: https://www.ostechnix.com/how-to-reset-or-recover-root-user-password-in-linux/ +[3]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[4]: http://www.ostechnix.com/wp-content/uploads/2018/12/emergency-mode.png \ No newline at end of file From 869b39f33f241f80a22c1a20fcaed053e4021d8c Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 26 Dec 2018 08:48:22 +0800 Subject: [PATCH 076/322] translating --- sources/tech/20181222 A Tale of HTTP-2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181222 A Tale of HTTP-2.md b/sources/tech/20181222 A Tale of HTTP-2.md index 5484e67148..897fd83fc5 100644 --- a/sources/tech/20181222 A Tale of HTTP-2.md +++ b/sources/tech/20181222 A Tale of HTTP-2.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 1be827d677fdbf18f75c6bf06acca89967c60d52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=98=8E=E5=B2=B3?= <3249977074@qq.com> Date: Wed, 26 Dec 2018 11:05:11 +0800 Subject: [PATCH 077/322] ScarboroughCoral translating! --- ...803 How to use Fedora Server to create a router - gateway.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20180803 How to use Fedora Server to create a router - gateway.md b/sources/tech/20180803 How to use Fedora Server to create a router - gateway.md index 0394826c10..934693d1cf 100644 --- a/sources/tech/20180803 How to use Fedora Server to create a router - gateway.md +++ b/sources/tech/20180803 How to use Fedora Server to create a router - gateway.md @@ -1,3 +1,5 @@ +ScarboroughCoral translating! + How to use Fedora Server to create a router / gateway ====== From 51dfff4fe1faa32bcdb0c7ac8b4b67ef0bbfd22c Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Wed, 26 Dec 2018 13:36:37 +0800 Subject: [PATCH 078/322] Check translation of How to Update Ubuntu. --- ...untu -Terminal - GUI Methods- It-s FOSS.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md b/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md index 13d393b381..9d7a8ebf92 100644 --- a/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md +++ b/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md @@ -10,11 +10,11 @@ 如何更新 Ubuntu [终端及GUI方式] It's FOSS ====== -**这篇教程将向你展示如何更新服务器版本或者桌面版本的Ubuntu。它还解释了更新和升级之间的区别以及你应该了解的有关于Ubuntu Linux中的更新的一些其他内容。** +**这篇教程将向你展示如何更新服务器版本或者桌面版本的 Ubuntu。它还解释了更新和升级之间的区别以及你应该了解的有关于 Ubuntu Linux 中的更新的一些其他内容。** -如果你是一个新手并已经体验Ubuntu数天或几周,你可能想知道如何更新你的[Ubuntu][1]系统以获取安全补丁,错误修复和应用升级。 +如果你是一个新手并已经体验 Ubuntu 数天或几周,你可能想知道如何更新你的 [Ubuntu][1] 系统以获取安全补丁,错误修复和应用升级。 -更新 Ubuntu 非常简单。我并不夸张的说。它简单得只要运行两个命令。让我来告诉你更多更新细节。 +更新 Ubuntu 非常简单。我并不是瞎说。它简单得只要运行两个命令。让我来告诉你这两个命令的更多细节。 请注意,本教程适用于 Ubuntu 18.04,16.04 或任何其他版本。命令行方式也适用于基于 Ubuntu 的发行版如 Linux Mint,Linux Lite,elementary OS 等。 @@ -22,7 +22,7 @@ ![如何更新 Ubuntu][2] -在桌面上,打开终端。你可以在菜单里找到它或者使用 Ctrl+Alt+T [快捷键][3]。如果你登陆到一台 [Ubuntu 服务器][4],那你已经在访问一个终端了。 +在桌面上,打开终端。你可以在菜单里找到它或者使用 Ctrl+Alt+T [快捷键][3]。如果你是登陆到一台 [Ubuntu 服务器][4],那你已经在访问一个终端了。 在终端里,你只需要使用以下命令: @@ -30,7 +30,7 @@ sudo apt update && sudo apt upgrade -y ``` -它将询问密码,而你可以使用你账号的密码。输入时,你将不会看到任何内容在屏幕上,所以请继续输入你的密码并按回车键。 +它将询问密码,而你可以使用你的账号密码。输入时,你将不会看到任何内容在屏幕上,所以请继续输入你的密码并按回车键。 现在,我来解释下上面的命令。 @@ -49,9 +49,9 @@ sudo apt upgrade #### 说明:sudo apt update -这条命令更新了可用软件包的本地数据库。如果你没运行这条命令,本地数据库将不会更新而你的系统将不会知道是否又可用的新版本。 +这条命令更新了可用软件包的本地数据库。如果你没运行这条命令,本地数据库将不会被更新,而你的系统将不会知道是否有可用的新版本。 -这就是为什么当你运行 `sudo apt update`,你会在输出中看到大量的 URLs。这条命令从对应的储存库(你在输出中看到的 URLs)中获取软件包信息。 +这就是为什么当你运行 `sudo apt update`,你会在输出中看到大量的 URLs。这条命令会从对应的储存库(你在输出中看到的 URLs)中获取软件包信息。 ![更新 Ubuntu Linux][5] @@ -69,7 +69,7 @@ apt list --upgradable ![通过命令行更新 Ubuntu Linux][7] -你可以键入 `yes`,`y` 或者只敲回车键去确认安装这些更新。 +你可以键入 `yes`,`y` 或者只敲回车键去确认安装这些更新。 所以总的来说,`sudo apt update` 会检查可用的新版本,而 `sudo apt upgrade` 实际上会执行更新。 @@ -123,7 +123,7 @@ sudo apt autoremove #### 在 Ubuntu Server 中内核热修复以避免重启 -如果是 Linux 内核更新,你将需要在系统更新后重启。当你不希望服务器停机时,这将是一个问题。 +如果是 Linux 内核更新,你将需要在系统更新后重启。当你不希望服务器停机时,这将会是一个问题。 [热修复][15]功能允许Linux内核在持续运行时打补丁。换句话说就是你不需要重启你的系统。 @@ -131,7 +131,7 @@ sudo apt autoremove #### 版本升级是不同的 -本文讨论的更新是使你安装的 Ubuntu 保持最新。它不包括[版本升级][17](例如从 Ubuntu 16.04 升级到 18.04)。 +本文讨论的更新是使你安装的 Ubuntu 保持最新。但它不包括[版本升级][17](例如从 Ubuntu 16.04 升级到 18.04)。 [Ubuntu 版本][18] 升级完全是另一回事。它更新整个操作系统核心。你需要在这个漫长的过程开始前做好备份。 From 1048b330a6021410854cb658918fec7c7fb9d98e Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Wed, 26 Dec 2018 13:37:29 +0800 Subject: [PATCH 079/322] Delete 20181210 How to Update Ubuntu.md --- ...untu -Terminal - GUI Methods- It-s FOSS.md | 175 ------------------ 1 file changed, 175 deletions(-) delete mode 100644 sources/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md diff --git a/sources/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md b/sources/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md deleted file mode 100644 index 3a9036f403..0000000000 --- a/sources/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md +++ /dev/null @@ -1,175 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (LazyWolfLin) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Update Ubuntu [Terminal & GUI Methods] It's FOSS) -[#]: via: (https://itsfoss.com/update-ubuntu/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -Translating by LazyWolfLin - -How to Update Ubuntu [Terminal & GUI Methods] It's FOSS -====== - -**This tutorial shows you how to update Ubuntu for both server and desktop versions. It also explains the difference between update and upgrade along with a few other things you should know about updates in Ubuntu Linux.** - -If you are a new user and have been using Ubuntu for a few days or weeks, you might be wondering how to update your [Ubuntu][1] system for security patches, bug fixes and application upgrades. - -Updating Ubuntu is absolutely simple. I am not exaggerating. It’s as simple as running two commands. Let me give you more details on it. - -Please note that the tutorial is valid for Ubuntu 18.04, 16.04 or any other version. The command line way is also valid for Ubuntu-based distributions like Linux Mint, Linux Lite, elementary OS etc. - -### Update Ubuntu via Command Line - -![How to Update Ubuntu][2] - -On the desktop, open the terminal. You can find it in the menu or use the Ctrl+Alt+T [keyboard shortcut][3]. If you are logged on to an [Ubuntu server][4], you already have access to a terminal. - -In the terminal, you just have to use the following command: - -``` -sudo apt update && sudo apt upgrade -y -``` - -It will ask for password and you can use your account’s password. You won’t see the anything on the screen while typing so keep on typing your password and hit enter. - -Now let me explain the above command. - -Actually, it’s not a single command. It’s a combination of two commands. The && is a way to combine two commands in a way that the second command runs only when the previous command ran successfully. - -The ‘-y’ in the end automatically enters yes when the command ‘apt upgrade’ ask for your confirmation before installing the updates. - -Note that you can also use the two commands separately, one by one: - -``` -sudo apt update -sudo apt upgrade -``` - -It will take a little longer because you have to wait for one command to finish and then enter the second command. - -#### Explanation: sudo apt update - -This command updates the local database of available packages. If you won’t run this command, the local database won’t be updated and your system will not know if there are any new versions available. - -This is why when you run the sudo apt update, you’ll see lots of URLs in the output. The command fetches the package information from the respective repositories (the URLs you see in the output). - -![Updating Ubuntu Linux][5] - -At the end of the command, it tells you how many packages can be upgraded. You can see these packages by running the following command: - -``` -apt list --upgradable -``` - -**Additional Reading:** Read this article to learn [what is Ign, Hit and Get in the apt update command output][6]. - -#### Explanation: sudo apt upgrade - -This command matches the versions of installed packages with the local database. It collects all of them and then it will list all of the packages that have a newer version available. At this point, it will ask if you want to upgrade (the installed packages to the newer version). - -![Update Ubuntu Linux via Command Line][7] - -You can type ‘yes’, ‘y’ or just press enter to confirm the installation of updates. - -So the bottom line is that the sudo apt update checks for the availability of new versions while as the sudo apt upgrade actually performs the update. - -The term update might be confusing as you might expect the apt update command to update the system by installing the updates but that doesn’t happen. - -### Update Ubuntu via GUI [For Desktop Users] - -If you are using Ubuntu as a desktop, you don’t have to go to terminal just for updating the system. You can still use the command line but it’s optional for you. - -In the menu, look for ‘Software Updater’ and run it. - -![Run Software Updater in Ubuntu][8] - -It will check if there are updates available for your system. - -![Checking if updates are available for Ubuntu][9] - -If there are updates available, it will give provide you with options to install the updates. - -![Install Updates via Update Manager in Ubuntu][10] - -Click on Install Now, it may ask for your password. - -![Installing Updates in Ubuntu Linux via GUI][11] - -Once you enter your password, it will start installing the updates. - -![Updating Ubuntu via GUI][12] - -In some cases, you may need to reboot the system for the installed updates to work properly. You’ll be notified at the end of the update if you need to restart the system. - -![Updating Ubuntu via GUI][12] - -You can choose to restart later if you don’t want to reboot your system straightaway. - -![Installing updates via GUI in Ubuntu][13] - -Tip: If the software updater returns an error, you should use the command ‘sudo apt update’ in the terminal. The last few lines of the output will contain the actual error message. You can search on the internet for that error and fix the problem. - -### Few things to keep in mind abou updating Ubuntu - -You just learned how to update your Ubuntu system. If you are interested, you should also know these few things around Ubuntu updates. - -#### Clean up after an update - -Your system will have some unnecessary packages that won’t be required after the updates. You can remove such packages and [free up some space][14] using this command: - -``` -sudo apt autoremove -``` - -#### Live patching kernel in Ubuntu Server to avoid rebooting - -In case of a Linux kernel updates, you’ll have to restart the system after the update. This is an issue when you don’t want downtime for your server. - -[Live patching][15] feature allows the patching of Linux kernel while the kernel is still running. In other words, you don’t have to reboot your system. - -If you manage servers, you may want to [enable live patching in Ubuntu][16]. - -#### Version upgrades are different - -The updates discussed here is to keep your Ubuntu install fresh and updated. It doesn’t cover the [version upgrades][17] (for example upgrading Ubuntu 16.04 to 18.04). - -[Ubuntu version][18] upgrades are entirely a different thing. It updates the entire operating system core. You need to make proper backups before starting this lengthy process. - -### Conclusion - -I hope you liked this tutorial on updating the Ubuntu system and you learned a few new things. - -If you have any questions, please fee free to ask. If you are an experienced Linux users and have some tip that can make this tutorial more useful, please share it with the rest of us. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/update-ubuntu/ - -作者:[Abhishek Prakash][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://www.ubuntu.com/ -[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/how-to-update-ubuntu.png?resize=800%2C450&ssl=1 -[3]: https://itsfoss.com/ubuntu-shortcuts/ -[4]: https://www.ubuntu.com/download/server -[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/update-ubunt-1.jpeg?resize=800%2C357&ssl=1 -[6]: https://itsfoss.com/apt-get-linux-guide/ -[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/update-ubunt-2.jpeg?ssl=1 -[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/update-ubuntu-via-GUI-1.jpeg?resize=800%2C250&ssl=1 -[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/update-ubuntu-via-GUI-2.jpeg?resize=800%2C250&ssl=1 -[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/update-ubuntu-GUI-3.jpeg?resize=800%2C365&ssl=1 -[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/install-update-ubuntu-1.jpg?resize=800%2C450&ssl=1 -[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/installing-updates-ubuntu.jpg?ssl=1 -[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/12/installing-updates-ubuntu-2.jpeg?ssl=1 -[14]: https://itsfoss.com/free-up-space-ubuntu-linux/ -[15]: https://www.ubuntu.com/livepatch -[16]: https://www.cyberciti.biz/faq/howto-live-patch-ubuntu-linux-server-kernel-without-rebooting/ -[17]: https://itsfoss.com/upgrade-ubuntu-version/ -[18]: https://itsfoss.com/how-to-know-ubuntu-unity-version/ From 0957306a56214ca0eafe1e6d48aab05594ef05e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Wed, 26 Dec 2018 15:35:55 +0800 Subject: [PATCH 080/322] Translating by robsean --- sources/tech/20170523 Best Websites to Download Linux Games.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20170523 Best Websites to Download Linux Games.md b/sources/tech/20170523 Best Websites to Download Linux Games.md index e6d4636fdb..b29afc1dfb 100644 --- a/sources/tech/20170523 Best Websites to Download Linux Games.md +++ b/sources/tech/20170523 Best Websites to Download Linux Games.md @@ -1,3 +1,4 @@ +Translating by robsean Best Websites to Download Linux Games ====== Brief: New to Linux gaming and wondering where to **download Linux games** from? We list the best resources from where you can **download free Linux games** as well as buy premium Linux games. From 3024918a2f19b2e92a01e8712e82a84439ce50d6 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 26 Dec 2018 19:51:08 +0800 Subject: [PATCH 081/322] PRF:20181121 DevOps is for everyone.md @alim0x --- .../talk/20181121 DevOps is for everyone.md | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/translated/talk/20181121 DevOps is for everyone.md b/translated/talk/20181121 DevOps is for everyone.md index 778656640d..df9e41ffd1 100644 --- a/translated/talk/20181121 DevOps is for everyone.md +++ b/translated/talk/20181121 DevOps is for everyone.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (alim0x) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: subject: (DevOps is for everyone) [#]: via: (https://opensource.com/article/18/11/how-non-engineer-got-devops) @@ -10,41 +10,40 @@ 所有人的 DevOps ====== -让一名非工程师来解释为什么你不必成为一位开发者或运维就能爱上 DevOps。 +> 让一名非工程师来解释为什么你不必成为一位开发者或运维就能爱上 DevOps。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/team-game-play-inclusive-diversity-collaboration.png?itok=8sUXV7W1) -我没有过开发或运维的工作——那怎么我在写一篇关于 [DevOps][1] 的文章?我一直都对计算机和技术有兴趣。我还对社群、心理学以及帮助他人充满热情。当我第一次听到 DevOps 时,这个概念激起了我的兴趣,因为它看起来融合了很多我感兴趣的东西,即便我是不写代码的。 +我从未做过开发或运维的工作 —— 那怎么我在写一篇关于 [DevOps][1] 的文章?我一直都对计算机和技术有兴趣。我还对社群、心理学以及帮助他人充满热情。当我第一次听到 DevOps 时,这个概念激起了我的兴趣,因为它看起来融合了很多我感兴趣的东西,即便我是不写代码的。 我的第一台电脑是 TRS-80,我喜欢在上面编写 BASIC 程序。我只上过两门我的高中开设的计算机编程课程。若干年后,我创办了一家计算机公司。我定制邮件标签和信纸,并建立了一个数据库来存储地址。 问题是我并不能从写代码中获得享受。我想要教育和帮助人们,我没法将写代码看作这样的一个机会。是的,技术可以帮助人们并改变生活,但是写代码没有点燃我的热情。我需要对我的工作感到兴奋并做我喜欢的事情。 +我发现我爱 DevOps。对我而言,DevOps 指的是: + * 文化,而不是代码 * 过程,而不是结果 * 建立一个所有人可以持续提升的环境 * 沟通与合作,而不是独立工作 - -我发现我爱 DevOps。对我而言,DevOps 指的是: - 归根结底,DevOps 是指成为社区工作的一部分,实现共同的目标。DevOps 融合了心理学、社群、技术。DevOps 不是一个职位名称,它是一种生活和工作的哲学。 ### 找到我的社群 快四年前,我在西雅图参加了我的第一个 [DevOps 日][2] 会议。我感觉我找到了我的社群。我觉得受到了欢迎和接受,尽管我从事营销工作而且没有计算机科学文凭。我可以从心理学和技术中寻找乐趣。 -在 DevOps 日,我学到了 [DevOps“三步工作法”][3]——流动,反馈,持续实验和学习——以及新(对我而言)的概念,如Kaizen(改善)和Kaikaku(改革)。随着我的学习深入,我发现我在说这样的话,“我是这样做的!我都不知道这样做还有个名字!” +在 DevOps 日,我学到了 [DevOps“三步工作法”][3] —— 流动、反馈、持续实验和学习 —— 以及新(对我而言)的概念,如 Kaizen(改善)和 Kaikaku(改革)。随着我的学习深入,我发现我在说这样的话,“我是这样做的!我都不知道这样做还有个名字!” -[Kaizen(改善)][4]是持续改进和学习的实践。小的量变积累随着时间的推移可以引起质变。我发现它和卡罗尔.德韦克的[成长型思维][5]的想法很相似。人们不是生来就是专家。在某方面拥有经验需要花费时间,练习,以及常常还有失败。承认增量的改善对确保我们不会放弃是很有必要的。 +[Kaizen(改善)][4]是持续改进和学习的实践。小的量变积累随着时间的推移可以引起质变。我发现它和卡罗尔·德韦克的[成长型思维][5]的想法很相似。人们不是生来就是专家。在某方面拥有经验需要花费时间、练习,以及常常还有失败。承认增量的改善对确保我们不会放弃是很有必要的。 -另一方面,[Kaikaku(改革)][6]的概念是指,长时间的小的改变有时不能起作用,你需要做一些完全的或破坏性的改变。在没有找到下份工作前就辞职或移居新城市就足够有破坏性——是的,两者我都做过。但这些彻底的改变收获巨大。如果我没有辞职并休息一段时间,我也许不会接触到 DevOps。等我决定继续工作的时候,我一直听到 DevOps,我开始研究它。这引导我参加了我的第一个 DevOps 日,从那里我开始看到我的所有热情开始聚集。从那时起,我已经参加了五次 DevOps 日活动,并且定期撰写关于 DevOps 话题的文章。 +另一方面,[Kaikaku(改革)][6]的概念是指,长时间的小的改变有时不能起作用,你需要做一些完全的或破坏性的改变。在没有找到下份工作前就辞职或移居新城市就足够有破坏性 —— 是的,两者我都做过。但这些彻底的改变收获巨大。如果我没有辞职并休息一段时间,我也许不会接触到 DevOps。等我决定继续工作的时候,我一直听到 DevOps,我开始研究它。这引导我参加了我的第一个 DevOps 日,从那里我开始看到我的所有热情开始聚集。从那时起,我已经参加了五次 DevOps 日活动,并且定期撰写关于 DevOps 话题的文章。 ### 将三步工作法用到工作中 改变是困难的,学习新事物可以听起来很吓人。DevOps 的三步工作法提供了一个管理改变的框架。比如:信息流动是怎样的?是什么驱动着你做出改变?一旦你认为一个改变是必需的,你如何获得这个改变是否正确的反馈?你如何知道你在取得进展?反馈是必要的,并且应该包含积极和有建设性的要素。困难的地方在于保证建设性的要素不要重于积极要素。 -对我而言,第三步——持续实验和学习——是 DevOps 最重要的部分。有一个可以自由地实验和冒险的环境,人们可以获得意想不到的结果。有时这些结果是好的,有时不是太好——但这没事。创建一个可以接受失败结果的环境可以鼓励人们冒险。我们都应该力争定期的持续实验和学习。 +对我而言,第三步 —— 持续实验和学习 —— 是 DevOps 最重要的部分。有一个可以自由地实验和冒险的环境,人们可以获得意想不到的结果。有时这些结果是好的,有时不是太好 —— 但这没事。创建一个可以接受失败结果的环境可以鼓励人们冒险。我们都应该力争定期的持续实验和学习。 DevOps 的三步工作法提供了一个尝试,获得反馈,以及从错误中获取经验的方法。几年前,我的儿子告诉我,“我从来就没想做到最好,因为那样我就没法从我的错误中学到东西了。”我们都会犯错,从中获得经验帮助我们成长和改善。如果我们的文化不支持尝试和学习,我们就不会愿意去犯错。 @@ -60,7 +59,7 @@ via: https://opensource.com/article/18/11/how-non-engineer-got-devops 作者:[Dawn Parych][a] 选题:[lujun9972][b] 译者:[alim0x](https://github.com/alim0x) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From f8f96e530cba62b80c69e3cc3bda911d4b3036e7 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 26 Dec 2018 19:51:49 +0800 Subject: [PATCH 082/322] PUB:20181121 DevOps is for everyone.md @alim0x https://linux.cn/article-10386-1.html --- .../talk => published}/20181121 DevOps is for everyone.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20181121 DevOps is for everyone.md (98%) diff --git a/translated/talk/20181121 DevOps is for everyone.md b/published/20181121 DevOps is for everyone.md similarity index 98% rename from translated/talk/20181121 DevOps is for everyone.md rename to published/20181121 DevOps is for everyone.md index df9e41ffd1..c4c61486e6 100644 --- a/translated/talk/20181121 DevOps is for everyone.md +++ b/published/20181121 DevOps is for everyone.md @@ -1,11 +1,11 @@ [#]: collector: (lujun9972) [#]: translator: (alim0x) [#]: reviewer: (wxy) -[#]: publisher: ( ) +[#]: publisher: (wxy) [#]: subject: (DevOps is for everyone) [#]: via: (https://opensource.com/article/18/11/how-non-engineer-got-devops) [#]: author: (Dawn Parych https://opensource.com/users/dawnparzych) -[#]: url: ( ) +[#]: url: (https://linux.cn/article-10386-1.html) 所有人的 DevOps ====== From de8c02aee1d0e542dec1a81252051dcfc6f17b00 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 26 Dec 2018 20:05:19 +0800 Subject: [PATCH 083/322] PRF:20181213 Relax by the fire at your Linux terminal.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @zhs852 恭喜你完成了第一篇翻译! --- ... Relax by the fire at your Linux terminal.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/translated/tech/20181213 Relax by the fire at your Linux terminal.md b/translated/tech/20181213 Relax by the fire at your Linux terminal.md index b3532cbd83..75e856d74f 100644 --- a/translated/tech/20181213 Relax by the fire at your Linux terminal.md +++ b/translated/tech/20181213 Relax by the fire at your Linux terminal.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (zhs852) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Relax by the fire at your Linux terminal) @@ -9,7 +9,8 @@ 在 Linux 终端中观看火焰 ====== -何不在命令行中进行一次“烧烤”呢? + +> 何不在命令行中进行一次“烧烤”呢? ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-aafire.png?itok=pAttiVvG) @@ -19,15 +20,15 @@ 如果你住在北半球的非热带地区,可能冬季来临时你会被冻得满脸通红。住在这里的我,最喜欢的事情便是在火炉旁惬意地边喝茶边读书。 -不幸的是,我家刚好缺个放火炉的地方。不过,多亏了今天我要介绍的 **aafire** ,我仍然可以假装我坐在火炉旁。 +不幸的是,我家刚好缺个放火炉的地方。不过,多亏了今天我要介绍的 `aafire` ,我仍然可以假装我坐在火炉旁。 -在我所使用的系统里, **aafire** 被打包进了 **aalib** 。 **aalib** 是一个受人喜爱的库,它可以很方便地将图像转换成 ASCII 图并输出到终端(或其它任何地方)。 **aalib** 将多种多样的图像带入了 Linux 终端。你可以看看本系列的其它文章,了解一下其它小程序,以便配合使用并充分利用它们。在 Fedora 中,你可以通过以下命令来安装 **aalib** : +在我所使用的系统里, `aafire` 被打包进了 aalib 。 aalib 是一个受人喜爱的库,它可以很方便地将图像转换成 ASCII 图并输出到终端(或其它任何地方)。 aalib 将多种多样的图像带入了 Linux 终端。你可以看看本系列的其它文章,了解一下其它小程序,以便配合使用并充分利用它们。在 Fedora 中,你可以通过以下命令来安装 aalib : ``` $ sudo dnf install aalib ``` -接着,试着运行 **aafire** 命令。 **aalib** 默认会使用 GUI 模式,我们要进行一些操作来让它在终端中运行(毕竟这一系列文章都讲的是命令行)。十分幸运的是,仅需安装 [curses][1] 就能实现我们想要的效果。请执行: +接着,试着运行 `aafire` 命令。 `aalib` 默认会使用 GUI 模式,我们要进行一些操作来让它在终端中运行(毕竟这一系列文章都讲的是命令行)。十分幸运的是,仅需安装 [curses][1] 就能实现我们想要的效果。请执行: ``` $ aafire -driver curses @@ -35,11 +36,11 @@ $ aafire -driver curses ![](https://opensource.com/sites/default/files/uploads/linux-toy-aafire-animated.gif) -如果你觉得 **aa-lib** 挺有意思,可以在 [Sourceforge][2] 上找到它的源码(以 LGPLv2 许可证开源)。 +如果你觉得 aalib 挺有意思,可以在 [Sourceforge][2] 上找到它的源码(以 LGPLv2 许可证开源)。 欢迎将你觉得有意思的命令行小程序投稿到原作者处,只需在原文下留言即可。 -如果有兴趣,可以查看原作者的上一篇文章: [Patch into The Matrix at the Linux command line][3] 。 +如果有兴趣,可以查看原作者的上一篇文章: [在命令行中步入黑客帝国][3] 。 -------------------------------------------------------------------------------- @@ -48,7 +49,7 @@ via: https://opensource.com/article/18/12/linux-toy-aafire 作者:[Jason Baker][a] 选题:[lujun9972][b] 译者:[zhs852](https://github.com/zhs852) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 9e621a8d9cf7c2487057aecb73dd469243d34edd Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 26 Dec 2018 20:06:45 +0800 Subject: [PATCH 084/322] PUB:20181213 Relax by the fire at your Linux terminal.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @zhs852 本文首发地址:https://linux.cn/article-10387-1.html 您的 LCTT 专页地址: https://linux.cn/lctt/zhs852 请注册领取LCCN :https://lctt.linux.cn/ --- .../20181213 Relax by the fire at your Linux terminal.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181213 Relax by the fire at your Linux terminal.md (97%) diff --git a/translated/tech/20181213 Relax by the fire at your Linux terminal.md b/published/20181213 Relax by the fire at your Linux terminal.md similarity index 97% rename from translated/tech/20181213 Relax by the fire at your Linux terminal.md rename to published/20181213 Relax by the fire at your Linux terminal.md index 75e856d74f..5b286e36a8 100644 --- a/translated/tech/20181213 Relax by the fire at your Linux terminal.md +++ b/published/20181213 Relax by the fire at your Linux terminal.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (zhs852) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10387-1.html) [#]: subject: (Relax by the fire at your Linux terminal) [#]: via: (https://opensource.com/article/18/12/linux-toy-aafire) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) From 4280d68cfab4048790cc537c133ba9288255a2d4 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 26 Dec 2018 21:17:48 +0800 Subject: [PATCH 085/322] PRF:20180101 27 open solutions to everything in education.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @lixinyuxx 这篇翻译不够细心 --- ...en solutions to everything in education.md | 89 ++++++++----------- 1 file changed, 35 insertions(+), 54 deletions(-) diff --git a/translated/tech/20180101 27 open solutions to everything in education.md b/translated/tech/20180101 27 open solutions to everything in education.md index 43f4717c1f..48a4f3fa3c 100644 --- a/translated/tech/20180101 27 open solutions to everything in education.md +++ b/translated/tech/20180101 27 open solutions to everything in education.md @@ -1,72 +1,52 @@ -27个解决教学问题的开放式方法 +27 个全方位的开放式教育解决方案 ====== + +> 阅读这些 2017 年 Opensource.com 发布的开放如何改进教育和学习的好文章。 + ![27 open solutions to everything in education](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/EDU_OpenEducationResources_520x292_cm.png?itok=9y4FGgRo) -开放式理念 (从开源软件到开放硬件, 再到开放原则) 正在改变教育的范式。因此, 为了庆祝今年发生的一切, 我收集了2017年在 Opensource.com 上发表的27篇关于这个主题的最好的文章。我把它们分成明确的主题, 而不是按人气来分类。而且, 如果这27个故事不能满足你对教育公开信息的胃口, 那就看看我们的合作文章吧 “ [education is leveraging Raspberry Pi and Linux][30]” +开放式理念 (从开源软件到开放硬件,再到开放原则) 正在改变教育的范式。因此,为了庆祝今年发生的一切,我收集了 2017 年(译注:本文原发布于 2018 年初)在 Opensource.com 上发表的 27 篇关于这个主题的最好的文章。我把它们分成明确的主题,而不是按人气来分类。而且,如果这 27 个故事不能满足你对教育方面开源信息的胃口,那就看看我们的合作文章吧 “[教育如何借助 Linux 和树莓派][30]”。 ### 开放对每个人都有好处 -1. [Book review: 'OPEN' explores broad cultural implications of openness][1]: Scott Nesbitt 评价David Price 的书 'OPEN' ,该书探讨了 “开放” 不仅仅是技术转变的观点, 而是 “我们未来将如何工作、生活和学习”。 - -2. [Jump-start your career with open source skills][2]: VM (Vicky) Brasseur 指出了如何利用开放式学习在工作群体中脱颖而出。 这个建议不仅仅是针对程序员的, 而是针对程序员的。设计师、作家、营销人员和其他创意专业人士也是开放式成功的关键。 - -3. [A graduate degree could springboard you into an open source job][3]: 引用的研究表明会 Linux 技能会带来更高的薪水, Joshua Pearce 说对开源的熟练和研究生学位是无与伦比的职业技能组合。 - -4. [These 3 practices revolutionized Penn Manor's school culture][4]: Charlie Reisinger 向我们展示了开放的做法是如何在宾夕法尼亚州的一个学区创造一种更具包容性、敏捷性和开放性的文化的。 Charlie 说, 这不仅仅是为了省钱;该区还受益于 “开放式领导原则, 促进师生创新, 帮助更好地吸引社区, 创造一个更有活力和包容性的学习社区”。 - -5. [15 ways to empower students with open source tools][5]: 我写开源是如何让学生自由探索、补拙和学习的, 不管他们是在学习基本的数字化素养, 还是通过有趣的项目来扩展这些技能。 - -6. [Developer opportunities to code for good][6]: 开源往往是对社会有益的项目的支柱。正如 Benetech Labs 副总裁 Ahn Bui 在这次采访中指出的那样: “建立开放数据标准是打破数据孤岛不可或缺的一步。这些开放标准将为互操作性提供基础, 进而转化为更多的组织共同建设, 往往更具成本效益。最终目标是以同样的成本甚至更低的成本为更多的人服务。” +1. [书评:《OPEN》探讨了开放性的广泛文化含义][1]:Scott Nesbitt 评价 David Price 的书 《OPEN》 ,该书探讨了 “开放” 不仅仅是技术转变的观点,而是 “我们未来将如何工作、生活和学习”。 +2. [通过开源技能快速开始您的职业生涯][2]: VM (Vicky) Brasseur 指出了如何借助学习开源在工作群体中脱颖而出。这个建议不仅仅是针对程序员的;设计师、作家、营销人员和其他创意专业人士也对开源的成功至关重要。 +3. [研究生学位可以让你跳槽到开源职位][3]:引用的研究表明会 Linux 技能会带来更高的薪水, Joshua Pearce 说对开源的熟练和研究生学位是无与伦比的职业技能组合。 +4. [彻底改变了宾夕法尼亚的学校文化的三种实践][4]:Charlie Reisinger 向我们展示了开放式实践是如何在宾夕法尼亚州的一个学区创造一种更具包容性、敏捷性和开放性的文化的。Charlie 说,这不仅仅是为了省钱;该区还受益于 “开放式领导原则,促进师生创新,帮助更好地吸引社区,创造一个更有活力和包容性的学习社区”。 +5. [使用开源工具促使学生进步的 15 种方法][5]:我写了开源是如何让学生自由探索、补拙和学习的,不管他们是在学习基本的数字化素养,还是通过有趣的项目来扩展这些技能。 +6. [开发人员有机会编写好的代码][6]:开源往往是对社会有益的项目的支柱。正如 Benetech Labs 副总裁 Ahn Bui 在这次采访中指出的那样:“建立开放数据标准是打破数据孤岛不可或缺的一步。这些开放标准将为互操作性提供基础,进而转化为更多的组织共同建设,往往更具成本效益。最终目标是以同样的成本甚至更低的成本为更多的人服务。” ### 用于再融合和再利用的开放式教育资源 -1. [Can academic faculty members teach with Wikipedia?][7] LiAnna Davis,Wiki Ed 的, 项目总监,讨论开放教育资源 (OERs) ,如 Wiki Ed,如何提供高质量且经济实惠的开源学习资源作为课堂教学工具。 - -2. [Are textbooks in or out? The state of open educational resources][8]: Cable Green,是 Creative Common 开放教育主任,分享高等教育中教育面貌是如何变化的, 以及 Creative Common 正在采取哪些措施来促进教育。 - -3. [School systems desperate for standards-aligned curricula find hope][9]: Karen Vaites,是 Open Up Resources 社区的福音传教士和首席营销官, 谈论非营利组织努力为 K-12 学校提供开放的, 标准一致的课程。 - -4. [How the University of Hawaii is solving today's higher ed problems][10]: Billy Meinke , Hawaii 大学 Manoa 分校的教育技术专家,他说, 在大学课程中过渡到 ORE 将 “使教师能够控制他们教授的内容, 我们预计这将为他们节省学生的费用。” - -5. [How open courses are slashing the cost of higher education][11]: Saylor Academy 的教育主任 Devon Ritter 报告了 Saylor 是如何建立以公开许可内容为基础的大学学分课程, 目的是使更多的人能够负担得起和获得高等教育。 - -6. [Open educational resources movement gains speed][12]: Alexis Clifton,State University of New York 的 OER 服务的执行主任, 描述了纽约800万美元的投资如何刺激开放教育的增长, 并使大学更实惠。 - -7. [Open project collaboration from elementary to university classrooms][13]: Aria F. Chernik 在Duke University 探索 OSPRI (Open Source Pedagogy Research and Innovation,开源教育学的研究与创新), 在 Duke 和 Red Hat 的联合合作这是建立一个21世纪的, preK-12 学习生态系统, 是开放的设计。 - -8. [Perma.cc stops scholarly link rot][14]: Virginia Tech 的 Phillip Young 写关于 Perma.cc, “link rot”(链接失效) 的解决方案 很大可能在学术论文中的超链接随着时间的推移而消失或变化。 - -9. [Open education: How students save money by creating open textbooks][15]: OER 先驱 Robin DeRosa 谈到 “公开许可教科书引入的自由, 以及教育和学习应结合包容性生态系统, 以增强公益的总体理念”。 +1. [学术教员可以和维基百科一起教学吗?][7]:Wiki Ed 的项目总监 LiAnna Davis 讨论开放式教育资源open educational resources (OER) ,如 Wiki Ed,是如何提供高质量且经济实惠的开源学习资源作为课堂教学工具。 +2. [书本内外?开放教育资源的状态][8]:Cable Green 是 Creative Common 开放教育主管,分享了高等教育中教育面貌是如何变化的,以及 Creative Common 正在采取哪些措施来促进教育。 +3. [急需符合标准的课程的学校系统找到了希望][9]:Karen Vaites 是 Open Up Resources 社区布道师和首席营销官,谈论了非营利组织努力为 K-12 学校提供开放的、标准一致的课程。 +4. [夏威夷大学如何解决当今高等教育的问题][10]:夏威夷大学 Manoa 分校的教育技术专家 Billy Meinke 表示,在大学课程中过渡到 ORE 将 “使教师能够控制他们教授的内容,我们预计这将为他们节省学生的费用。” +5. [开放式课程如何削减高等教育成本][11]:塞勒学院的教育总监 Devon Ritter 报告了塞勒学院是如何建立以公开许可内容为基础的大学学分课程,目的是使更多的人能够负担得起和获得高等教育。 +6. [开放教育资源运动在提速][12]:Alexis Clifton 是纽约州立大学的 OER 服务的执行董事,描述了纽约 800 万美元的投资如何刺激开放教育的增长,并使大学更实惠。 +7. [开放项目合作,从小学到大学教室][13]:来自杜克大学的 Aria F. Chernik 探索 OSPRI (开源教育学的研究与创新), 这是杜克大学和红帽的合作,旨在建立一个 21 世纪的,开放设计的 preK-12 学习生态系统。 +8. [Perma.cc 将阻止学术链接腐烂][14]::弗吉尼亚理工大学的 Phillip Young 写的关于 Perma.cc 的文章,这种一种“链接腐烂”的解决方案,在学术论文中的超链接随着时间的推移而消失或变化的概览很高。 +9. [开放教育:学生如何通过创建开放教科书来节省资金][15]:OER 先驱 Robin DeRosa 谈到 “引入公开许可教科书的自由,以及教育和学习应结合包容性生态系统,以增强公益的总体理念”。 ### 课堂上的开源工具 -1. [How an open source board game is saving the planet][16]: Joshua Pearce 写的关于拯救地球的一个棋盘游戏, 使学生能够解决环境问题, 同时有乐趣, 并为制造商社区作出贡献。 - -2. [A new Android app for teaching kids how to read][17]: Michael Hall 谈到他的儿子 Phoenicia,他在儿子被诊断为自闭症后开发的儿童识字应用, 为了产生更好的编码价值, 以及为什么用户测试比你想象的更重要。 - -3. [8 open source Android apps for education][18]: Joshua Allen Holm 通过推荐 F-Droid 存储库中的8个开源应用来尝试, 这将挑战我们将智能手机用作学习工具。 - -4. [3 open source alternatives to MATLAB][19]: Jason Baker's 更新了他2016年的开源数学计算软件调查, 提出了 MATLAB 的替代方案, 这是数学、物理科学、工程和经济学中几乎无处不在的昂贵的专用解决方案。 - -5. [What does SVG have to do with teaching kids to code?][20] 退休工程师 Jay Nick 谈论他如何使用艺术作为一种创造性的方式, 向学生介绍编码。他在学校做志愿者, 使用可缩放矢量图形 (SVG,Scalable Vector Graphics) 教授一种结合数学和艺术原理的编码方法。 - -6. [5 myths busted: Using open source in higher education][21]: Kyle Conway, 在 Texas Tech 拥有美术博士学位分享他在单一解决方案统治的世界中使用开源工具的经验。 Kyle 说有一种偏见, 反对在计算机科学以外的学科中使用开源:“很多人认为非技术专业的学生不能使用 Linux, 他们对在高级学位课程中使用 Linux 的人做出了很多假设。...嗯, 这是有可能的, 我就是证明。” - -7. [A list of open source tools for college][22]: Aaron Cocker 概述了他在攻读计算机科学本科学位时使用的开源工具 (包括演示、备份和编程软件)。 - -8. [5 great KDE apps to help you study][23]: Zsolt Szakács 提供五个 KDE 应用程序, 帮助任何想要学习新技能或培养现有技能的人。 +1. [开源棋盘游戏如何拯救地球][16]:Joshua Pearce 写的关于拯救地球的一个棋盘游戏,这是一款让学生在玩乐和为创客社区做出贡献的同时解决环境问题的棋盘游戏。 +2. [一个教孩子们如何阅读的新 Android 应用程序][17]:Michael Hall 谈到了他在儿子被诊断为自闭症后为他开发的儿童识字应用 Phoenicia,以及良好编码的价值,和为什么用户测试比你想象的更重要。 +3. [8 个用于教育的开源 Android 应用程序][18]:Joshua Allen Holm 推荐了 8 个来自 F-Droid 软件库的开源应用,使我们可以将智能手机用作学习工具。 +4. [MATLA B的 3 种开源替代方案][19]:Jason Baker 更新了他 2016 年的开源数学计算软件调查报告,提供了 MATLAB 的替代方案,这是数学、物理科学、工程和经济学中几乎无处不在的昂贵的专用解决方案。 +5. [SVG 与教孩子编码有什么关系?][20]:退休工程师 Jay Nick 谈论他如何使用艺术作为一种创新的方式,向学生介绍编码。他在学校做志愿者,使用 SVG 来教授一种结合数学和艺术原理的编码方法。 +6. [5 个破灭的神话:在高等教育中使用开源][21]: 拥有德克萨斯理工大学美术博士学位的 Kyle Conway 分享他在一个由专有解决方案统治的世界中使用开源工具的经验。 Kyle 说有一种偏见,反对在计算机科学以外的学科中使用开源:“很多人认为非技术专业的学生不能使用 Linux,他们对在高级学位课程中使用 Linux 的人做出了很多假设……嗯,这是有可能的,我就是证明。” +7. [大学开源工具列表][22]:Aaron Cocker 概述了他在攻读计算机科学本科学位时使用的开源工具 (包括演示、备份和编程软件)。 +8. [5 个可帮助您学习优秀 KDE 应用程序][23]:Zsolt Szakács 提供五个 KDE 应用程序,可以帮助任何想要学习新技能或培养现有技能的人。 ### 在教室编码 -1. [How to get the next generation coding early][24]: Bryson Payne 说我们需要教孩子们在高中前编码: 到了九年级, 80% 的女孩和60% 的男孩已经从 STEM 职业中自选。但他建议, 这不仅仅是就业和缩小 IT 技能差距的问题。“教一个年轻人编写代码可能是你能给他们的最改变生活的技能。而且这不仅仅是一个职业提升者。编码是关于解决问题, 它是关于创造力, 更重要的是, 它是关于授权。 +1. [如何尽早让下一代编码][24]:Bryson Payne 说我们需要在高中前教孩子们学会编码: 到了九年级,80% 的女孩和 60% 的男孩已经从 STEM 职业中自选。但他建议,这不仅仅是就业和缩小 IT 技能差距的问题。“教一个年轻人编写代码可能是你能给他们的最改变生活的技能。而且这不仅仅是一个职业提升者。编码是关于解决问题,它是关于创造力,更重要的是,它是提升能力”。 +2. [孩子们无法在没有计算机的情况下编码][25]:Patrick Masson 推出了 FLOSS 儿童桌面计划, 该计划教授服务不足学校的学生使用开源软件 (如 Linux、LibreOffice 和 GIMP) 重新利用较旧的计算机。该计划不仅为破旧或退役的硬件注入新的生命,还为学生提供了重要的技能,而且还为学生提供了可能转化为未来职业生涯的重要技能。 +3. [如今 Scratch 是否能像 80 年代的 LOGO 语言一样教孩子们编码?][26]:Anderson Silva 提出使用 [Scratch][27] 以激发孩子们对编程的兴趣,就像在 20 世纪 80 年代开始使用 LOGO 语言时一样。 +4. [通过这个拖放框架学习Android开发][28]:Eric Eslinger 介绍了 App Inventor,这是一个编程框架,用于构建 Android 应用程序使用可视块语言(类似 Scratch 或者 [Snap][29])。 -2. [Kids can't code without computers][25]: Patrick Masson 推出了 FLOSS 儿童桌面计划, 该计划教授服务不足学校的学生使用开源软件 (如 Linux、LibreOffice 和 GIMP) 重新设计较旧的计算机。该计划不仅为破旧或退役的硬件注入新的生命, 还为学生提供了重要的技能, 这些技能可能会利于转化为未来的职业。 - -3. [Is Scratch today like the Logo of the '80s for teaching kids to code?][26] Anderson Silva 提出 [Scratch][27] 的使用建议以激发孩子们对编程的兴趣, 就像 LOGO 在20世纪80年代开始使用它时一样。 - -4. [Learn Android development with this drag-and-drop framework][28]: Eric Eslinger 描述应用发明者, 一个编程框架, 用于构建 Android 应用程序使用可视块语言 (类似 Scratch 或者[Snap][29]). - -在这一年里, 我们了解到, 教育领域的一切都有一个开放的解决方案, 我预计这一主题将在2018年及以后继续下去。在未来的一年里, 你是否希望 Opensource.com 涵盖开放式的教育主题?如果是, 请在评论中分享你的想法。 +在这一年里,我们了解到,教育领域的各个方面都有了开放的解决方案,我预计这一主题将在 2018 年及以后继续下去。在未来的一年里,你是否希望 Opensource.com 涵盖开放式的教育主题?如果是, 请在评论中分享你的想法。 -------------------------------------------------------------------------------- @@ -74,7 +54,7 @@ via: https://opensource.com/article/18/1/best-open-education 作者:[Don Watkins][a] 译者:[lixinyuxx](https://github.com/lixinyuxx) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -108,3 +88,4 @@ via: https://opensource.com/article/18/1/best-open-education [27]:https://scratch.mit.edu/ [28]:https://opensource.com/article/17/8/app-inventor-android-app-development [29]:http://snap.berkeley.edu/ +[30]:https://opensource.com/article/17/12/best-opensourcecom-linux-and-raspberry-pi-education From 4c9772b35641aec2b56d20cbbfbd874d98d70649 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 26 Dec 2018 21:18:28 +0800 Subject: [PATCH 086/322] PUB:20180101 27 open solutions to everything in education.md @lixinyuxx https://linux.cn/article-10388-1.html --- .../20180101 27 open solutions to everything in education.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180101 27 open solutions to everything in education.md (100%) diff --git a/translated/tech/20180101 27 open solutions to everything in education.md b/published/20180101 27 open solutions to everything in education.md similarity index 100% rename from translated/tech/20180101 27 open solutions to everything in education.md rename to published/20180101 27 open solutions to everything in education.md From 99f483aaae7d60d5d54033ffea8ad0155422dfde Mon Sep 17 00:00:00 2001 From: MjSeven Date: Wed, 26 Dec 2018 22:27:33 +0800 Subject: [PATCH 087/322] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ..., Groups and Other Linux Beasts- Part 2.md | 111 ------------------ ..., Groups and Other Linux Beasts- Part 2.md | 105 +++++++++++++++++ 2 files changed, 105 insertions(+), 111 deletions(-) delete mode 100644 sources/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md create mode 100644 translated/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md diff --git a/sources/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md b/sources/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md deleted file mode 100644 index b6d2552264..0000000000 --- a/sources/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md +++ /dev/null @@ -1,111 +0,0 @@ -Translating by MjSeven -Users, Groups and Other Linux Beasts: Part 2 -====== -![](https://www.linux.com/blog/learn/intro-to-linux/2018/7/users-groups-and-other-linux-beasts-part-2) -In this ongoing tour of Linux, we’ve looked at [how to manipulate folders/directories][1], and now we’re continuing our discussion of _permissions_ , _users_ and _groups_ , which are necessary to establish who can manipulate which files and directories. [Last time,][2] we showed how to create new users, and now we’re going to dive right back in: - -You can create new groups and then add users to them at will with the `groupadd` command. For example, using: -``` -sudo groupadd photos - -``` - -will create the _photos_ group. - -You’ll need to [create a directory][1] hanging off the root directory: -``` -sudo mkdir /photos - -``` - -If you run `ls -l /`, one of the lines will be: -``` -drwxr-xr-x 1 root root 0 jun 26 21:14 photos - -``` - -The first _root_ in the output is the user owner and the second _root_ is the group owner. - -To transfer the ownership of the _/photos_ directory to the _photos_ group, use -``` -chgrp photos /photos - -``` - -The `chgrp` command typically takes two parameters, the first parameter is the group that will take ownership of the file or directory and the second is the file or directory you want to give over to the the group. - -Next, run `ls -l /` and you'll see the line has changed to: -``` -drwxr-xr-x 1 root photos 0 jun 26 21:14 photos - -``` - -You have successfully transferred the ownership of your new directory over to the _photos_ group. - -Then, add your own user and the _guest_ user to the _photos_ group: -``` -sudo usermod -a -G photos -sudo usermod guest -a -G photos - -``` - -You may have to log out and log back in to see the changes, but, when you do, running `groups` will show _photos_ as one of the groups you belong to. - -A couple of things to point out about the `usermod` command shown above. First: Be careful not to use the `-g` option instead of `-G`. The `-g` option changes your primary group and could lock you out of your stuff if you use it by accident. `-G`, on the other hand, _adds_ you to the groups listed and doesn't mess with the primary group. If you want to add your user to more groups than one, list them one after another, separated by commas, no spaces, after `-G`: -``` -sudo usermod -a -G photos,pizza,spaceforce - -``` - -Second: Be careful not to forget the `-a` parameter. The `-a` parameter stands for _append_ and attaches the list of groups you pass to `-G` to the ones you already belong to. This means that, if you don't include `-a`, the list of groups you already belong to, will be overwritten, again locking you out from stuff you need. - -Neither of these are catastrophic problems, but it will mean you will have to add your user back manually to all the groups you belonged to, which can be a pain, especially if you have lost access to the _sudo_ and _wheel_ group. - -### Permits, Please! - -There is still one more thing to do before you can copy images to the _/photos_ directory. Notice how, when you did `ls -l /` above, permissions for that folder came back as _drwxr-xr-x_. - -If you read [the article I recommended at the beginning of this post][3], you'll know that the first _d_ indicates that the entry in the file system is a directory, and then you have three sets of three characters ( _rwx_ , _r-x_ , _r-x_ ) that indicate the permissions for the user owner ( _rwx_ ) of the directory, then the group owner ( _r-x_ ), and finally the rest of the users ( _r-x_ ). This means that the only person who has write permissions so far, that is, the only person who can copy or create files in the _/photos_ directory, is the _root_ user. - -But [that article I mentioned also tells you how to change the permissions for a directory or file][3]: -``` -sudo chmod g+w /photos - -``` - -Running `ls -l /` after that will give you _/photos_ permissions as _drwxrwxr-x_ which is what you want: group members can now write into the directory. - -Now you can try and copy an image or, indeed, any other file to the directory and it should go through without a problem: -``` -cp image.jpg /photos - -``` - -The _guest_ user will also be able to read and write from the directory. They will also be able to read and write to it, and even move or delete files created by other users within the shared directory. - -### Conclusion - -The permissions and privileges system in Linux has been honed over decades. inherited as it is from the old Unix systems of yore. As such, it works very well and is well thought out. Becoming familiar with it is essential for any Linux sysadmin. In fact, you can't do much admining at all unless you understand it. But, it's not that hard. - -Next time, we'll be dive into files and see the different ways of creating, manipulating, and destroying them in creative ways. Always fun, that last one. - -See you then! - -Learn more about Linux through the free ["Introduction to Linux" ][4]course from The Linux Foundation and edX. - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/learn/intro-to-linux/2018/7/users-groups-and-other-linux-beasts-part-2 - -作者:[Paul Brown][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.linux.com/users/bro66 -[1]:https://www.linux.com/blog/learn/2018/5/manipulating-directories-linux -[2]:https://www.linux.com/learn/intro-to-linux/2018/7/users-groups-and-other-linux-beasts -[3]:https://www.linux.com/learn/understanding-linux-file-permissions -[4]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux diff --git a/translated/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md b/translated/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md new file mode 100644 index 0000000000..c4f20dbf77 --- /dev/null +++ b/translated/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md @@ -0,0 +1,105 @@ +用户、组及其他 Linux 特性:第二部分 +====== + +![](https://www.linux.com/blog/learn/intro-to-linux/2018/7/users-groups-and-other-linux-beasts-part-2) + +在正在进行的 Linux 之旅中,我们了解了[如何操作文件夹或目录][1],现在我们继续讨论 _权限_,_用户_ 和 _组_,这对于确定谁可以操作哪些文件和目录是必要的。[上次][2],我们展示了如何创建新用户,现在我们将重新来一遍: + +你可以使用 `groupadd` 命令创建新组,然后随意添加用户。例如,使用: +``` +sudo groupadd photos +``` + +这将会创建 _photos_ 组。 + +你需要在根目录下[创建一个目录][1]: +``` +sudo mkdir /photos +``` + +如果你运行 `ls -l /`,结果中会有如下这一行: +``` +drwxr-xr-x 1 root root 0 jun 26 21:14 photos +``` + +输出中的第一个 _root_ 是所属的用户,第二个 _root_ 是所属的组。 + +要将 _/photos_ 目录的所有权转移到 _photos_ 组,使用: +``` +chgrp photos /photos +``` + +`chgrp` 命令通常采用两个参数,第一个参数是将要获得文件或目录所有权的组,第二个参数是希望交给组的文件或目录。 + +接着,运行 `ls -l /`,你会发现刚才那一行变了: +``` +drwxr-xr-x 1 root photos 0 jun 26 21:14 photos +``` + +你已成功将新目录的所有权转移到了 _photos_ 组。 + +然后,将你自己的用户和 _guest_ 用户添加到 _photos_ 组: +``` +sudo usermod <你的用户名> -a -G photos +sudo usermod guest -a -G photos +``` + +你可能必须注销并重新登录才能看到更改,但是当你这样做时,运行 `groups` 会将 _photos_ 显示为你所属的组之一。 + +(to 校正:这里的 primary group 翻译成什么更好点呢) +关于上面提到的 `usermod` 命令,需要指明几点。第一:注意要使用 `-G` 选项而不是 `-g` 选项。`-g` 选项更改你的主要组,如果你意外地使用它,它可能会锁定你的一些东西。另一方面,`-G` 将你 _添加(add)_ 到列出的组中,并没有干扰主要组。如果要将用户添加到多个组中,在 `-G` 之后逐个列出他们,用逗号分隔,不要有空格: +``` +sudo usermod -a -G photos,pizza,spaceforce +``` + +第二点:小心点不要忘记 `-a` 参数。`-a` 参数代表 _追加(append)_,将你传递给 `-G` 的组列表附加到你已经属于的组。这意味着,如果你不包含 `-a`,那么你之前所属的组列表将被覆盖,再次将你从你需要的东西中锁定。(to 校正:最后这句话什么意思呢) + +这些都不是灾难性问题,但这意味着你必须手动将用户添加回你所属的所有组,这可能是个麻烦,特别是如果你失去了对 _sudo_ 和 _wheel_ 组的访问权限。 + +### 权限 + +在将图像复制到 _/photos_ 目录之前,还要做一件事情。注意,当你执行上面的 `ls -l /` 时,该文件夹的权限将以 _drwxr-xr-x_ 形式返回。 + +如果你阅读[我在本文开头推荐的文章][3],你将知道第一个 _d_ 表示文件系统中的条目是一个目录,接着你有三组三个字符 (_rwx_, _r-x_, _r-x_),它们表示目录的所属用户 (_rwx_) 的权限,然后是所属组 (_r-x_)的权限,最后是其他用户 (_r-x_) 的权限。这意味着到目前为止唯一具有写权限的人,即能够在 _/photos_ 目录中复制或创建文件的唯一人员是 _root_ 用户。 + +但是[我提到的那篇文章也告诉你如何更改目录或文件的权限][3]: +``` +sudo chmod g+w /photos +``` + +运行 `ls -l /`,你会看到 _/photos_ 权限变为了 _drwxrwxr-x_。这就是你希望的:组成员现在可以对目录进行写操作了。 + +现在你可以尝试将图像或任何其他文件复制到目录中,它应该没有问题: +``` +cp image.jpg /photos +``` + +_guest_ 用户也可以从目录中读取和写入。他们也可以读取和写入,甚至移动或删除共享目录中其他用户创建的文件。(to 校正:这里 guest 可以从目录中读取和写入吗?guest 不应该是 r-x 权限吗?) + +### 总结 + +Linux 中的权限和特权系统已经磨练了几十年,它继承自昔日的旧 Unix 系统。就其本身而言,它工作的非常好,而且经过了深思熟虑。熟悉它对于任何 Linux 系统管理员都是必不可少的。事实上,除非你理解它,否则你根本就无法做很多事情。但是,这并不难。 + +下一次,我们将深入研究文件,并以一个创新的方式查看创建,操作和销毁文件的不同方法。最后一个总是很有趣。 + +回头见! + +通过 Linux 基金会和 edX 的免费[" Linux 简介"][4]课程了解有关 Linux 的更多信息。 + + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/intro-to-linux/2018/7/users-groups-and-other-linux-beasts-part-2 + +作者:[Paul Brown][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[MjSeven](https://github.com/MjSeven) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.linux.com/users/bro66 +[1]:https://www.linux.com/blog/learn/2018/5/manipulating-directories-linux +[2]:https://www.linux.com/learn/intro-to-linux/2018/7/users-groups-and-other-linux-beasts +[3]:https://www.linux.com/learn/understanding-linux-file-permissions +[4]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux From 2392354a6b5fba66ff7bdcbe0a60cb8d5006e069 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 26 Dec 2018 22:49:34 +0800 Subject: [PATCH 088/322] PRF: 20181016 Lab 5- File system, Spawn and Shell.md @qhwdw --- ...016 Lab 5- File system, Spawn and Shell.md | 198 ++++++++---------- 1 file changed, 89 insertions(+), 109 deletions(-) diff --git a/translated/tech/20181016 Lab 5- File system, Spawn and Shell.md b/translated/tech/20181016 Lab 5- File system, Spawn and Shell.md index 769b90bd20..dbd9a3b490 100644 --- a/translated/tech/20181016 Lab 5- File system, Spawn and Shell.md +++ b/translated/tech/20181016 Lab 5- File system, Spawn and Shell.md @@ -1,4 +1,4 @@ -实验 5:文件系统、Spawn 和 Shell +Caffeinated 6.828:实验 5:文件系统、Spawn 和 Shell ====== ### 简介 @@ -10,31 +10,31 @@ 使用 Git 去获取最新版的课程仓库,然后创建一个命名为 `lab5` 的本地分支,去跟踪远程的 `origin/lab5` 分支: ``` - athena% cd ~/6.828/lab - athena% add git - athena% git pull - Already up-to-date. - athena% git checkout -b lab5 origin/lab5 - Branch lab5 set up to track remote branch refs/remotes/origin/lab5. - Switched to a new branch "lab5" - athena% git merge lab4 - Merge made by recursive. - ..... - athena% +athena% cd ~/6.828/lab +athena% add git +athena% git pull +Already up-to-date. +athena% git checkout -b lab5 origin/lab5 +Branch lab5 set up to track remote branch refs/remotes/origin/lab5. +Switched to a new branch "lab5" +athena% git merge lab4 +Merge made by recursive. +..... +athena% ``` 在实验中这一部分的主要新组件是文件系统环境,它位于新的 `fs` 目录下。通过检查这个目录中的所有文件,我们来看一下新的文件都有什么。另外,在 `user` 和 `lib` 目录下还有一些文件系统相关的源文件。 -fs/fs.c 维护文件系统在磁盘上结构的代码 -fs/bc.c 构建在我们的用户级页故障处理功能之上的一个简单的块缓存 -fs/ide.c 极简的基于 PIO(非中断驱动的)IDE 驱动程序代码 -fs/serv.c 使用文件系统 IPC 与客户端环境交互的文件系统服务器 -lib/fd.c 实现一个常见的类 UNIX 的文件描述符接口的代码 -lib/file.c 磁盘上文件类型的驱动,实现为一个文件系统 IPC 客户端 -lib/console.c 控制台输入/输出文件类型的驱动 -lib/spawn.c spawn 库调用的框架代码 +- `fs/fs.c` 维护文件系统在磁盘上结构的代码 +- `fs/bc.c` 构建在我们的用户级页故障处理功能之上的一个简单的块缓存 +- `fs/ide.c` 极简的基于 PIO(非中断驱动的)IDE 驱动程序代码 +- `fs/serv.c` 使用文件系统 IPC 与客户端环境交互的文件系统服务器 +- `lib/fd.c` 实现一个常见的类 UNIX 的文件描述符接口的代码 +- `lib/file.c` 磁盘上文件类型的驱动,实现为一个文件系统 IPC 客户端 +- `lib/console.c` 控制台输入/输出文件类型的驱动 +- `lib/spawn.c` spawn 库调用的框架代码 -你应该再次去运行 `pingpong`、`primes`、和 `forktree`,测试实验 4 完成后合并到新的实验 5 中的代码能否正确运行。你还需要在 `kern/init.c` 中注释掉 `ENV_CREATE(fs_fs)` 行,因为 `fs/fs.c` 将尝试去做一些 I/O,而 JOS 到目前为止还不具备该功能。同样,在 `lib/exit.c` 中临时注释掉对 `close_all()` 的调用;这个函数将调用你在本实验后面部分去实现的子程序,如果现在去调用,它将导致 JOS 内核崩溃。如果你的实验 4 的代码没有任何 bug,将很完美地通过这个测试。在它们都能正常工作之前是不能继续后续实验的。在你开始做练习 1 时,不要忘记去取消这些行上的注释。 +你应该再次去运行 `pingpong`、`primes` 和 `forktree`,测试实验 4 完成后合并到新的实验 5 中的代码能否正确运行。你还需要在 `kern/init.c` 中注释掉 `ENV_CREATE(fs_fs)` 行,因为 `fs/fs.c` 将尝试去做一些 I/O,而 JOS 到目前为止还不具备该功能。同样,在 `lib/exit.c` 中临时注释掉对 `close_all()` 的调用;这个函数将调用你在本实验后面部分去实现的子程序,如果现在去调用,它将导致 JOS 内核崩溃。如果你的实验 4 的代码没有任何 bug,将很完美地通过这个测试。在它们都能正常工作之前是不能继续后续实验的。在你开始做练习 1 时,不要忘记去取消这些行上的注释。 如果它们不能正常工作,使用 `git diff lab4` 去重新评估所有的变更,确保你在实验 4(及以前)所写的代码在本实验中没有丢失。确保实验 4 仍然能正常工作。 @@ -44,11 +44,11 @@ lib/spawn.c spawn 库调用的框架代码 ### 文件系统的雏形 -你将要使用的文件系统比起大多数“真正的”文件系统(包括 xv6 UNIX 的文件系统)要简单的多,但它也是很强大的,足够去提供基本的特性:创建、读取、写入、和删除组织在层次目录结构中的文件。 +你将要使用的文件系统比起大多数“真正的”文件系统(包括 xv6 UNIX 的文件系统)要简单的多,但它也是很强大的,足够去提供基本的特性:创建、读取、写入和删除组织在层次目录结构中的文件。 到目前为止,我们开发的是一个单用户操作系统,它提供足够的保护并能去捕获 bug,但它还不能在多个不可信用户之间提供保护。因此,我们的文件系统还不支持 UNIX 的所有者或权限的概念。我们的文件系统目前也不支持硬链接、时间戳、或像大多数 UNIX 文件系统实现的那些特殊的设备文件。 -### 磁盘上文件系统结构 +### 磁盘上的文件系统结构 主流的 UNIX 文件系统将可用磁盘空间分为两种主要的区域类型:节点区域和数据区域。UNIX 文件系统在文件系统中为每个文件分配一个节点;一个文件的节点保存了这个文件重要的元数据,比如它的 `stat` 属性和指向数据块的指针。数据区域被分为更大的(一般是 8 KB 或更大)数据块,它在文件系统中存储文件数据和目录元数据。目录条目包含文件名字和指向到节点的指针;如果文件系统中的多个目录条目指向到那个文件的节点上,则称该文件是硬链接的。由于我们的文件系统不支持硬链接,所以我们不需要这种间接的级别,并且因此可以更方便简化:我们的文件系统将压根就不使用节点,而是简单地将文件的(或子目录的)所有元数据保存在描述那个文件的(唯一的)目录条目中。 @@ -71,6 +71,7 @@ UNIX xv6 文件系统使用 512 字节大小的块,与它底层磁盘的扇区 #### 文件元数据 ![File structure][2] + 元数据的布局是描述在我们的文件系统中的一个文件中,这个文件就是 `inc/fs.h` 中的 `struct File`。元数据包含文件的名字、大小、类型(普通文件还是目录)、指向构成这个文件的块的指针。正如前面所提到的,我们的文件系统中并没有节点,因此元数据是保存在磁盘上的一个目录条目中,而不是像大多数“真正的”文件系统那样保存在节点中。为简单起见,我们将使用 `File` 这一个结构去表示文件元数据,因为它要同时出现在磁盘上和内存中。 在 `struct File` 中的数组 `f_direct` 包含一个保存文件的前 10 个块(`NDIRECT`)的块编号的空间,我们称之为文件的直接块。对于最大 `10*4096 = 40KB` 的小文件,这意味着这个文件的所有块的块编号将全部直接保存在结构 `File` 中,但是,对于超过 40 KB 大小的文件,我们需要一个地方去保存文件剩余的块编号。所以我们分配一个额外的磁盘块,我们称之为文件的间接块,由它去保存最多 4096/4 = 1024 个额外的块编号。因此,我们的文件系统最多允许有 1034 个块,或者说不能超过 4MB 大小。为支持大文件,“真正的”文件系统一般都支持两个或三个间接块。 @@ -91,33 +92,28 @@ UNIX xv6 文件系统使用 512 字节大小的块,与它底层磁盘的扇区 只要我们依赖轮询、基于 “编程的 I/O”(PIO)的磁盘访问,并且不使用磁盘中断,那么在用户空间中实现磁盘访问还是很容易的。也可以去实现由中断驱动的设备驱动程序(比如像 L3 和 L4 内核就是这么做的),但这样做的话,内核必须接收设备中断并将它派发到相应的用户模式环境上,这样实现的难度会更大。 -x86 处理器在 EFLAGS 寄存器中使用 IOPL 位去确定保护模式中的代码是否允许执行特定的设备 I/O 指令,比如 `IN` 和 `OUT` 指令。由于我们需要的所有 IDE 磁盘寄存器都位于 x86 的 I/O 空间中而不是映射在内存中,所以,为了允许文件系统去访问这些寄存器,我们需要做的唯一的事情便是授予文件系统环境“I/O 权限”。实际上,在 EFLAGS 寄存器的 IOPL 位上规定,内核使用一个简单的“要么全都能访问、要么全都不能访问”的方法来控制用户模式中的代码能否访问 I/O 空间。在我们的案例中,我们希望文件系统环境能够去访问 I/O 空间,但我们又希望任何其它的环境完全不能访问 I/O 空间。 +x86 处理器在 EFLAGS 寄存器中使用 IOPL 位去确定保护模式中的代码是否允许执行特定的设备 I/O 指令,比如 `IN` 和 `OUT` 指令。由于我们需要的所有 IDE 磁盘寄存器都位于 x86 的 I/O 空间中而不是映射在内存中,所以,为了允许文件系统去访问这些寄存器,我们需要做的唯一的事情便是授予文件系统环境“I/O 权限”。实际上,在 EFLAGS 寄存器的 IOPL 位上规定,内核使用一个简单的“要么全都能访问、要么全都不能访问”的方法来控制用户模式中的代码能否访问 I/O 空间。在我们的案例中,我们希望文件系统环境能够去访问 I/O 空间,但我们又希望任何其它的环境完全不能访问 I/O 空间。 -```markdown -练习 1、`i386_init` 通过将类型 `ENV_TYPE_FS` 传递给你的环境创建函数 `env_create` 来识别文件系统。修改 `env.c` 中的 `env_create` ,以便于它只授予文件系统环境 I/O 的权限,而不授予任何其它环境 I/O 的权限。 +> **练习 1**、`i386_init` 通过将类型 `ENV_TYPE_FS` 传递给你的环境创建函数 `env_create` 来识别文件系统。修改 `env.c` 中的 `env_create` ,以便于它只授予文件系统环境 I/O 的权限,而不授予任何其它环境 I/O 的权限。 -确保你能启动这个文件系统环境,而不会产生一般保护故障。你应该要通过在 `make grade` 中的 "fs i/o" 测试。 -``` +> 确保你能启动这个文件系统环境,而不会产生一般保护故障。你应该要通过在 `make grade` 中的 "fs i/o" 测试。 -```markdown -问题 - - 1、当你从一个环境切换到另一个环境时,你是否需要做一些操作来确保 I/O 权限设置能被保存和正确地恢复?为什么? -``` +. +> **问题 1**、当你从一个环境切换到另一个环境时,你是否需要做一些操作来确保 I/O 权限设置能被保存和正确地恢复?为什么? 注意本实验中的 `GNUmakefile` 文件,它用于设置 QEMU 去使用文件 `obj/kern/kernel.img` 作为磁盘 0 的镜像(一般情况下表示 DOS 或 Windows 中的 “C 盘”),以及使用(新)文件 `obj/fs/fs.img` 作为磁盘 1 的镜像(”D 盘“)。在本实验中,我们的文件系统应该仅与磁盘 1 有交互;而磁盘 0 仅用于去引导内核。如果你想去恢复其中一个有某些错误的磁盘镜像,你可以通过输入如下的命令,去重置它们到最初的、”崭新的“版本: ``` - $ rm obj/kern/kernel.img obj/fs/fs.img - $ make +$ rm obj/kern/kernel.img obj/fs/fs.img +$ make ``` 或者: ``` - $ make clean - $ make +$ make clean +$ make ``` 小挑战!实现中断驱动的 IDE 磁盘访问,既可以使用也可以不使用 DMA 模式。由你来决定是否将设备驱动移植进内核中、还是与文件系统一样保留在用户空间中、甚至是将它移植到一个它自己的的单独的环境中(如果你真的想了解微内核的本质的话)。 @@ -132,45 +128,39 @@ x86 处理器在 EFLAGS 寄存器中使用 IOPL 位去确定保护模式中的 当然,将整个磁盘读入到内存中需要很长时间,因此,我们将它实现成”按需“分页的形式,那样我们只在磁盘映射区域中分配页,并且当在这个区域中产生页故障时,从磁盘读取相关的块去响应这个页故障。通过这种方式,我们能够假装将整个磁盘装进了内存中。 -```markdown -练习 2、在 `fs/bc.c` 中实现 `bc_pgfault` 和 `flush_block` 函数。`bc_pgfault` 函数是一个页故障服务程序,就像你在前一个实验中编写的写时复制 fork 一样,只不过它的任务是从磁盘中加载页去响应一个页故障。在你编写它时,记住: (1) `addr` 可能并不会做边界对齐,并且 (2) 在扇区中的 `ide_read` 操作并不是以块为单位的。 +> **练习 2**、在 `fs/bc.c` 中实现 `bc_pgfault` 和 `flush_block` 函数。`bc_pgfault` 函数是一个页故障服务程序,就像你在前一个实验中编写的写时复制 fork 一样,只不过它的任务是从磁盘中加载页去响应一个页故障。在你编写它时,记住: (1) `addr` 可能并不会做边界对齐,并且 (2) 在扇区中的 `ide_read` 操作并不是以块为单位的。 -(如果需要的话)函数 `flush_block` 应该会将一个块写入到磁盘上。如果在块缓存中没有块(也就是说,页没有映射)或者它不是一个脏块,那么 `flush_block` 将什么都不做。我们将使用虚拟内存硬件去跟踪,磁盘块自最后一次从磁盘读取或写入到磁盘之后是否被修改过。查看一个块是否需要写入时,我们只需要去查看 `uvpt` 条目中的 `PTE_D` 的 ”dirty“ 位即可。(`PTE_D` 位由处理器设置,用于表示那个页被写入;具体细节可以查看 x386 参考手册的 [第 5 章][3] 的 5.2.4.3 节)块被写入到磁盘上之后,`flush_block` 函数将使用 `sys_page_map` 去清除 `PTE_D` 位。 +>(如果需要的话)函数 `flush_block` 应该会将一个块写入到磁盘上。如果在块缓存中没有块(也就是说,页没有映射)或者它不是一个脏块,那么 `flush_block` 将什么都不做。我们将使用虚拟内存硬件去跟踪,磁盘块自最后一次从磁盘读取或写入到磁盘之后是否被修改过。查看一个块是否需要写入时,我们只需要去查看 `uvpt` 条目中的 `PTE_D` 的 ”dirty“ 位即可。(`PTE_D` 位由处理器设置,用于表示那个页被写入;具体细节可以查看 x386 参考手册的 [第 5 章][3] 的 5.2.4.3 节)块被写入到磁盘上之后,`flush_block` 函数将使用 `sys_page_map` 去清除 `PTE_D` 位。 -使用 `make grade` 去测试你的代码。你的代码应该能够通过 "check_bc"、"check_super"、和 "check_bitmap" 的测试。 -``` +> 使用 `make grade` 去测试你的代码。你的代码应该能够通过 "check_bc"、"check_super"、和 "check_bitmap" 的测试。 在 `fs/fs.c` 中的函数 `fs_init` 是块缓存使用的一个很好的示例。在初始化块缓存之后,它简单地在全局变量 `super` 中保存指针到磁盘映射区。在这之后,如果块在内存中,或我们的页故障服务程序按需将它们从磁盘上读入后,我们就能够简单地从 `super` 结构中读取块了。 -```markdown -小挑战!到现在为止,块缓存还没有清除策略。一旦某个块因为页故障被读入到缓存中之后,它将一直不会被清除,并且永远保留在内存中。给块缓存增加一个清除策略。在页表中使用 `PTE_A` 的 "accessed" 位来实现,任何环境访问一个页时,硬件就会设置这个位,你可以通过它来跟踪磁盘块的大致使用情况,而不需要修改访问磁盘映射区域的任何代码。使用脏块要小心。 -``` +. + +> **小挑战!**到现在为止,块缓存还没有清除策略。一旦某个块因为页故障被读入到缓存中之后,它将一直不会被清除,并且永远保留在内存中。给块缓存增加一个清除策略。在页表中使用 `PTE_A` 的 "accessed" 位来实现,任何环境访问一个页时,硬件就会设置这个位,你可以通过它来跟踪磁盘块的大致使用情况,而不需要修改访问磁盘映射区域的任何代码。使用脏块要小心。 ### 块位图 在 `fs_init` 设置了 `bitmap` 指针之后,我们可以认为 `bitmap` 是一个装满比特位的数组,磁盘上的每个块就是数组中的其中一个比特位。比如 `block_is_free`,它只是简单地在位图中检查给定的块是否被标记为空闲。 -```markdown -练习 3、使用 `free_block` 作为实现 `fs/fs.c` 中的 `alloc_block` 的一个模型,它将在位图中去查找一个空闲的磁盘块,并将它标记为已使用,然后返回块编号。当你分配一个块时,你应该立即使用 `flush_block` 将已改变的位图块刷新到磁盘上,以确保文件系统的一致性。 +> **练习 3**、使用 `free_block` 作为实现 `fs/fs.c` 中的 `alloc_block` 的一个模型,它将在位图中去查找一个空闲的磁盘块,并将它标记为已使用,然后返回块编号。当你分配一个块时,你应该立即使用 `flush_block` 将已改变的位图块刷新到磁盘上,以确保文件系统的一致性。 -使用 `make grade` 去测试你的代码。现在,你的代码应该要通过 "alloc_block" 的测试。 -``` +> 使用 `make grade` 去测试你的代码。现在,你的代码应该要通过 "alloc_block" 的测试。 ### 文件操作 在 `fs/fs.c` 中,我们提供一系列的函数去实现基本的功能,比如,你将需要去理解和管理结构 `File`、扫描和管理目录”文件“的条目、 以及从根目录开始遍历文件系统以解析一个绝对路径名。阅读 `fs/fs.c` 中的所有代码,并在你开始实验之前,确保你理解了每个函数的功能。 -```markdown -练习 4、实现 `file_block_walk` 和 `file_get_block`。`file_block_walk` 从一个文件中的块偏移量映射到 `struct File` 中那个块的指针上或间接块上,它非常类似于 `pgdir_walk` 在页表上所做的事。`file_get_block` 将更进一步,将去映射一个真实的磁盘块,如果需要的话,去分配一个新的磁盘块。 +> **练习 4**、实现 `file_block_walk` 和 `file_get_block`。`file_block_walk` 从一个文件中的块偏移量映射到 `struct File` 中那个块的指针上或间接块上,它非常类似于 `pgdir_walk` 在页表上所做的事。`file_get_block` 将更进一步,将去映射一个真实的磁盘块,如果需要的话,去分配一个新的磁盘块。 -使用 `make grade` 去测试你的代码。你的代码应该要通过 "file_open"、"file_get_block"、以及 "file_flush/file_truncated/file rewrite"、和 "testfile" 的测试。 -``` +> 使用 `make grade` 去测试你的代码。你的代码应该要通过 "file_open"、"file_get_block"、以及 "file_flush/file_truncated/file rewrite"、和 "testfile" 的测试。 `file_block_walk` 和 `file_get_block` 是文件系统中的”劳动模范“。比如,`file_read` 和 `file_write` 或多或少都在 `file_get_block` 上做必需的登记工作,然后在分散的块和连续的缓存之间复制字节。 -``` -小挑战!如果操作在中途实然被打断(比如,突然崩溃或重启),文件系统很可能会产生错误。实现软件更新或日志处理的方式让文件系统的”崩溃可靠性“更好,并且演示一下旧的文件系统可能会崩溃,而你的更新后的文件系统不会崩溃的情况。 -``` +. + +> **小挑战!**如果操作在中途实然被打断(比如,突然崩溃或重启),文件系统很可能会产生错误。实现软件更新或日志处理的方式让文件系统的”崩溃可靠性“更好,并且演示一下旧的文件系统可能会崩溃,而你的更新后的文件系统不会崩溃的情况。 ### 文件系统接口 @@ -207,19 +197,17 @@ x86 处理器在 EFLAGS 寄存器中使用 IOPL 位去确定保护模式中的 服务器也通过 IPC 来发送响应。我们为函数的返回代码使用 32 位的数字。对于大多数 RPC,这已经涵盖了它们全部的返回代码。`FSREQ_READ` 和 `FSREQ_STAT` 也返回数据,它们只是被简单地写入到客户端发送它的请求时的页上。在 IPC 的响应中并不需要去发送这个页,因为这个页是文件系统服务器和客户端从一开始就共享的页。另外,在它的响应中,`FSREQ_OPEN` 与客户端共享一个新的 "Fd page”。我们将快捷地返回到文件描述符页上。 -```markdown -练习 5、实现 `fs/serv.c` 中的 `serve_read`。 +> **练习 5**、实现 `fs/serv.c` 中的 `serve_read`。 -`serve_read` 的重任将由已经在 `fs/fs.c` 中实现的 `file_read` 来承担(它实际上不过是对 `file_get_block` 的一连串调用)。对于文件读取,`serve_read` 只能提供 RPC 接口。查看 `serve_set_size` 中的注释和代码,去大体上了解服务器函数的结构。 +> `serve_read` 的重任将由已经在 `fs/fs.c` 中实现的 `file_read` 来承担(它实际上不过是对 `file_get_block` 的一连串调用)。对于文件读取,`serve_read` 只能提供 RPC 接口。查看 `serve_set_size` 中的注释和代码,去大体上了解服务器函数的结构。 -使用 `make grade` 去测试你的代码。你的代码通过 "serve_open/file_stat/file_close" 和 "file_read" 的测试后,你得分应该是 70(总分为 150)。 -``` +> 使用 `make grade` 去测试你的代码。你的代码通过 "serve_open/file_stat/file_close" 和 "file_read" 的测试后,你得分应该是 70(总分为 150)。 -```markdown -练习 6、实现 `fs/serv.c` 中的 `serve_write` 和 `lib/file.c` 中的 `devfile_write`。 +. -使用 `make grade` 去测试你的代码。你的代码通过 "file_write"、"file_read after file_write"、"open"、和 "large file" 的测试后,得分应该是 90(总分为150)。 -``` +> **练习 6**、实现 `fs/serv.c` 中的 `serve_write` 和 `lib/file.c` 中的 `devfile_write`。 + +> 使用 `make grade` 去测试你的代码。你的代码通过 "file_write"、"file_read after file_write"、"open"、和 "large file" 的测试后,得分应该是 90(总分为150)。 ### 进程增殖 @@ -227,21 +215,19 @@ x86 处理器在 EFLAGS 寄存器中使用 IOPL 位去确定保护模式中的 我们实现的是 `spawn`,而不是一个类 UNIX 的 `exec`,因为 `spawn` 是很容易从用户空间中、以”外内核式“ 实现的,它无需来自内核的特别帮助。为了在用户空间中实现 `exec`,想一想你应该做什么?确保你理解了它为什么很难。 -```markdown -练习 7、`spawn` 依赖新的系统调用 `sys_env_set_trapframe` 去初始化新创建的环境的状态。实现 `kern/syscall.c` 中的 `sys_env_set_trapframe`。(不要忘记在 `syscall()` 中派发新系统调用) +> **练习 7**、`spawn` 依赖新的系统调用 `sys_env_set_trapframe` 去初始化新创建的环境的状态。实现 `kern/syscall.c` 中的 `sys_env_set_trapframe`。(不要忘记在 `syscall()` 中派发新系统调用) -运行来自 `kern/init.c` 中的 `user/spawnhello` 程序来测试你的代码`kern/init.c` ,它将尝试从文件系统中增殖 `/hello`。 +> 运行来自 `kern/init.c` 中的 `user/spawnhello` 程序来测试你的代码`kern/init.c` ,它将尝试从文件系统中增殖 `/hello`。 -使用 `make grade` 去测试你的代码。 -``` +> 使用 `make grade` 去测试你的代码。 -```markdown -小挑战!实现 Unix 式的 `exec`。 -``` +. -```markdown -小挑战!实现 `mmap` 式的文件内存映射,并如果可能的话,修改 `spawn` 从 ELF 中直接映射页。 -``` +> **小挑战!**实现 Unix 式的 `exec`。 + +. + +> **小挑战!**实现 `mmap` 式的文件内存映射,并如果可能的话,修改 `spawn` 从 ELF 中直接映射页。 ### 跨 fork 和 spawn 共享库状态 @@ -255,11 +241,9 @@ UNIX 文件描述符是一个通称的概念,它还包括管道、控制台 I/ 我们在 `inc/lib.h` 中定义了一个新的 `PTE_SHARE` 位,在 Intel 和 AMD 的手册中,这个位是被标记为”软件可使用的“的三个 PTE 位之一。我们将创建一个约定,如果一个页表条目中这个位被设置,那么在 `fork` 和 `spawn` 中应该直接从父环境中复制 PTE 到子环境中。注意它与标记为写时复制的差别:正如在第一段中所描述的,我们希望确保能共享页更新。 -```markdown -练习 8、修改 `lib/fork.c` 中的 `duppage`,以遵循最新约定。如果页表条目设置了 `PTE_SHARE` 位,仅直接复制映射。(你应该去使用 `PTE_SYSCALL`,而不是 `0xfff`,去从页表条目中掩掉有关的位。`0xfff` 仅选出可访问的位和脏位。) +> **练习 8**、修改 `lib/fork.c` 中的 `duppage`,以遵循最新约定。如果页表条目设置了 `PTE_SHARE` 位,仅直接复制映射。(你应该去使用 `PTE_SYSCALL`,而不是 `0xfff`,去从页表条目中掩掉有关的位。`0xfff` 仅选出可访问的位和脏位。) -同样的,在 `lib/spawn.c` 中实现 `copy_shared_pages`。它应该循环遍历当前进程中所有的页表条目(就像 `fork` 那样),复制任何设置了 `PTE_SHARE` 位的页映射到子进程中。 -``` +> 同样的,在 `lib/spawn.c` 中实现 `copy_shared_pages`。它应该循环遍历当前进程中所有的页表条目(就像 `fork` 那样),复制任何设置了 `PTE_SHARE` 位的页映射到子进程中。 使用 `make run-testpteshare` 去检查你的代码行为是否正确。正确的情况下,你应该会看到像 "`fork handles PTE_SHARE right`" 和 "`spawn handles PTE_SHARE right`” 这样的输出行。 @@ -269,9 +253,7 @@ UNIX 文件描述符是一个通称的概念,它还包括管道、控制台 I/ 为了能让 shell 工作,我们需要一些方式去输入。QEMU 可以显示输出,我们将它的输出写入到 CGA 显示器上和串行端口上,但到目前为止,我们仅能够在内核监视器中接收输入。在 QEMU 中,我们从图形化窗口中的输入作为从键盘到 JOS 的输入,虽然键入到控制台的输入作为出现在串行端口上的字符的方式显现。在 `kern/console.c` 中已经包含了由我们自实验 1 以来的内核监视器所使用的键盘和串行端口的驱动程序,但现在你需要去把这些增加到系统中。 -```markdown -练习 9、在你的 `kern/trap.c` 中,调用 `kbd_intr` 去处理捕获 `IRQ_OFFSET+IRQ_KBD` 和 `serial_intr`,用它们去处理捕获 `IRQ_OFFSET+IRQ_SERIAL`。 -``` +> **练习 9**、在你的 `kern/trap.c` 中,调用 `kbd_intr` 去处理捕获 `IRQ_OFFSET+IRQ_KBD` 和 `serial_intr`,用它们去处理捕获 `IRQ_OFFSET+IRQ_SERIAL`。 在 `lib/console.c` 中,我们为你实现了文件的控制台输入/输出。`kbd_intr` 和 `serial_intr` 将使用从最新读取到的输入来填充缓冲区,而控制台文件类型去排空缓冲区(默认情况下,控制台文件类型为 stdin/stdout,除非用户重定向它们)。 @@ -282,40 +264,38 @@ UNIX 文件描述符是一个通称的概念,它还包括管道、控制台 I/ 运行 `make run-icode` 或 `make run-icode-nox` 将运行你的内核并启动 `user/icode`。`icode` 又运行 `init`,它将设置控制台作为文件描述符 0 和 1(即:标准输入 stdin 和标准输出 stdout),然后增殖出环境 `sh`,就是 shell。之后你应该能够运行如下的命令了: ``` - echo hello world | cat - cat lorem |cat - cat lorem |num - cat lorem |num |num |num |num |num - lsfd +echo hello world | cat +cat lorem |cat +cat lorem |num +cat lorem |num |num |num |num |num +lsfd ``` 注意用户库常规程序 `cprintf` 将直接输出到控制台,而不会使用文件描述符代码。这对调试非常有用,但是对管道连接其它程序却很不利。为将输出打印到特定的文件描述符(比如 1,它是标准输出 stdout),需要使用 `fprintf(1, "...", ...)`。`printf("...", ...)` 是将输出打印到文件描述符 1(标准输出 stdout) 的快捷方式。查看 `user/lsfd.c` 了解更多示例。 -```markdown -练习 10、 -这个 shell 不支持 I/O 重定向。如果能够运行 `run sh **练习 10**、这个 shell 不支持 I/O 重定向。如果能够运行 `run sh 通过在你的 shell 中输入 `sh 运行 `make run-testshell` 去测试你的 shell。`testshell` 只是简单地给 shell ”喂“上面的命令(也可以在 `fs/testshell.sh` 中找到),然后检查它的输出是否与 `fs/testshell.key` 一样。 -```markdown -小挑战!给你的 shell 添加更多的特性。最好包括以下的特性(其中一些可能会要求修改文件系统): +. - * 后台命令 (`ls &`) - * 一行中运行多个命令 (`ls; echo hi`) - * 命令组 (`(ls; echo hi) | cat > out`) - * 扩展环境变量 (`echo $hello`) - * 引号 (`echo "a | b"`) - * 命令行历史和/或编辑功能 - * tab 命令补全 - * 为命令行查找目录、cd 和路径 - * 文件创建 - * 用快捷键 `ctl-c` 去杀死一个运行中的环境 -可做的事情还有很多,并不仅限于以上列表。 -``` +> **小挑战!**给你的 shell 添加更多的特性。最好包括以下的特性(其中一些可能会要求修改文件系统): + +> * 后台命令 (`ls &`) +> * 一行中运行多个命令 (`ls; echo hi`) +> * 命令组 (`(ls; echo hi) | cat > out`) +> * 扩展环境变量 (`echo $hello`) +> * 引号 (`echo "a | b"`) +> * 命令行历史和/或编辑功能 +> * tab 命令补全 +> * 为命令行查找目录、cd 和路径 +> * 文件创建 +> * 用快捷键 `ctl-c` 去杀死一个运行中的环境 + +> 可做的事情还有很多,并不仅限于以上列表。 到目前为止,你的代码应该要通过所有的测试。和以前一样,你可以使用 `make grade` 去评级你的提交,并且使用 `make handin` 上交你的实验。 @@ -328,7 +308,7 @@ via: https://pdos.csail.mit.edu/6.828/2018/labs/lab5/ 作者:[csail.mit][a] 选题:[lujun9972][b] 译者:[qhwdw](https://github.com/qhwdw) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 63768a764cd0d5eb024dc1ee19b7afca8d04c1ea Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Thu, 27 Dec 2018 08:26:19 +0800 Subject: [PATCH 089/322] Translating --- ...1206 Take a break at the Linux command line with Nyan Cat.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181206 Take a break at the Linux command line with Nyan Cat.md b/sources/tech/20181206 Take a break at the Linux command line with Nyan Cat.md index 7f642b5496..05dd160dc8 100644 --- a/sources/tech/20181206 Take a break at the Linux command line with Nyan Cat.md +++ b/sources/tech/20181206 Take a break at the Linux command line with Nyan Cat.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (zhs852) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: subject: (Take a break at the Linux command line with Nyan Cat) From ffe8fa5825d196cc6343c8e1520d10972df81031 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 27 Dec 2018 08:50:32 +0800 Subject: [PATCH 090/322] translated --- .../20181214 How To Install Rust Programming Language In Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20181214 How To Install Rust Programming Language In Linux.md (100%) diff --git a/sources/tech/20181214 How To Install Rust Programming Language In Linux.md b/translated/tech/20181214 How To Install Rust Programming Language In Linux.md similarity index 100% rename from sources/tech/20181214 How To Install Rust Programming Language In Linux.md rename to translated/tech/20181214 How To Install Rust Programming Language In Linux.md From 9271abd1645d98012a323fdf1841d7920739c3be Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 27 Dec 2018 08:53:41 +0800 Subject: [PATCH 091/322] translated --- ...tall Rust Programming Language In Linux.md | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/translated/tech/20181214 How To Install Rust Programming Language In Linux.md b/translated/tech/20181214 How To Install Rust Programming Language In Linux.md index c39e037d6d..a2fc9f1382 100644 --- a/translated/tech/20181214 How To Install Rust Programming Language In Linux.md +++ b/translated/tech/20181214 How To Install Rust Programming Language In Linux.md @@ -7,22 +7,22 @@ [#]: via: (https://www.2daygeek.com/how-to-install-rust-programming-language-in-linux/) [#]: author: (Prakash Subramanian https://www.2daygeek.com/author/prakash/) -How To Install Rust Programming Language In Linux +如何在 Linux 中安装 Rust 编程语言 ====== -Rust is often called rust-lang. +Rust 通常被称为 rust-lang。 -Rust is a general-purpose, multi-paradigm, modern, cross-platform, and open source systems programming language sponsored by Mozilla Research. +Rust 是一个由 Mozilla Research 赞助的通用、多范式、现代、跨平台和开源系统编程语言。 -It was designed to be achieve a goals such as safety, speed, and concurrency. +它旨在实现安全性、速度和并发性等目标。 -Rust is syntactically similar to C++,[14] but its designers intend it to provide better memory safety while still maintaining performance. +Rust 在语法上与 C++ 相似,但它的设计者希望它在保持性能的同时提供更好的内存安全性。 -Rust is currently used in many organization such as Firefox, Chef, Dropbox, Oracle, GNOME, etc,. +Rust 目前在许多组织中使用,例如 Firefox、Chef、Dropbox、Oracle、GNOME 等。 -### How to Install Runs Language in Linux? +### 如何在 Linux 中安装 Rust 语言? -There are many ways we can install Rust but below is the officially recommended way to install it. +我们可以通过多种方式安装 Rust,但以下是官方推荐的安装方式。 ``` $ curl https://sh.rustup.rs -sSf | sh @@ -85,22 +85,22 @@ environment variable. Next time you log in this will be done automatically. To configure your current shell run source $HOME/.cargo/env ``` -Run the following command to configure your current shell. +运行以下命令配置当前 shell。 ``` $ source $HOME/.cargo/env ``` -Run the following command to verify the installed Rust version. +运行以下命令验证已安装的 Rust 版本。 ``` $ rustc --version rustc 1.31.0 (abe02cefd 2018-12-04) ``` -### How To Test Rust programming language? +### 如何测试 Rust 编程语言? -Once you installed Rust follow the below steps to check whether Rust programe language is working fine or not. +安装 Rust 后,请按照以下步骤检查 Rust 语言是否正常工作。 ``` $ mkdir ~/projects @@ -109,7 +109,7 @@ $ mkdir hello_world $ cd hello_world ``` -Create a file and add the below code and save the file. Make sure, Rust files always end in a .rs extension. +创建一个文件并添加以下代码并保存。确保 Rust 文件始终以 .rs 扩展名结尾。 ``` $ vi 2g.rs @@ -119,13 +119,13 @@ fn main() { } ``` -Run the following command to compile the rust code. +运行以下命令编译 rust 代码。 ``` $ rustc 2g.rs ``` -The above command will create a executable Rust program file in the same directory. +上面的命令将在同一目录中创建一个可执行的 Rust 程序。 ``` $ ls -lh @@ -134,16 +134,16 @@ total 3.9M -rw-r--r-- 1 daygeek daygeek 86 Dec 14 11:09 2g.rs ``` -Run the Rust executable file to get the output. +运行 Rust 可执行文件得到输出。 ``` $ ./2g Hello, It's 2DayGeek.com - Best Linux Practical Blog! ``` -Yup! that’s working fine. +好了!正常工作了。 -To update Rust to latest version. +将 Rust 更新到最新版本。 ``` $ rustup update @@ -153,13 +153,13 @@ info: checking for self-updates stable-x86_64-unknown-linux-gnu unchanged - rustc 1.31.0 (abe02cefd 2018-12-04) ``` -Run the following command to remove the Rust package from your system. +运行以下命令从系统中删除 Rust 包。 ``` $ rustup self uninstall ``` -Once you uninstalled the Rust package, remove the Rust project directory. +卸载 Rust 包后,删除 Rust 项目目录。 ``` $ rm -fr ~/projects @@ -170,10 +170,10 @@ via: https://www.2daygeek.com/how-to-install-rust-programming-language-in-linux/ 作者:[Prakash Subramanian][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[geekpi](https://github.com/geekpi) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://www.2daygeek.com/author/prakash/ -[b]: https://github.com/lujun9972 +[b]: https://github.com/lujun9972 \ No newline at end of file From 637e80f3f8638fe1154dd1f19c941c3953325e24 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 27 Dec 2018 08:56:27 +0800 Subject: [PATCH 092/322] translating --- .../tech/20181222 Watch YouTube videos at the Linux terminal.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181222 Watch YouTube videos at the Linux terminal.md b/sources/tech/20181222 Watch YouTube videos at the Linux terminal.md index d2ba12dbeb..e4db6bc039 100644 --- a/sources/tech/20181222 Watch YouTube videos at the Linux terminal.md +++ b/sources/tech/20181222 Watch YouTube videos at the Linux terminal.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From e51e499efeca086c62c2b4d3d5f3601a69c92632 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 27 Dec 2018 09:42:30 +0800 Subject: [PATCH 093/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20[Review]=20Polo?= =?UTF-8?q?=20File=20Manager=20in=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...226 -Review- Polo File Manager in Linux.md | 139 ++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 sources/talk/20181226 -Review- Polo File Manager in Linux.md diff --git a/sources/talk/20181226 -Review- Polo File Manager in Linux.md b/sources/talk/20181226 -Review- Polo File Manager in Linux.md new file mode 100644 index 0000000000..cf763850cf --- /dev/null +++ b/sources/talk/20181226 -Review- Polo File Manager in Linux.md @@ -0,0 +1,139 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: ([Review] Polo File Manager in Linux) +[#]: via: (https://itsfoss.com/polo-file-manager/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +[Review] Polo File Manager in Linux +====== + +We are all familiar with file managers. It’s that piece of software that allows you to access your directories, files in a GUI. + +Most of us use the default file manager included with our desktop of choice. The creator of [Polo][1] hopes to get you to use his file manager by adding extra features but hides the good ones behind a paywall. + +![][2]Polo file manager + +### What is Polo file manager? + +According to its [website][1], Polo is an “advanced file manager for Linux written in [Vala][3])”. Further down the page, Polo is referred to as a “modern, light-weight file manager for Linux with support for multiple panes and tabs; support for archives, and much more.” + +It is from the same developer (Tony George) that has given us some of the most popular applications for desktop Linux. [Timeshift backup][4] tool, [Conky Manager][5], [Aptik backup tool][6]s for applications etc. Polo is the latest offering from Tony. + +Note that Polo is still in the beta stage of development which means the first stable version of the software is not out yet. + +### Features of Polo file manager + +![Polo File Manager in Ubuntu Linux][7]Polo File Manager in Ubuntu Linux + +It’s true that Polo has a bunch of neat features that most file managers don’t have. However, the really neat features are only available if you donate more than $10 to the project or sign up for the creator’s Patreon. I will be separating the free features from the features that require the “donation plugin”. + +![Cloud storage support in Polo file manager][8]Support cloud storage + +#### Free Features + + * Multiple Panes – Single-pane, dual-pane (vertical or horizontal split) and quad-pane layouts. + * Multiple Views – List view, Icon view, Tiled view, and Media view + * Device Manager – Devices popup displays the list of connected devices with options to mount and unmount + * Archive Support – Support for browsing archives as normal folders. Supports creation of archives in multiple formats with advanced compression settings. + * Checksum & Hashing – Generate and compare MD5, SHA1, SHA2-256 ad SHA2-512 checksums + * Built-in [Fish shell][9] + * Support for [cloud storage][10], such as Dropbox, Google Drive, Amazon Drive, Amazon S3, Backblaze B2, Hubi, Microsoft OneDrive, OpenStack Swift, and Yandex Disk + * Compare files + * Analyses disk usage + * KVM support + * Connect to FTP, SFTP, SSH and Samba servers + + + +![Dual pane view of Polo file manager][11]Polo in dual pane view + +#### Donation/Paywall Features + + * Write ISO to USB Device + * Image optimization and adjustment tools + * Optimize PNG + * Reduce JPEG Quality + * Remove Color + * Reduce Color + * Boost Color + * Set as Wallpaper + * Rotate + * Resize + * Convert to PNG, JPEG, TIFF, BMP, ICO and more + * PDF tools + * Split + * Merge + * Add and Remove Password + * Reduce File Size + * Uncompress + * Remove Colors + * Rotate + * Optimize + * Video Download via [youtube-dl][12] + + + +### Installing Polo + +Let’s see how to install Polo file manager on various Linux distributions. + +#### 1\. Ubuntu based distributions + +For all Ubuntu based systems (Ubuntu, Linux Mint, Elementary OS, etc), you can install Polo via the [official PPA][13]. Not sure what a PPA is? [Read about PPA here][14]. + +`sudo apt-add-repository -y ppa:teejee2008/ppa` +`sudo apt-get update` +`sudo apt-get install polo-file-manager` + +#### 2\. Arch based distributions + +For all Arch-based systems (Arch, Manjaro, ArchLabs, etc), you can install Polo from the [Arch User Repository][15]. + +#### 3\. Other Distros + +For all other distros, you can download and use the [.RUN installer][16] to setup Polo. + +### Thoughts on Polo + +I’ve installed tons of different distros and never had a problem with the default file manager. (I’ve probably used Thunar and Caja the most.) The free version of Polo doesn’t contain any features that would make me switch. As for the paid features, I already use a number of applications that accomplish the same things. + +One final note: the paid version of Polo is supposed to help fund development of the project. However, [according to GitHub][17], the last commit on Polo was three months ago. That’s quite a big interval of inactivity for a software that is still in the beta stages of development. + +Have you ever used [Polo][1]? If not, what is your favorite Linux file manager? Let us know in the comments below. + +If you found this article interesting, please take a minute to share it on social media, Hacker News or [Reddit][18]. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/polo-file-manager/ + +作者:[John Paul][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://teejee2008.github.io/polo/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/polo.jpg?fit=800%2C500&ssl=1 +[3]: https://en.wikipedia.org/wiki/Vala_(programming_language +[4]: https://itsfoss.com/backup-restore-linux-timeshift/ +[5]: https://itsfoss.com/conky-gui-ubuntu-1304/ +[6]: https://github.com/teejee2008/aptik +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/12/polo-file-manager-in-ubuntu.jpeg?resize=800%2C450&ssl=1 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/polo-coud-options.jpg?fit=800%2C795&ssl=1 +[9]: https://fishshell.com/ +[10]: https://itsfoss.com/cloud-services-linux/ +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/polo-dual-pane.jpg?fit=800%2C520&ssl=1 +[12]: https://itsfoss.com/download-youtube-linux/ +[13]: https://launchpad.net/~teejee2008/+archive/ubuntu/ppa +[14]: https://itsfoss.com/ppa-guide/ +[15]: https://aur.archlinux.org/packages/polo +[16]: https://github.com/teejee2008/polo/releases +[17]: https://github.com/teejee2008/polo +[18]: http://reddit.com/r/linuxusersgroup From 714c33c15748ded422ff8f49371f35fff978d65e Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 27 Dec 2018 09:43:12 +0800 Subject: [PATCH 094/322] add done: 20181226 -Review- Polo File Manager in Linux.md --- .../20181226 -Review- Polo File Manager in Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{talk => tech}/20181226 -Review- Polo File Manager in Linux.md (100%) diff --git a/sources/talk/20181226 -Review- Polo File Manager in Linux.md b/sources/tech/20181226 -Review- Polo File Manager in Linux.md similarity index 100% rename from sources/talk/20181226 -Review- Polo File Manager in Linux.md rename to sources/tech/20181226 -Review- Polo File Manager in Linux.md From 479a781f1e4aeee3d73a390f2a0db95fc7df0e27 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 27 Dec 2018 09:50:03 +0800 Subject: [PATCH 095/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Turn=20GNOME=20to?= =?UTF-8?q?=20Heaven=20With=20These=2023=20GNOME=20Extensions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...o Heaven With These 23 GNOME Extensions.md | 288 ++++++++++++++++++ 1 file changed, 288 insertions(+) create mode 100644 sources/tech/20181224 Turn GNOME to Heaven With These 23 GNOME Extensions.md diff --git a/sources/tech/20181224 Turn GNOME to Heaven With These 23 GNOME Extensions.md b/sources/tech/20181224 Turn GNOME to Heaven With These 23 GNOME Extensions.md new file mode 100644 index 0000000000..e49778eab7 --- /dev/null +++ b/sources/tech/20181224 Turn GNOME to Heaven With These 23 GNOME Extensions.md @@ -0,0 +1,288 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Turn GNOME to Heaven With These 23 GNOME Extensions) +[#]: via: (https://fosspost.org/tutorials/turn-gnome-to-heaven-with-these-23-gnome-extensions) +[#]: author: (M.Hanny Sabbagh https://fosspost.org/author/mhsabbagh) + +Turn GNOME to Heaven With These 23 GNOME Extensions +====== + +GNOME Shell is one of the most used desktop interfaces on the Linux desktop. It’s part of the GNOME project and is considered to be the next generation of the old classic GNOME 2.x interface. GNOME Shell was first released in 2011 carrying a lot of features, including GNOME Shell extensions feature. + +GNOME Extensions are simply extra functionality that you can add to your interface, they can be panel extensions, performance extensions, quick access extensions, productivity extensions or for any other type of usage. They are all free and open source of course; you can install them with a single click **from your web browser** actually. + +### How To Install GNOME Extensions? + +You main way to install GNOME extensions will be via the extensions.gnome.org website. It’s an official platform belonging to GNOME where developers publish their extensions easily so that users can install them in a single click. + +In order to for this to work, you’ll need two things: + + 1. Browser Add-on: You’ll need to install a browser add-on that allows the website to communicate with your local GNOME desktop. You install it from [here for Firefox][1], or [here for Chrome][2] or [here for Opera][3]. + + 2. Native Connector: You still need another part to allow your system to accept installing files locally from your web browser. To install this component, you must install the `chrome-gnome-shell` package. Do not be deceived! Although the package name is containing “chrome”, it also works on Firefox too. To install it on Debian/Ubuntu/Mint run the following command in terminal: + +``` +sudo apt install chrome-gnome-shell +``` + +For Fedora: + +``` +sudo dnf install chrome-gnome-shell +``` + +For Arch: + +``` +sudo pacman -S chrome-gnome-shell +``` + +After you have installed the two components above, you can easily install extensions from the GNOME extensions website. + +### How to Configure GNOME Extensions Settings? + +Many of these extensions do have a settings window that you can access to adjust the preferences of that extension. You must make sure that you have seen its options at least once so that you know what you can possibly do using that extension. + +To do this, you can head to the [installed extensions page on the GNOME website][4], and you’ll see a small options button near every extension that offers one: + +![Screenshot 2018 12 24 20 50 55 41][5] + +Clicking it will display a window for you, from which you can see the possible settings: + +![Screenshot 2018 12 24 20 51 29 43][6] + +Read our article below for our list of recommended extension! + +### General Extensions + +#### 1\. User Themes + +![Screenshot from 2018 12 23 12 30 20 45][7] + +This is the first must-install extension on the GNOME Shell interface, it simply allows you to change the desktop theme to another one using the tweak tool. After installation run gnome-tweak-tool, and you’ll be able to change your desktop theme. + +Installation link: + +#### 2\. Dash to Panel + +![Screenshot from 2018 12 24 21 16 11 47][8] + +Converts the GNOME top bar into a taskbar with many added features, such as favorite icons, moving the clock to right, adding currently opened windows to the panel and many other features. (Make sure not to install this one with some other extensions below which do provide the same functionality). + +Installation link: + +#### 3\. Desktop Icons + +![gnome shell screenshot SSP3UZ 49][9] + +Restores desktop icons back again to GNOME. Still in continues development. + +Installation link: + +#### 4\. Dash to Dock + +![Screenshot from 2018 12 24 21 50 07 51][10] + +If you are a fan of the Unity interface, then this extension may help you. It simply adds a dock to the left/right side of the screen, which is very similar to Unity. You can customize that dock however you like. + +Installation link: + +### Productivity Extensions + +#### 5\. Todo.txt + +![screenshot_570_5X5YkZb][11] + +For users who like to maintain productivity, you can use this extension to add a simple To-Do list functionality to your desktop, it will use the [syntax][12] from todotxt.com, you can add unlimited to-dos, mark them as complete or remove them, change their position beside modifying or taking a backup of the todo.txt file manually. + +Installation link: + +#### 6\. Screenshot Tool + +![Screenshot from 2018 12 24 21 04 14 54][13] + +Easily take a screenshot of your desktop or a specific area, with the possibility of also auto-uploading it to imgur.com and auto-saving the link into the clipboard! Very useful extension. + +Installation link: + +#### 7\. OpenWeather + +![screenshot_750][14] + +If you would like to know the weather forecast everyday then this extension will be the right one for you, this extension will simply add an applet to the top panel allowing you to fetch the weather data from openweathermap.org or forecast.io, it supports all the countries and cities around the world. It also shows the wind and humidity. + +Installation link: + +#### 8 & 9\. Search Providers Extensions + +![Screenshot from 2018 12 24 21 29 41 57][15] + +In GNOME, you can add what’s known as “search providers” to the shell, meaning that when you type something in the search box, you’ll be able to automatically search these websites (search providers) using the same text you entered, and see the results directly from your shell! + +YouTube Search Provider: + +Wikipedia Search Provider: + +### Workflow Extensions + +#### 10\. No Title Bar + +![Screenshot 20181224210737 59][16] + +This extension simply removes the title bar from all the maximized windows, and moves it into the top GNOME Panel. In this way, you’ll be able to save a complete horizontal line on your screen, more space for your work! + +Installation Link: + +#### 11\. Applications Menu + +![Screenshot 2018 12 23 13 58 07 61][17] + +This extension simply adds a classic menu to the “activities” menu on the corner. By using it, you will be able to browse the installed applications and categories without the need to use the dash or the search feature, which saves you time. (Check the “No hot corner” extension below to get a better usage). + +Installation link: + +#### 12\. Places Status Indicator + +![screenshot_8_1][18] + +This indicator will put itself near the left corner of the activities button, it allows you to access your home folder and sub-folders easily using a menu, you can also browse the available devices and networks using it. + +Installation link: + +#### 13\. Window List + +![Screenshot from 2016-08-12 08-05-48][19] + +Officially supported by GNOME team, this extension adds a bottom panel to the desktop which allows you to navigate between the open windows easily, it also include a workspace indicator to switch between them. + +Installation link: + +#### 14\. Frippery Panel Favorites + +![screenshot_4][20] + +This extensions adds your favorite applications and programs to the panel near the activities button, allowing you to access to it more quickly with just 1 click, you can add or remove applications from it just by modifying your applications in your favorites (the same applications in the left panel when you click the activities button will appear here). + +Installation link: + +#### 15\. TopIcons + +![Screenshot 20181224211009 66][21] + +Those extensions restore the system tray back into the top GNOME panel. Very needed in cases of where applications are very much dependent on the tray icon. + +For GNOME 3.28, installation link: + +For GNOME 3.30, installation link: + +#### 16\. Clipboard Indicator + +![Screenshot 20181224214626 68][22] + +A clipboard manager is simply an applications that manages all the copy & paste operations you do on your system and saves them into a history, so that you can access them later whenever you want. + +This extension does exactly this, plus many other cool features that you can check. + +Installation link: + +### Other Extensions + +#### 17\. Frippery Move Clock + +![screenshot_2][23] + +If you are from those people who like alignment a lot, and dividing the panels into 2 parts only, then you may like this extension, what it simply does is moving the clock from the middle of the GNOME Shell panel to the right near the other applets on the panel, which makes it more organized. + +Installation link: + +#### 18\. No Topleft Hot Corner + +If you don’t like opening the dash whenever you move the mouse to the left corner, you can disable it easily using this extension. You can for sure click the activities button if you want to open the dash view (or via the Super key on the keyboard), but the hot corner will be disabled only. + +Installation link: + +#### 19\. No Annoyance + +Simply removes the “window is ready” notification each time a new window a opened. + +Installation link: + +#### 20\. EasyScreenCast + +![Screenshot 20181224214219 71][24] + +If you would like to quickly take a screencast for your desktop, then this extension may help you. By simply just choosing the type of recording you want, you’ll be able to take screencasts any time. You can also configure advanced options for the extension, such as the pipeline and many other things. + +Installation link: + +#### 21\. Removable drive Menu + +![Screenshot 20181224214131 73][25] + +Adds an icon to the top bar which shows you a list of your currently removable drives. + +Installation link: + +#### 22\. BottomPanel + +![Screenshot 20181224214419 75][26] + +As its title says.. It simply moves the top GNOME bar into the bottom of the screen. + +Installation link: + +#### 23\. Unite + +If you would like one extension only to do most of the above tasks, then Unite extension can help you. It adds panel favorites, removes title bar, moves the clock, allows you to change the location of the panel.. And many other features. All using this extension alone! + +Installation link: + +### Conclusion + +This was our list for some great GNOME Shell extensions to try out. Of course, you don’t (and shouldn’t!) install all of these, but just what you need for your own usage. As you can see, you can convert GNOME into any form you would like, but be careful for RAM usage (because if you use more extensions, the shell will consume very much resources). + +What other GNOME Shell extensions do you use? What do you think of this list? + + +-------------------------------------------------------------------------------- + +via: https://fosspost.org/tutorials/turn-gnome-to-heaven-with-these-23-gnome-extensions + +作者:[M.Hanny Sabbagh][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fosspost.org/author/mhsabbagh +[b]: https://github.com/lujun9972 +[1]: https://addons.mozilla.org/en/firefox/addon/gnome-shell-integration/ +[2]: https://chrome.google.com/webstore/detail/gnome-shell-integration/gphhapmejobijbbhgpjhcjognlahblep +[3]: https://addons.opera.com/en/extensions/details/gnome-shell-integration/ +[4]: https://extensions.gnome.org/local/ +[5]: https://i1.wp.com/fosspost.org/wp-content/uploads/2018/12/Screenshot_2018-12-24_20-50-55.png?resize=850%2C359&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 42) +[6]: https://i1.wp.com/fosspost.org/wp-content/uploads/2018/12/Screenshot_2018-12-24_20-51-29.png?resize=850%2C462&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 44) +[7]: https://i2.wp.com/fosspost.org/wp-content/uploads/2018/12/Screenshot-from-2018-12-23-12-30-20.png?resize=850%2C478&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 46) +[8]: https://i0.wp.com/fosspost.org/wp-content/uploads/2018/12/Screenshot-from-2018-12-24-21-16-11.png?resize=850%2C478&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 48) +[9]: https://i2.wp.com/fosspost.org/wp-content/uploads/2018/12/gnome-shell-screenshot-SSP3UZ.png?resize=850%2C492&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 50) +[10]: https://i1.wp.com/fosspost.org/wp-content/uploads/2018/12/Screenshot-from-2018-12-24-21-50-07.png?resize=850%2C478&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 52) +[11]: https://i0.wp.com/fosspost.org/wp-content/uploads/2016/08/screenshot_570_5X5YkZb.png?resize=478%2C474&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 53) +[12]: https://github.com/ginatrapani/todo.txt-cli/wiki/The-Todo.txt-Format +[13]: https://i1.wp.com/fosspost.org/wp-content/uploads/2018/12/Screenshot-from-2018-12-24-21-04-14.png?resize=715%2C245&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 55) +[14]: https://i2.wp.com/fosspost.org/wp-content/uploads/2016/08/screenshot_750.jpg?resize=648%2C276&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 56) +[15]: https://i2.wp.com/fosspost.org/wp-content/uploads/2018/12/Screenshot-from-2018-12-24-21-29-41.png?resize=850%2C478&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 58) +[16]: https://i0.wp.com/fosspost.org/wp-content/uploads/2018/12/Screenshot-20181224210737-380x95.png?resize=380%2C95&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 60) +[17]: https://i0.wp.com/fosspost.org/wp-content/uploads/2018/12/Screenshot_2018-12-23_13-58-07.png?resize=524%2C443&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 62) +[18]: https://i0.wp.com/fosspost.org/wp-content/uploads/2016/08/screenshot_8_1.png?resize=247%2C620&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 63) +[19]: https://i1.wp.com/fosspost.org/wp-content/uploads/2016/08/Screenshot-from-2016-08-12-08-05-48.png?resize=850%2C478&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 64) +[20]: https://i0.wp.com/fosspost.org/wp-content/uploads/2016/08/screenshot_4.png?resize=414%2C39&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 65) +[21]: https://i0.wp.com/fosspost.org/wp-content/uploads/2018/12/Screenshot-20181224211009-631x133.png?resize=631%2C133&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 67) +[22]: https://i1.wp.com/fosspost.org/wp-content/uploads/2018/12/Screenshot-20181224214626-520x443.png?resize=520%2C443&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 69) +[23]: https://i0.wp.com/fosspost.org/wp-content/uploads/2016/08/screenshot_2.png?resize=388%2C26&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 70) +[24]: https://i2.wp.com/fosspost.org/wp-content/uploads/2018/12/Screenshot-20181224214219-327x328.png?resize=327%2C328&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 72) +[25]: https://i1.wp.com/fosspost.org/wp-content/uploads/2018/12/Screenshot-20181224214131-366x199.png?resize=366%2C199&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 74) +[26]: https://i2.wp.com/fosspost.org/wp-content/uploads/2018/12/Screenshot-20181224214419-830x143.png?resize=830%2C143&ssl=1 (Turn GNOME to Heaven With These 23 GNOME Extensions 76) From f5a62473820ac95e0d06db7b72650717346a9670 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 27 Dec 2018 09:54:47 +0800 Subject: [PATCH 096/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20An=20Introduction?= =?UTF-8?q?=20to=20Go?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20181224 An Introduction to Go.md | 278 ++++++++++++++++++ 1 file changed, 278 insertions(+) create mode 100644 sources/tech/20181224 An Introduction to Go.md diff --git a/sources/tech/20181224 An Introduction to Go.md b/sources/tech/20181224 An Introduction to Go.md new file mode 100644 index 0000000000..b35bc9922e --- /dev/null +++ b/sources/tech/20181224 An Introduction to Go.md @@ -0,0 +1,278 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (An Introduction to Go) +[#]: via: (https://blog.jak-linux.org/2018/12/24/introduction-to-go/) +[#]: author: (Julian Andres Klode https://blog.jak-linux.org/) + +An Introduction to Go +====== + +(What follows is an excerpt from my master’s thesis, almost all of section 2.1, quickly introducing Go to people familiar with CS) + +Go is an imperative programming language for concurrent programming created at and mainly developed by Google, initially mostly by Robert Griesemer, Rob Pike, and Ken Thompson. Design of the language started in 2007, and an initial version was released in 2009; with the first stable version, 1.0 released in 2012 . + +Go has a C-like syntax (without a preprocessor), garbage collection, and, like its predecessors devloped at Bell Labs – Newsqueak (Rob Pike), Alef (Phil Winterbottom), and Inferno (Pike, Ritchie, et al.) – provides built-in support for concurrency using so-called goroutines and channels, a form of co-routines, based on the idea of Hoare’s ‘Communicating Sequential Processes’ . + +Go programs are organised in packages. A package is essentially a directory containing Go files. All files in a package share the same namespace, and there are two visibilities for symbols in a package: Symbols starting with an upper case character are visible to other packages, others are private to the package: + +``` +func PublicFunction() { + fmt.Println("Hello world") +} + +func privateFunction() { + fmt.Println("Hello package") +} +``` + +### Types + +Go has a fairly simple type system: There is no subtyping (but there are conversions), no generics, no polymorphic functions, and there are only a few basic categories of types: + + 1. base types: `int`, `int64`, `int8`, `uint`, `float32`, `float64`, etc. + + 2. `struct` + + 3. `interface` \- a set of methods + + 4. `map[K, V]` \- a map from a key type to a value type + + 5. `[number]Type` \- an array of some element type + + 6. `[]Type` \- a slice (pointer to array with length and capability) of some type + + 7. `chan Type` \- a thread-safe queue + + 8. pointer `*T` to some other type + + 9. functions + + 10. named type - aliases for other types that may have associated methods: + +``` +type T struct { foo int } +type T *T +type T OtherNamedType +``` + +Named types are mostly distinct from their underlying types, so you cannot assign them to each other, but some operators like `+` do work on objects of named types with an underlying numerical type (so you could add two `T` in the example above). + + +Maps, slices, and channels are reference-like types - they essentially are structs containing pointers. Other types are passed by value (copied), including arrays (which have a fixed length and are copied). + +#### Conversions + +Conversions are the similar to casts in C and other languages. They are written like this: + +``` +TypeName(value) +``` + +#### Constants + +Go has “untyped” literals and constants. + +``` +1 // untyped integer literal +const foo = 1 // untyped integer constant +const foo int = 1 // int constant +``` + +Untyped values are classified into the following categories: `UntypedBool`, `UntypedInt`, `UntypedRune`, `UntypedFloat`, `UntypedComplex`, `UntypedString`, and `UntypedNil` (Go calls them basic kinds, other basic kinds are available for the concrete types like `uint8`). An untyped value can be assigned to a named type derived from a base type; for example: + +``` +type someType int + +const untyped = 2 // UntypedInt +const bar someType = untyped // OK: untyped can be assigned to someType +const typed int = 2 // int +const bar2 someType = typed // error: int cannot be assigned to someType +``` + +### Interfaces and ‘objects’ + +As mentioned before, interfaces are a set of methods. Go is not an object-oriented language per se, but it has some support for associating methods with named types: When declaring a function, a receiver can be provided - a receiver is an additional function argument that is passed before the function and involved in the function lookup, like this: + +``` +type SomeType struct { ... } + +func (s *SomeType) MyMethod() { +} + +func main() { + var s SomeType + s.MyMethod() +} +``` + +An object implements an interface if it implements all methods; for example, the following interface `MyMethoder` is implemented by `*SomeType` (note the pointer), and values of `*SomeType` can thus be used as values of `MyMethoder`. The most basic interface is `interface{}`, that is an interface with an empty method set - any object satisfies that interface. + +``` +type MyMethoder interface { + MyMethod() +} +``` + +There are some restrictions on valid receiver types; for example, while a named type could be a pointer (for example, `type MyIntPointer *int`), such a type is not a valid receiver type. + +### Control flow + +Go provides three primary statements for control flow: `if`, `switch`, and `for`. The statements are fairly similar to their equivalent in other C-like languages, with some exceptions: + + * There are no parentheses around conditions, so it is `if a == b {}`, not `if (a == b) {}`. The braces are mandatory. + + * All of them can have initialisers, like this + +`if result, err := someFunction(); err == nil { // use result }` + + * The `switch` statement can use arbitrary expressions in cases + + * The `switch` statement can switch over nothing (equals switching over true) + + * Cases do not fall through by default (no `break` needed), use `fallthrough` at the end of a block to fall through. + + * The `for` loop can loop over ranges: `for key, val := range map { do something }` + + + + +### Goroutines + +The keyword `go` spawns a new goroutine, a concurrently executed function. It can be used with any function call, even a function literal: + +``` +func main() { + ... + go func() { + ... + }() + + go some_function(some_argument) +} +``` + +### Channels + +Goroutines are often combined with channels to provide an extended form of Communicating Sequential Processes . A channel is a concurrent-safe queue, and can be buffered or unbuffered: + +``` +var unbuffered = make(chan int) // sending blocks until value has been read +var buffered = make(chan int, 5) // may have up to 5 unread values queued +``` + +The `<-` operator is used to communicate with a single channel. + +``` +valueReadFromChannel := <- channel +otherChannel <- valueToSend +``` + +The `select` statement allows communication with multiple channels: + +``` +select { + case incoming := <- inboundChannel: + // A new message for me + case outgoingChannel <- outgoing: + // Could send a message, yay! +} +``` + +### The `defer` statement + +Go provides a `defer` statement that allows a function call to be scheduled for execution when the function exits. It can be used for resource clean-up, for example: + +``` +func myFunc(someFile io.ReadCloser) { + defer someFile.close() + /bin /boot /dev /etc /home /lib /lib64 /lost+found /media /mnt /opt /proc /root /run /sbin /srv /sys /tmp /usr /var Do stuff with file */ +} +``` + +It is of course possible to use function literals as the function to call, and any variables can be used as usual when writing the call. + +### Error handling + +Go does not provide exceptions or structured error handling. Instead, it handles errors by returning them in a second or later return value: + +``` +func Read(p []byte) (n int, err error) + +// Built-in type: +type error interface { + Error() string +} +``` + +Errors have to be checked in the code, or can be assigned to `_`: + +``` +n0, _ := Read(Buffer) // ignore error +n, err := Read(buffer) +if err != nil { + return err +} +``` + +There are two functions to quickly unwind and recover the call stack, though: `panic()` and `recover()`. When `panic()` is called, the call stack is unwound, and any deferred functions are run as usual. When a deferred function invokes `recover()`, the unwinding stops, and the value given to `panic()` is returned. If we are unwinding normally and not due to a panic, `recover()` simply returns `nil`. In the example below, a function is deferred and any `error` value that is given to `panic()` will be recovered and stored in an error return value. Libraries sometimes use that approach to make highly recursive code like parsers more readable, while still maintaining the usual error return value for public functions. + +``` +func Function() (err error) { + defer func() { + s := recover() + switch s := s.(type) { // type switch + case error: + err = s // s has type error now + default: + panic(s) + } + } +} +``` + +### Arrays and slices + +As mentioned before, an array is a value type and a slice is a pointer into an array, created either by slicing an existing array or by using `make()` to create a slice, which will create an anonymous array to hold the elements. + +``` +slice1 := make([]int, 2, 5) // 5 elements allocated, 2 initialized to 0 +slice2 := array[:] // sliced entire array +slice3 := array[1:] // slice of array without first element +``` + +There are some more possible combinations for the slicing operator than mentioned above, but this should give a good first impression. + +A slice can be used as a dynamically growing array, using the `append()` function. + +``` +slice = append(slice, value1, value2) +slice = append(slice, arrayOrSlice...) +``` + +Slices are also used internally to represent variable parameters in variable length functions. + +### Maps + +Maps are simple key-value stores and support indexing and assigning. They are not thread-safe. + +``` +someValue := someMap[someKey] +someValue, ok := someMap[someKey] // ok is false if key not in someMap +someMap[someKey] = someValue +``` +-------------------------------------------------------------------------------- + +via: https://blog.jak-linux.org/2018/12/24/introduction-to-go/ + +作者:[Julian Andres Klode][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://blog.jak-linux.org/ +[b]: https://github.com/lujun9972 From ff5a22c7171a889298e7d6c9d8d944fd07d633e6 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Thu, 27 Dec 2018 11:06:21 +0800 Subject: [PATCH 097/322] Translated --- ...at the Linux command line with Nyan Cat.md | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/sources/tech/20181206 Take a break at the Linux command line with Nyan Cat.md b/sources/tech/20181206 Take a break at the Linux command line with Nyan Cat.md index 05dd160dc8..81e74a8a13 100644 --- a/sources/tech/20181206 Take a break at the Linux command line with Nyan Cat.md +++ b/sources/tech/20181206 Take a break at the Linux command line with Nyan Cat.md @@ -7,38 +7,39 @@ [#]: author: (Jason Baker https://opensource.com/users/jason-baker) [#]: url: ( ) -Take a break at the Linux command line with Nyan Cat +在 Linux 命令行中观看 Nyan Cat 来稍适休息 ====== -Rainbows, Pop-Tarts, and cats in space: What more could you want at your terminal? +> 你甚至可以在终端里欣赏彩虹猫。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-nyancat.png?itok=eg1aEmBw) -We're now on day six of the Linux command-line toys advent calendar, where we explore some of the fun, entertaining, and in some cases, utterly useless toys available for your Linux terminal. All are available under an open source license. +今天是《Linux 命令行小玩具介绍》的第六天。在本系列文章中,我们将会探索一些娱乐用途(甚至有时完全没用)的 Linux 命令行小玩具。所有我们介绍的小玩具都是开源的。 -Will they all be unique? Yes. Will they all be unique to you? I don't know, but, chances are you'll find at least one new toy to play with by the time our advent calendar is done. +也许你会问,他们都很独特吗?是的。不过,他们对你是否独特,我就不知道了。但是,我们相信你应该能在这系列文章结束之前找到至少一个好玩的玩具。 -Today's selection is a continuation on the [theme][1] we started yesterday: cats and rainbows. Wait, there's more cat-related rainbow fun to be had at the Linux command line? You bet there is. +从[昨天的选题][1]继续:我们谈到了猫和彩虹。不过,在 Linux 命令行下有更有趣的彩虹和猫结合的程序吗?答案是肯定的。 -So let's make a throwback all the way to 2011's [Nyan Cat][2] with a command-line toy call, not surprisingly, **nyancat**. Did you miss the cultural phenomenon that was Nyan Cat? Watch the embed below, I'll wait. +我们不妨看看之前可以在命令行中使用 Nyan Cat 的方式吧。意料之中,2011 年发布的 [Nyan Cat][2] 可以用 **nyancat** 呈现在终端中。你想念这只曾火遍网络的 Nyan Cat 吗?看看下面这个视频记录吧,我会等你看完的。 -Now, let's recreate that amazing experience in your terminal. **Nyancat** is packaged for many distributions (Arch, Debian, Gentoo, Ubuntu, etc.) but not for mine (Fedora), but compiling from source was simple. In fact, I grabbed the source, built it, and launched it in one line: +现在,让我们在终端中重新感受这个令人惊奇的体验吧。**Nyancat** 包正在很多地方被分发(比如 Arch、Debian、Gentoo、Ubuntu 等等…),不过我的系统(Fedora)没有,但是我们仍然可以很轻松地从源码编译它。事实上,我们只需要一行命令就能做完所有工作: ``` git clone https://github.com/klange/nyancat.git && cd nyancat && make && cd src && ./nyancat ``` -This launched straight into a **nyancat** experience complete with a counter of how long I had been enjoying the **nyancat** magic for. +这直接为我带来了一个 Nyan Cat 体验,甚至还有个计时器来显示我享受 “Nyan Cat 魔法”的时间。 ![](https://opensource.com/sites/default/files/uploads/linux-toy-nyancat-animated.gif) -You can find the source for **nyancat** [on GitHub][3] under an [NCSA open source license][4]. +你可以在 [GitHub][3] 上找到 **nyancat** 的源码,它正以 [NCSA 许可证][4] 开源。 -The command-line version of Nyan Cat used to be [accessible by a public Telnet server][5] (or, for even more pun, with [netcat][6]) so that you didn't even have to install it, but sadly was shut down due to bandwidth limitations. Nevertheless, the [gallery][5] from the old Telnet server running Nyan Cat on a variety of old devices is well-worth checking out, and maybe you'd like to do the community a favor by launching your own public mirror and letting the author know so that they may share it with the public yet again? +命令行版本的 Nyan Cat 可在[这个公共 Telnet 服务器上访问][5](或者 [netcat][6] 也行),所以理论上来说你不必安装它。不过不幸的是,由于带宽限制,该服务器目前已经被关闭了。尽管如此,在各种老设备上连接老 Telnet 服务器上运行 Nyan Cat 的[照片][5]还是值得一看的,说不准你还会萌生搭建一个能让大家连接的公共服务器的想法呢(如果你真的搭建了,请务必告知作者,万一他们可能会向公众分享呢?)。 -Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. +你想让我介绍一下你最喜爱的命令行玩具吗?请在原文下留言,作者会考虑介绍的。 -Check out yesterday's toy, [Bring some color to your Linux terminal with lolcat][1], and check back tomorrow for another! +瞧瞧我们昨天介绍的小玩意:[用 lolcat 为你的 Linux 终端增添些许色彩][1]。明天再来看我们的下一篇文章吧! -------------------------------------------------------------------------------- @@ -46,7 +47,7 @@ via: https://opensource.com/article/18/12/linux-toy-nyancat 作者:[Jason Baker][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[zhs852](https://github.com/zhs852) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ea890f4ca5529cc3ac3708b738fcb504f1f3ec22 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Thu, 27 Dec 2018 11:22:12 +0800 Subject: [PATCH 098/322] Move file to translated --- ...181206 Take a break at the Linux command line with Nyan Cat.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20181206 Take a break at the Linux command line with Nyan Cat.md (100%) diff --git a/sources/tech/20181206 Take a break at the Linux command line with Nyan Cat.md b/translated/tech/20181206 Take a break at the Linux command line with Nyan Cat.md similarity index 100% rename from sources/tech/20181206 Take a break at the Linux command line with Nyan Cat.md rename to translated/tech/20181206 Take a break at the Linux command line with Nyan Cat.md From 66cd09bb26ddefd662d3964e330f6a56651d6ebd Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 27 Dec 2018 12:55:34 +0800 Subject: [PATCH 099/322] PUB:20181016 Lab 5- File system, Spawn and Shell.md @qhwdw https://linux.cn/article-10389-1.html --- .../20181016 Lab 5- File system, Spawn and Shell.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20181016 Lab 5- File system, Spawn and Shell.md (100%) diff --git a/translated/tech/20181016 Lab 5- File system, Spawn and Shell.md b/published/20181016 Lab 5- File system, Spawn and Shell.md similarity index 100% rename from translated/tech/20181016 Lab 5- File system, Spawn and Shell.md rename to published/20181016 Lab 5- File system, Spawn and Shell.md From 7937523908695caa8f093623ea80fb05c6bd98b5 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 27 Dec 2018 19:20:08 +0800 Subject: [PATCH 100/322] PRF:20181217 Take a swim at your Linux terminal with asciiquarium.md @amwps290 --- ...t your Linux terminal with asciiquarium.md | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/translated/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md b/translated/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md index 04ba82841c..70e4a17eb7 100644 --- a/translated/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md +++ b/translated/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md @@ -1,34 +1,35 @@ [#]: collector: "lujun9972" -[#]: translator: " amwps290" -[#]: reviewer: " " +[#]: translator: "amwps290" +[#]: reviewer: "wxy" [#]: publisher: " " [#]: url: " " [#]: subject: "Take a swim at your Linux terminal with asciiquarium" [#]: via: "https://opensource.com/article/18/12/linux-toy-asciiquarium" [#]: author: "Jason Baker https://opensource.com/users/jason-baker" -# 使用 asciiquarium 在你的终端里探索海洋的秘密 +在你的终端里探索海洋的秘密 +======= + +> “亲爱的,当您的命令行变得更湿润的时候会更好。这多亏了 ASCII。” -亲爱的,当您的命令行变得更湿润的时候会更好。这多亏了 ASCII。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-asciiquarium.png?itok=ZhJ9P2Ft) -现在,我们即将数完长达 24 天的 Linux 命令行玩具倒数日历。离今天只剩一周了!如果这是您第一次访问本系列文章,那么您可能会问自己什么是命令行玩具。我们一边走,一边说,但一般来说,这可能是一个游戏,或者可以帮助你在终端玩得开心的任何简单的娱乐活动。 +现在,我们即将数完长达 24 天的 Linux 命令行玩具日历。离今天只剩一周了!如果这是您第一次访问本系列文章,那么您可能会问自己什么是命令行玩具。我们一边走,一边说,但一般来说,这可能是一个游戏,或者可以帮助你在终端玩得开心的任何简单的娱乐活动。 你们其中的一些人可能已经在以前的系列文章中看到了各种各样的命令行玩具。但是,我们希望每个人都能够获得一个新玩具。 -今天的玩具有一点鱼的味道。先和 **asciiquarium** 打个招呼,一个在你终端里海底冒险的玩具。我是在我的 Fedora 仓库里发现 asciiquarium 的,因此安装它非常容易: +今天的玩具有一点鱼的味道。先和 `asciiquarium` 打个招呼,一个在你终端里海底冒险的玩具。我是在我的 Fedora 仓库里发现 `asciiquarium` 的,因此安装它非常容易: ``` $ sudo dnf install asciiquarium ``` -如果您正在运行不同的发行版,那么它也可能已经为您打包。 只需在您的终端中运行 **asciiquarium** 即可感受到蛤蜊的快乐。 该项目也在终端之外进行了“翻译”,所有水族伙伴的屏保都是为非 Linux 操作系统制作的,甚至还有一个 Android 动态壁纸版本。 +如果您正在运行不同的发行版,那么它也可能已经为您打包。 只需在您的终端中运行 `asciiquarium` 即可感受到蛤蜊的快乐。 该项目也在终端之外进行了“翻译”,所有水族伙伴的屏保都是为几个非 Linux 操作系统制作的,甚至还有一个 Android 动态壁纸版本。 -访问 **asciiquarium** [主页][1]了解更多信息或下载 Perl 源代码。 该项目是 GPL 第 2 版许可证下的开源项目。 如果你想更多地了解开源,开放数据和开放科学如何在实际的海洋中发挥作用,请花点时间去了解[海洋健康指数][2]。 +访问 asciiquarium [主页][1]了解更多信息或下载 Perl 源代码。 该项目是 GPL 第 2 版许可证下的开源项目。 如果你想更多地了解开源,开放数据和开放科学如何在实际的海洋中发挥作用,请花点时间去了解[海洋健康指数][2]。 ![](https://opensource.com/sites/default/files/uploads/linux-toy-asciiquarium-animated.gif) - 你觉得我应该介绍一下你最喜欢的命令行玩具吗?时间不多了,但我还是想听听你的建议。请在下面的评论中告诉我,我会查阅的。让我知道你对今天的娱乐有什么看法。 一定要看看昨天的玩具,[安排一次与 Emacs 精神病医生的访问][3],明天再来看另一个玩具! @@ -40,7 +41,7 @@ via: https://opensource.com/article/18/12/linux-toy-asciiquarium 作者:[Jason Baker][a] 选题:[lujun9972][b] 译者:[amwps290](https://github.com/amwps290) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From a28d4e3550a084c4d1a8c29b006302854462900c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 27 Dec 2018 19:21:24 +0800 Subject: [PATCH 101/322] PUB:20181217 Take a swim at your Linux terminal with asciiquarium.md @amwps290 https://linux.cn/article-10390-1.html --- ...17 Take a swim at your Linux terminal with asciiquarium.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181217 Take a swim at your Linux terminal with asciiquarium.md (97%) diff --git a/translated/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md b/published/20181217 Take a swim at your Linux terminal with asciiquarium.md similarity index 97% rename from translated/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md rename to published/20181217 Take a swim at your Linux terminal with asciiquarium.md index 70e4a17eb7..279bc84b54 100644 --- a/translated/tech/20181217 Take a swim at your Linux terminal with asciiquarium.md +++ b/published/20181217 Take a swim at your Linux terminal with asciiquarium.md @@ -1,8 +1,8 @@ [#]: collector: "lujun9972" [#]: translator: "amwps290" [#]: reviewer: "wxy" -[#]: publisher: " " -[#]: url: " " +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-10390-1.html" [#]: subject: "Take a swim at your Linux terminal with asciiquarium" [#]: via: "https://opensource.com/article/18/12/linux-toy-asciiquarium" [#]: author: "Jason Baker https://opensource.com/users/jason-baker" From 3ba36ccdcd007d4f0d8d028beeb0e6c9ae28f12f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 27 Dec 2018 19:47:01 +0800 Subject: [PATCH 102/322] PRF:20180508 Person with diabetes finds open source and builds her own medical device.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @Valoniakim 翻译的很棒 --- ...ource and builds her own medical device.md | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/translated/talk/20180508 Person with diabetes finds open source and builds her own medical device.md b/translated/talk/20180508 Person with diabetes finds open source and builds her own medical device.md index 1a965cdf72..c874777c07 100644 --- a/translated/talk/20180508 Person with diabetes finds open source and builds her own medical device.md +++ b/translated/talk/20180508 Person with diabetes finds open source and builds her own medical device.md @@ -1,21 +1,22 @@ 糖尿病患者们是怎样使用开源造出自己的医疗设备的 ====== +> Red Hat 的 2018 女性开源社区奖获得者 Dana Lewis 的故事。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/health_heartbeat.png?itok=P-GXea-p) -Dana Lewis 被评选为开源社区 2018 年度最佳女性!下面是开源怎样改善了她的健康的故事。 +Dana Lewis 被评选为[开源社区 2018 年度最佳女性][1]!下面是开源怎样改善了她的健康的故事。 -Dana 患有1型糖尿病,但当时市面上流通的药品和医疗设备都对她无效。 -她用来管理血糖的动态血糖监测报警器的声音太小了,根本叫不醒熟睡的她,产品这样的设计无法保证她每天睡眠时间的生命安全。 +Dana 患有 I 型糖尿病,但当时市面上流通的药品和医疗设备都对她无效。她用来管理血糖的动态血糖监测(CGM)报警器的声音太小了,根本叫不醒熟睡的她,产品这样的设计无法保证她每天睡眠时间的生命安全。 “我和生产厂家见了一面商议提出意见,厂家的回复是‘我们产品的音量已经足够大了,很少有人叫不醒’,我被告知‘这不是普遍问题,我们正在改进,请期待我们的新产品。’听到这些时我真的很挫败,但我从没想象过我能做出什么改变,毕竟那是通过了 FDA 标准的医疗设备,不是我们能随意改变的。” -面临着这些阻碍,Dana 想着如果她能把自己的数据从设备里导出,就可以设置手机闹铃来叫醒自己。在2013年末,她看到的一条推特解决了她的疑问。那条推特的作者是一位糖尿病患儿的家长,他把动态血糖监测仪进行了逆向工程,这样就可以导出孩子的血糖数据进行远程监控了。 +面临着这些阻碍,Dana 想着如果她能把自己的数据从设备里导出,就可以设置手机闹铃来叫醒自己。在 2013 年末,她看到的一条推特解决了她的疑问。那条推特的作者是一位糖尿病患儿的家长,他把动态血糖监测仪进行了逆向工程,这样就可以导出孩子的血糖数据进行远程监控了。 她意识到如果对方愿意把过程分享给她,她也可以用那些代码做一个自己的响亮的血糖监测仪了。 “我并不知道向别人要源代码是件稀松平常的事,那是我第一次接触开源。” -那个系统演化成一个响亮闹钟的代码,她也可以把代码在网页上分享给别人。和她的丈夫 Scott Leibrand 一起,她反复向闹铃添加属性,最终合成了一个算法,这个算法不仅能监测实时血糖水平,还能主动预测未来血糖波动。 +那个系统演化成一个响亮闹钟的代码,她也可以把代码在网页上分享给别人。和她的丈夫 Scott Leibrand 一起,她逐步向闹铃添加属性,最终形成了一个算法,这个算法不仅能监测实时血糖水平,还能主动预测未来血糖波动。 随着 Dana 与开源糖尿病患者社区的接触越来越深,她认识了 Ben West,他花了很多年才研究出与 Dana 使用的胰岛素泵沟通数据的方法,与血糖监测仪不同,胰岛素泵不是简单的报告血糖,它是个单独的设备,要按人体需要持续推注胰岛素,比血糖监测仪要复杂得多。 @@ -27,15 +28,15 @@ Dana 患有1型糖尿病,但当时市面上流通的药品和医疗设备都 “正因为我们使用的是开源软件,在做出这个系统之后我们就把成果开源化了,这样可以造福更多的人。”开源人工胰腺系统 (OpenAPS) 由此诞生。 -OpenAPS 社区已经拥有超过600名用户,大家都提供了各种各样的自制“闭路”系统代码。OpenAPS 贡献者们以 #WeAreNotWaiting 话题团结一致,以表达患者群体不该干等着医疗保健工厂制造出真正有效便捷产品的理念。 +OpenAPS 社区已经拥有超过 600 名用户,大家都提供了各种各样的自制“闭路”系统代码。OpenAPS 贡献者们聚集到了 #WeAreNotWaiting 话题之下,以表达患者群体不该干等着医疗保健工厂制造出真正有效便捷产品的理念。 “你可以选择等待未来的商业解决方案,这无可厚非,选择等待是你的自由。等待可以是一种选择,但不能是无法改变的现状。对我来说,开源在医疗保健方面做出的这个举动让等待变成了一种选择。你可以选择不自行解决,你可以选择等待商业解决方案,但如果你不想等了,你无需再等。现在你有很多选择,开源社区的人们已经解决了很多问题。” -OpenAPS 社区由糖尿病患者,患者家属,还有想要合理利用这项技术的人们。在社区的帮助下,Dana 学会了很多种贡献开源项目的方式。她发现许多从 Facebook 或 [Gitter][2] 上过来的非技术贡献者也对 OpenAPS 做出了很大贡献。 +OpenAPS 社区由糖尿病患者、患者家属,还有想要合理利用这项技术的人们。在社区的帮助下,Dana 学会了很多种贡献开源项目的方式。她发现许多从 Facebook 或 [Gitter][2] 上过来的非技术贡献者也对 OpenAPS 做出了很大贡献。 “贡献有很多方式,我们要认识到各种方式的贡献都是平等的。它们一般涉及不同的兴趣领域和技能组合,只有把这些综合起来,才能做成社区的项目。” -她亲身经历过,所以知道自己的贡献不被社区的其他成员认可是怎样难过的感受。对于人们习惯把女性的贡献打折的这一现象,她也不回避。在她的 [2014 年博客][3] 和 [反思][4] 文章中她初次写道在入围开源年度最佳人物时所遭受到的区别待遇,这些待遇让她意识到身为女性的不同。 +她亲身经历过,所以知道自己的贡献不被社区的其他成员认可是怎样难过的感受。对于人们习惯把女性的贡献打折的这一现象,她也不回避。在她的 [2014 年博客][3] 和 [反思][4] 文章中她初次写到在入围开源年度最佳人物时所遭受到的区别待遇,这些待遇让她意识到身为女性的不同。 在她最初的博客中,她写道了自己和丈夫 Scott 同为开源社区成员,遭受到的区别待遇。他们都注意到,Dana 总是被提出一些细枝末节的要求,但 Scott 就不会。而 Scott 总被问道一些技术性问题,即使他向他们推荐 Dana,人们也更倾向于问身为男性的 Scott。大家都或多或少经历过这些行为,Dana 的博文在社区里引起了广泛的讨论。 @@ -45,13 +46,13 @@ OpenAPS 社区由糖尿病患者,患者家属,还有想要合理利用这项 “我想如果我就放弃努力了,可能开源世界里糖尿病患者们的现状会有很大不同。我知道别人不幸的遭遇,他们在开源社区中感受不到认同感和自身价值,最终离开了开源。我希望我们可以继续这种讨论,大家都能意识到如果我们不故意打击贡献者,我们可以变得更加温暖,成员们也能感受到认同感,大家的付出也能得到相应的认可。 -OpenAPS 社区的交流和分享给我们提供了一个很好的例子,它说明非技术性的贡献者对于整个社区的成功都是至关重要的。Dana 在现实社会中的关系和交流经历对她为开源社区做出的宣传有着很大的贡献。她为社区在 [DIYPS blog][5] 上写了很多篇文章,她还在 [TEDx Talk][6] 做过一场演讲, 在 [开源大会 (OSCON)][7] 上也演讲过很多次,诸如此类的还有很多。 +OpenAPS 社区的交流和分享给我们提供了一个很好的例子,它说明非技术性的贡献者对于整个社区的成功都是至关重要的。Dana 在现实社会中的关系和交流经历对她为开源社区做出的宣传有着很大的贡献。她为社区在 [DIYPS 博客][5] 上写了很多篇文章,她还在 [TEDx Talk][6] 做过一场演讲, 在 [开源大会 (OSCON)][7] 上也演讲过很多次,诸如此类的还有很多。 “不是每个项目都像 OpenAPS 一样,对患者有那么大的影响,甚至成为患者中间的主流项目。糖尿病社区在项目的沟通中真的做了很多贡献,引来了很多糖尿病患者,也让需要帮助的人们知道了我们的存在。” Dana 现在的目标是帮助其他疾病的患者社区创建项目。她尤其想要把社区成员们学到的工具和技术和其他的患者社区分享,特别是那些想要把项目进一步提升,进行深入研究,或者想和公司合作的社区。 -“听说很多参与项目的患者都听过这样的话,‘你应该申请个专利;你应该拿它开个公司;你应该成立个非营利组织。’但这些都是大事,它们太耗时间了,不仅占据你的工作时间,甚至强行改变你的专业领域。我这样的人并不想做那样的事,我们更倾向于把精力放在壮大其他项目上,以此帮助更多的人。” +“我听说很多参与项目的患者都听过这样的话,‘你应该申请个专利;你应该拿它开个公司;你应该成立个非营利组织。’但这些都是大事,它们太耗时间了,不仅占据你的工作时间,甚至强行改变你的专业领域。我这样的人并不想做那样的事,我们更倾向于把精力放在壮大其他项目上,以此帮助更多的人。” 在此之后,她开始寻找其他不那么占用时间的任务,比如给小孩们写一本书。Dana 在 2017 年进行了这项挑战,她写了本书给侄子侄女,讲解他们婶婶的糖尿病设备是怎样工作的。在她侄女问她“胳膊上的东西是什么”(那是她的血糖监测仪)时,她意识到她不知道怎么和一个小孩子解释糖尿病患者是什么,所以写了[《卡罗琳的机器人亲戚》][8]这本书。 @@ -70,7 +71,7 @@ via: https://opensource.com/article/18/5/dana-lewis-women-open-source-community- 作者:[Taylor Greene][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[Valoniakim](https://github.com/Valoniakim) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From fb2b0935bbfbb0860f151766c63662185f7ee1ea Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 27 Dec 2018 19:47:25 +0800 Subject: [PATCH 103/322] PUB:20180508 Person with diabetes finds open source and builds her own medical device.md @Valoniakim https://linux.cn/article-10391-1.html --- ...iabetes finds open source and builds her own medical device.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/20180508 Person with diabetes finds open source and builds her own medical device.md (100%) diff --git a/translated/talk/20180508 Person with diabetes finds open source and builds her own medical device.md b/published/20180508 Person with diabetes finds open source and builds her own medical device.md similarity index 100% rename from translated/talk/20180508 Person with diabetes finds open source and builds her own medical device.md rename to published/20180508 Person with diabetes finds open source and builds her own medical device.md From 2502300609c5e1e44ad9134b318cc4bd27e073ef Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 28 Dec 2018 09:03:24 +0800 Subject: [PATCH 104/322] translated --- ...sten to the radio at the Linux terminal.md | 60 ------------------- ...sten to the radio at the Linux terminal.md | 60 +++++++++++++++++++ 2 files changed, 60 insertions(+), 60 deletions(-) delete mode 100644 sources/tech/20181221 Listen to the radio at the Linux terminal.md create mode 100644 translated/tech/20181221 Listen to the radio at the Linux terminal.md diff --git a/sources/tech/20181221 Listen to the radio at the Linux terminal.md b/sources/tech/20181221 Listen to the radio at the Linux terminal.md deleted file mode 100644 index 1d4b241ccb..0000000000 --- a/sources/tech/20181221 Listen to the radio at the Linux terminal.md +++ /dev/null @@ -1,60 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Listen to the radio at the Linux terminal) -[#]: via: (https://opensource.com/article/18/12/linux-toy-mplayer) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) - -Listen to the radio at the Linux terminal -====== -MPlayer is an extremely versatile open source media player that can be surprisingly useful at the Linux command line. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-mplayer.png?itok=6iTm3Xi7) - -You've found your way to our 24-day-long Linux command-line toys advent calendar. If this is your first visit to the series, you might be asking yourself what a command-line toy even is. It could be a game or any simple diversion that helps you have fun at the terminal. - -Some of you will have seen various selections from our calendar before, but we hope there’s at least one new thing for everyone. - -There are many ways to listen to music at the command line; if you've got media stored locally, **cmus** is a great option, but there are [plenty of others][1] as well. - -Lots of times when I'm at the terminal, though, I'd really rather just zone out and not pay close attention to picking each song, and let someone else do the work. While I've got plenty of playlists that work for just such a purpose, after a while, even though go stale, and I'll switch over to an internet radio station. - -Today's toy, MPlayer, is a versatile multimedia player that will support just about any media format you throw at it. If MPlayer is not already installed, you can probably find it packaged for your distribution. On Fedora, I found it in [RPM Fusion][2] (be aware that this is not an "official" repository for Fedora, so exercise caution): - -``` -$ sudo dnf install mplayer -``` - -MPlayer has a slew of command-line options to set depending on your situation. I wanted to listen to the local college radio station here in Raleigh ([88.1 WKNC,][3] they're pretty good!), and so after grabbing the streaming URL from their website, all that took to get my radio up and running, no GUI or web player needed, was: - -``` -$ mplayer -nocache -afm ffmpeg http://wknc.sma.ncsu.edu:8000/wknchd1.mp3 -``` - -MPlayer is open source under the GPLv3, and you can find out more about the project and download source code from the project's [website][4]. - -As I mentioned in yesterday's article, I'm trying to use a screenshot of each toy as the lead image for each article, but as we moved into the world of audio, I had to fudge it a little. So today's image was created from a public domain icon of a radio tower using **img2txt** , which is provided by the **libcaca** package. - -Do you have a favorite command-line toy that you we should have included? Our calendar is basically set for the remainder of the series, but we'd still love to feature some cool command-line toys in the new year. Let me know in the comments below, and I'll check it out. And let me know what you thought of today's amusement. - -Be sure to check out yesterday's toy, [Let you Linux terminal speak its mind][5], and come back tomorrow for another! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-mplayer - -作者:[Jason Baker][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/jason-baker -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/life/16/8/3-command-line-music-players-linux -[2]: https://rpmfusion.org/ -[3]: https://wknc.org/index.php -[4]: http://www.mplayerhq.hu/ -[5]: https://opensource.com/article/18/12/linux-toy-espeak diff --git a/translated/tech/20181221 Listen to the radio at the Linux terminal.md b/translated/tech/20181221 Listen to the radio at the Linux terminal.md new file mode 100644 index 0000000000..9cf4534200 --- /dev/null +++ b/translated/tech/20181221 Listen to the radio at the Linux terminal.md @@ -0,0 +1,60 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Listen to the radio at the Linux terminal) +[#]: via: (https://opensource.com/article/18/12/linux-toy-mplayer) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +在 Linux 终端收听广播 +====== +MPlayer 是一个多功能的开源媒体播放器,它在 Linux 命令行中非常有用。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-mplayer.png?itok=6iTm3Xi7) + +你已经看到我们为期 24 天的 Linux 命令行玩具日历。如果这是你第一次访问该系列,你可能会问自己什么是命令行玩具。它可能是一个游戏或任何简单的消遣,可以帮助你在终端玩得开心。 + +你们中的一些人之前已经看过我们日历中的各种玩具,但我们希望每个人至少见到一件新事物。 + +在命令行中有很多方法可以听音乐。如果你有本地存储的媒体,**cmus** 是一个很好的选择,但还有[很多其他选择][1]。 + +不过,很多时候,当我在终端的时候,我会走神并且不会注意挑选每首歌,并让其他的来做。虽然为了这个我有很多播放列表,但过了一段时间,即使过时,我也会切换到互联网电台。 + +今天的玩具,MPlayer,是一个多功能的多媒体播放器,几乎可以支持任何你给它的媒体格式。如果尚未安装 MPlayer,你可能会发现它已在你的发行版中打包。在 Fedora 中,我在 [RPM Fusion][2] 中找到了它(请注意,这不是 Fedora 的“官方”仓库,因此请谨慎操作): + +``` +$ sudo dnf install mplayer +``` + +MPlayer 有一系列命令行选项可根据你的具体情况进行设置。我想听 Raleigh 当地的大学广播电台([88.1 WKN][3],这个很棒!),在它们的网站得到流媒体网址之后,像这样就可以让收音机运行了,不需要 GUI 或 Web 播放器: + +``` +$ mplayer -nocache -afm ffmpeg http://wknc.sma.ncsu.edu:8000/wknchd1.mp3 +``` + +MPlayer 是 GPLv3 许可证下的开源软件,你可以从项目的[网站][4]中找到更多关于项目的信息并下载源代码。 + +正如我在昨天的文章中提到的,我试图使用每个玩具的截图作为每篇文章的主图,但是当进入音频世界时,我不得不稍微改改。所以今天的图像是由 **libcaca** 包中的 **img2txt** 绘制的来自公共域的无线电塔图标。 + +你有特别喜欢的命令行小玩具需要我介绍的吗?我们的日历基本上是为这个系列剩余的玩具设置的,但我们仍然很想在新的一年里推出一些很酷的命令行玩具。评论告诉我,我会查看的。如果还有空位置,我会考虑介绍它的。并让我知道你对今天的玩具有何看法。 + +一定要看看昨天的玩具,[让你的 Linux 终端说出来][5],明天记得回来! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-mplayer + +作者:[Jason Baker][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jason-baker +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/life/16/8/3-command-line-music-players-linux +[2]: https://rpmfusion.org/ +[3]: https://wknc.org/index.php +[4]: http://www.mplayerhq.hu/ +[5]: https://opensource.com/article/18/12/linux-toy-espeak \ No newline at end of file From 690fb205677ee6a6caf4cd309b7ec4bfc94ce595 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 28 Dec 2018 09:09:55 +0800 Subject: [PATCH 105/322] translating --- ...1217 4 cool new projects to try in COPR for December 2018.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181217 4 cool new projects to try in COPR for December 2018.md b/sources/tech/20181217 4 cool new projects to try in COPR for December 2018.md index 9dc8b3390f..0564320363 100644 --- a/sources/tech/20181217 4 cool new projects to try in COPR for December 2018.md +++ b/sources/tech/20181217 4 cool new projects to try in COPR for December 2018.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 5272b3fc584b12d41606f169e05e9f243888475c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 28 Dec 2018 23:48:04 +0800 Subject: [PATCH 106/322] PRF:20181214 How To Install Rust Programming Language In Linux.md @geekpi --- ...tall Rust Programming Language In Linux.md | 41 +++++++++---------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/translated/tech/20181214 How To Install Rust Programming Language In Linux.md b/translated/tech/20181214 How To Install Rust Programming Language In Linux.md index a2fc9f1382..83346585bf 100644 --- a/translated/tech/20181214 How To Install Rust Programming Language In Linux.md +++ b/translated/tech/20181214 How To Install Rust Programming Language In Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How To Install Rust Programming Language In Linux) @@ -10,9 +10,7 @@ 如何在 Linux 中安装 Rust 编程语言 ====== -Rust 通常被称为 rust-lang。 - -Rust 是一个由 Mozilla Research 赞助的通用、多范式、现代、跨平台和开源系统编程语言。 +Rust 通常被称为 rust-lang。Rust 是一个由 Mozilla Research 赞助的通用的、多范式、现代的、跨平台和开源系统编程语言。 它旨在实现安全性、速度和并发性等目标。 @@ -30,28 +28,28 @@ info: downloading installer Welcome to Rust! -This will download and install the official compiler for the Rust programming +This will download and install the official compiler for the Rust programming language, and its package manager, Cargo. -It will add the cargo, rustc, rustup and other commands to Cargo's bin +It will add the cargo, rustc, rustup and other commands to Cargo's bin directory, located at: - /home/daygeek/.cargo/bin + /home/daygeek/.cargo/bin This path will then be added to your PATH environment variable by modifying the profile files located at: - /home/daygeek/.profile - /home/daygeek/.bash_profile + /home/daygeek/.profile + /home/daygeek/.bash_profile You can uninstall at any time with rustup self uninstall and these changes will be reverted. Current installation options: - default host triple: x86_64-unknown-linux-gnu - default toolchain: stable - modify PATH variable: yes + default host triple: x86_64-unknown-linux-gnu + default toolchain: stable + modify PATH variable: yes 1) Proceed with installation (default) 2) Customize installation @@ -61,25 +59,25 @@ Current installation options: info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu' info: latest update on 2018-12-06, rust version 1.31.0 (abe02cefd 2018-12-04) info: downloading component 'rustc' - 77.7 MiB / 77.7 MiB (100 %) 1.2 MiB/s ETA: 0 s + 77.7 MiB / 77.7 MiB (100 %) 1.2 MiB/s ETA: 0 s info: downloading component 'rust-std' - 54.2 MiB / 54.2 MiB (100 %) 1.2 MiB/s ETA: 0 s + 54.2 MiB / 54.2 MiB (100 %) 1.2 MiB/s ETA: 0 s info: downloading component 'cargo' - 4.7 MiB / 4.7 MiB (100 %) 1.2 MiB/s ETA: 0 s + 4.7 MiB / 4.7 MiB (100 %) 1.2 MiB/s ETA: 0 s info: downloading component 'rust-docs' - 8.5 MiB / 8.5 MiB (100 %) 1.2 MiB/s ETA: 0 s + 8.5 MiB / 8.5 MiB (100 %) 1.2 MiB/s ETA: 0 s info: installing component 'rustc' info: installing component 'rust-std' info: installing component 'cargo' info: installing component 'rust-docs' info: default toolchain set to 'stable' - stable installed - rustc 1.31.0 (abe02cefd 2018-12-04) + stable installed - rustc 1.31.0 (abe02cefd 2018-12-04) Rust is installed now. Great! -To get started you need Cargo's bin directory ($HOME/.cargo/bin) in your PATH +To get started you need Cargo's bin directory ($HOME/.cargo/bin) in your PATH environment variable. Next time you log in this will be done automatically. To configure your current shell run source $HOME/.cargo/env @@ -150,7 +148,7 @@ $ rustup update info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu' info: checking for self-updates - stable-x86_64-unknown-linux-gnu unchanged - rustc 1.31.0 (abe02cefd 2018-12-04) + stable-x86_64-unknown-linux-gnu unchanged - rustc 1.31.0 (abe02cefd 2018-12-04) ``` 运行以下命令从系统中删除 Rust 包。 @@ -164,6 +162,7 @@ $ rustup self uninstall ``` $ rm -fr ~/projects ``` + -------------------------------------------------------------------------------- via: https://www.2daygeek.com/how-to-install-rust-programming-language-in-linux/ @@ -171,9 +170,9 @@ via: https://www.2daygeek.com/how-to-install-rust-programming-language-in-linux/ 作者:[Prakash Subramanian][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://www.2daygeek.com/author/prakash/ -[b]: https://github.com/lujun9972 \ No newline at end of file +[b]: https://github.com/lujun9972 From 2106ca916726019d2f9361cfe8bea927140cff21 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 28 Dec 2018 23:48:39 +0800 Subject: [PATCH 107/322] PUB:20181214 How To Install Rust Programming Language In Linux.md @geekpi https://linux.cn/article-10392-1.html --- ...81214 How To Install Rust Programming Language In Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181214 How To Install Rust Programming Language In Linux.md (98%) diff --git a/translated/tech/20181214 How To Install Rust Programming Language In Linux.md b/published/20181214 How To Install Rust Programming Language In Linux.md similarity index 98% rename from translated/tech/20181214 How To Install Rust Programming Language In Linux.md rename to published/20181214 How To Install Rust Programming Language In Linux.md index 83346585bf..b8ba0c1d38 100644 --- a/translated/tech/20181214 How To Install Rust Programming Language In Linux.md +++ b/published/20181214 How To Install Rust Programming Language In Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10392-1.html) [#]: subject: (How To Install Rust Programming Language In Linux) [#]: via: (https://www.2daygeek.com/how-to-install-rust-programming-language-in-linux/) [#]: author: (Prakash Subramanian https://www.2daygeek.com/author/prakash/) From e1c9b5701cdfd175ede6c2bec58aab712901ea32 Mon Sep 17 00:00:00 2001 From: lctt-bot Date: Fri, 28 Dec 2018 17:00:20 +0000 Subject: [PATCH 108/322] Revert "Update 20171007 The Most Important Database You-ve Never Heard of.md" This reverts commit 1069f1583177821b6e265713744368a0a485a556. --- ...0171007 The Most Important Database You-ve Never Heard of.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/sources/talk/20171007 The Most Important Database You-ve Never Heard of.md b/sources/talk/20171007 The Most Important Database You-ve Never Heard of.md index cebfa1a959..f429aba373 100644 --- a/sources/talk/20171007 The Most Important Database You-ve Never Heard of.md +++ b/sources/talk/20171007 The Most Important Database You-ve Never Heard of.md @@ -1,5 +1,3 @@ -zs19940317翻译中 - The Most Important Database You've Never Heard of ====== In 1962, JFK challenged Americans to send a man to the moon by the end of the decade, inspiring a heroic engineering effort that culminated in Neil Armstrong’s first steps on the lunar surface. Many of the fruits of this engineering effort were highly visible and sexy—there were new spacecraft, new spacesuits, and moon buggies. But the Apollo Program was so staggeringly complex that new technologies had to be invented even to do the mundane things. One of these technologies was IBM’s Information Management System (IMS). From 20abb626839e944e7ee3fa68c0fc1c701113ced3 Mon Sep 17 00:00:00 2001 From: geekpi Date: Sat, 29 Dec 2018 09:15:31 +0800 Subject: [PATCH 109/322] translated --- sources/tech/20181222 A Tale of HTTP-2.md | 75 -------------------- translated/tech/20181222 A Tale of HTTP-2.md | 75 ++++++++++++++++++++ 2 files changed, 75 insertions(+), 75 deletions(-) delete mode 100644 sources/tech/20181222 A Tale of HTTP-2.md create mode 100644 translated/tech/20181222 A Tale of HTTP-2.md diff --git a/sources/tech/20181222 A Tale of HTTP-2.md b/sources/tech/20181222 A Tale of HTTP-2.md deleted file mode 100644 index 897fd83fc5..0000000000 --- a/sources/tech/20181222 A Tale of HTTP-2.md +++ /dev/null @@ -1,75 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (A Tale of HTTP/2) -[#]: via: (https://veronneau.org/a-tale-of-http2.html) -[#]: author: (Louis-Philippe Véronneau https://veronneau.org/) - -A Tale of HTTP/2 -====== - -Around a month ago, someone mentioned the existence of [HTTP/2][1] in an IRC channel I lurk in. For some reason, I had never heard of it and some of the features of this new protocol (like mutiplexing requests without having to open multiple TCP connections) seemed cool. - -To be honest, I had just finished re-writing the Puppet code that manages our backup procedures and enabling HTTP/2 seemed like a productive way to procrastinate before moving on to an another large project. How hard could this be? - -Turns out it took me around 25 hours of work... Sit back and put on comfortable slippers, for this is a tale of HTTP/2! - -[![The Yule Log][2]][3] - -### Cursed Be the HTTP/1.1 - -When I first looked up how to enable HTTP/2 on Apache it seemed a pretty simple task. The documentation mentioned loading the `http2` module and making sure to prioritise the new protocol via a configuration file like this one: - -``` -Protocols h2 h2c http/1.1 - -H2Push on -H2PushPriority core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated after -H2PushPriority text/css before -H2PushPriority image/jpeg after 32 -H2PushPriority image/png after 32 -H2PushPriority application/javascript interleaved -``` - -This would of course have been too easy. Even if everything in Apache was set up properly, websites kept being served as HTTP/1.1. I was obviously doing something right though, since my websites were now sending a new HTTP header: `Upgrade: h2, h2c`. - -After wasting a good deal of time debugging TLS ciphers (HTTP/2 is [incompatible with TLS 1.1][4]), I finally found out the problem was that we weren't using the right multi-processing module for Apache. - -Turns out Apache won't let you serve HTTP/2 while using `mpm_prefork` (the default MPM), as it is not supported by `mod_http2`. Even though there are two other MPM you can use with Apache, only `mpm_prefork` supports `mod_php`. Suddenly, adding support for HTTP/2 meant switching all our webapps built in PHP to PHP-FPM... - -### Down the Rabbit Hole - -![A clip from Alice in Wonderlands][5] - -For the longest time, a close friend has been trying to convince me of the virtues of [PHP-FPM][6]. As great as it looked on paper, I never really did anything about it. It seemed so ... complicated. Regular ol' `mod_php` did the trick just fine and other things required my attention. - -This whole HTTP/2 thing turned out to be the perfect excuse for me to dive into it after all. Once I understood how FPM pools worked, it was actually pretty easy to set up. Since I had to rewrite the Puppet profiles we're using to deploy websites, also I took that opportunity to harden a bunch of things left and right. - -PHP-FPM let's you run websites under different Unix users for added separation. On top of that, I decided it was time for PHP code on our servers to be ran in read-only mode and had to tweak a bunch of things for our Wordpress, Nextcloud, KanBoard and Drupal instances to stop complaining about it. - -After too much time passed automating tasks in Puppet, I finally was able to turn off `mod_php` and `mpm_prefork` everywhere and to enable `mpm_event` and `mod_http2`. The speed bonus offered by PHP-FPM and HTTP/2 is nice, but more than anything I'm happy this whole ordeal forced me to harden the way our Apache servers deal with PHP. - -![Victory!][7] - --------------------------------------------------------------------------------- - -via: https://veronneau.org/a-tale-of-http2.html - -作者:[Louis-Philippe Véronneau][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://veronneau.org/ -[b]: https://github.com/lujun9972 -[1]: https://en.wikipedia.org/wiki/HTTP/2 -[2]: https://veronneau.org/media/blog/2018-12-22/yule_log.jpg (The Yule Log) -[3]: https://commons.wikimedia.org/wiki/File:The_Yule_Log.jpg -[4]: https://http2.github.io/http2-spec/#TLSUsage -[5]: https://veronneau.org/media/blog/2018-12-22/mod_php.gif (A clip from Alice in Wonderlands) -[6]: https://wiki.apache.org/httpd/PHP-FPM -[7]: https://veronneau.org/media/blog/2018-12-22/victory.png (Victory!) diff --git a/translated/tech/20181222 A Tale of HTTP-2.md b/translated/tech/20181222 A Tale of HTTP-2.md new file mode 100644 index 0000000000..9fcaddfad9 --- /dev/null +++ b/translated/tech/20181222 A Tale of HTTP-2.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A Tale of HTTP/2) +[#]: via: (https://veronneau.org/a-tale-of-http2.html) +[#]: author: (Louis-Philippe Véronneau https://veronneau.org/) + +一个 HTTP/2 的故事 +====== + +大约一个月前,有人在我所在的 IRC 频道中提到了 [HTTP/2][1]。由于某种原因,我从未听说过它,而且新协议的一些功能(比如无需打开多个 TCP 连接就能复用请求)似乎很酷。 + +说实话,我刚刚重写了管理我们备份程序的 Puppet 代码,启用 HTTP/2 似乎是一种转向另一个大型项目之前有效的拖延方式。这有多难? + +结果我花了大约 25 个小时来完成。坐下来穿上舒适的拖鞋,因为这是一个 HTTP/2 的故事! + +[![The Yule Log][2]][3] + +### 被诅咒的 HTTP/1.1 + +当我第一次看到如何在 Apache 上启用 HTTP/2 时,这似乎是一项非常简单的任务。文档提到加载 `http2` 模块并通过如下配置文件确保新协议优先: + +``` +Protocols h2 h2c http/1.1 + +H2Push on +H2PushPriority core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated after +H2PushPriority text/css before +H2PushPriority image/jpeg after 32 +H2PushPriority image/png after 32 +H2PushPriority application/javascript interleaved +``` + +这当然很容易。即使 Apache 中的所有内容都已正确设置,网站仍然可以使用 HTTP/1.1。不过,显然我做得没错,因为我的网站现在发送了一个新的 HTTP 头:`Upgrade: h2, h2c`。 + +在浪费了大量时间调试 TLS 密钥(HTTP/2 [与 TLS 1.1 不兼容][4])之后,我终于发现问题是没有使用正确的 Apache 多进程处理模块。 + +事实证明,在使用 `mpm_prefork`(默认 MPM)时,Apache 不会使用 HTTP/2,因为 `mod_http2` 不支持它。尽管 Apache 还有两个其他的 MPM,但只有 `mpm_prefork` 支持 `mod_php`。突然之间,添加对 HTTP/2 的支持意味着我们将要把所有的 PHP 网站切换到 PHP-FPM。 + +### 掉进兔子洞 + +![A clip from Alice in Wonderlands][5] + +在很长一段时间里,一位好友一直试图让我相信 [PHP-FPM][6] 的优点。虽然纸上看起来很好, 但我从来没有真正试过。它看起来很复杂。常规的 `mod_php` 做得很好,还有其他事情需要我注意。 + +事实上,这次的 HTTP/2 事件是让我钻研它的一个契机。在我理解了 FPM 池的工作原理后,它实际上很容易设置。由于我不得不重写我们用于部署网站的 Puppet 配置文件,我也借此机会巩固了一堆东西。 + +PHP-FPM 允许你在不同的 Unix 用户下运行网站来增加隔离性。最重要的是,我决定是时候让我们服务器上的 PHP 代码以只读模式运行,并且不得不为我们的 Wordpress、Nextcloud、KanBoard 和 Drupal 实例调整一些东西来减少报错。 + +过了很长时间通过 Puppet 的自动任务后,我终于能够在任何地方关闭 `mod_php` 和 `mpm_prefork` 并启用 `mpm_event` 和 `mod_http2`。PHP-FPM 和 HTTP/2 带来的速度提升不错,但更让我感到高兴的是这次磨练增强了我们的 Apache 处理 PHP 的能力。 + +![Victory!][7] + +-------------------------------------------------------------------------------- + +via: https://veronneau.org/a-tale-of-http2.html + +作者:[Louis-Philippe Véronneau][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://veronneau.org/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/HTTP/2 +[2]: https://veronneau.org/media/blog/2018-12-22/yule_log.jpg (The Yule Log) +[3]: https://commons.wikimedia.org/wiki/File:The_Yule_Log.jpg +[4]: https://http2.github.io/http2-spec/#TLSUsage +[5]: https://veronneau.org/media/blog/2018-12-22/mod_php.gif (A clip from Alice in Wonderlands) +[6]: https://wiki.apache.org/httpd/PHP-FPM +[7]: https://veronneau.org/media/blog/2018-12-22/victory.png (Victory!) \ No newline at end of file From dae9dd71ed6a29d87ce13b6562dbc4cfcd436cbc Mon Sep 17 00:00:00 2001 From: geekpi Date: Sat, 29 Dec 2018 09:35:14 +0800 Subject: [PATCH 110/322] translating --- sources/tech/20181217 Working with tarballs on Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181217 Working with tarballs on Linux.md b/sources/tech/20181217 Working with tarballs on Linux.md index 29d7b6002f..2c95f1038f 100644 --- a/sources/tech/20181217 Working with tarballs on Linux.md +++ b/sources/tech/20181217 Working with tarballs on Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 3f166ef001f9f6f533a77d659caec64dce028985 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Sat, 29 Dec 2018 18:00:19 +0800 Subject: [PATCH 111/322] Translating --- ...81222 Top 11 best Image Viewer for Ubuntu and other Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md b/sources/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md index 5aea9702e7..071ffa9ab3 100644 --- a/sources/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md +++ b/sources/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (zhs852) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 3912dc35b59ba84b87e687765d3e64427911385b Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sat, 29 Dec 2018 20:42:27 +0800 Subject: [PATCH 112/322] Translating by MjSeven --- sources/tech/20171227 YAML- probably not so great after all.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20171227 YAML- probably not so great after all.md b/sources/tech/20171227 YAML- probably not so great after all.md index ed853ca697..adeab60bd2 100644 --- a/sources/tech/20171227 YAML- probably not so great after all.md +++ b/sources/tech/20171227 YAML- probably not so great after all.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MjSeven ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From aae8930b83a20ad2a99e270c8777dce34a414a04 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 29 Dec 2018 21:17:50 +0800 Subject: [PATCH 113/322] PRF:20181221 Listen to the radio at the Linux terminal.md @geekpi --- ...21 Listen to the radio at the Linux terminal.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/translated/tech/20181221 Listen to the radio at the Linux terminal.md b/translated/tech/20181221 Listen to the radio at the Linux terminal.md index 9cf4534200..ffc4e4357e 100644 --- a/translated/tech/20181221 Listen to the radio at the Linux terminal.md +++ b/translated/tech/20181221 Listen to the radio at the Linux terminal.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Listen to the radio at the Linux terminal) @@ -9,14 +9,16 @@ 在 Linux 终端收听广播 ====== -MPlayer 是一个多功能的开源媒体播放器,它在 Linux 命令行中非常有用。 + +> MPlayer 是一个多功能的开源媒体播放器,它在 Linux 命令行中非常有用。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-mplayer.png?itok=6iTm3Xi7) 你已经看到我们为期 24 天的 Linux 命令行玩具日历。如果这是你第一次访问该系列,你可能会问自己什么是命令行玩具。它可能是一个游戏或任何简单的消遣,可以帮助你在终端玩得开心。 -你们中的一些人之前已经看过我们日历中的各种玩具,但我们希望每个人至少见到一件新事物。 +你们中的一些人之前已经看过我们日历中的各种玩具,但我们希望每个人至少见到一件新玩具。 -在命令行中有很多方法可以听音乐。如果你有本地存储的媒体,**cmus** 是一个很好的选择,但还有[很多其他选择][1]。 +在命令行中有很多方法可以听音乐。如果你有本地存储的媒体,`cmus` 是一个很好的选择,但还有[很多其他选择][1]。 不过,很多时候,当我在终端的时候,我会走神并且不会注意挑选每首歌,并让其他的来做。虽然为了这个我有很多播放列表,但过了一段时间,即使过时,我也会切换到互联网电台。 @@ -47,7 +49,7 @@ via: https://opensource.com/article/18/12/linux-toy-mplayer 作者:[Jason Baker][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -57,4 +59,4 @@ via: https://opensource.com/article/18/12/linux-toy-mplayer [2]: https://rpmfusion.org/ [3]: https://wknc.org/index.php [4]: http://www.mplayerhq.hu/ -[5]: https://opensource.com/article/18/12/linux-toy-espeak \ No newline at end of file +[5]: https://opensource.com/article/18/12/linux-toy-espeak From 93ccb28cc01eda7fe88bc9cc5c806d9cdd113dd9 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Sat, 29 Dec 2018 21:18:28 +0800 Subject: [PATCH 114/322] Translated --- ...Image Viewer for Ubuntu and other Linux.md | 274 ++++++++---------- 1 file changed, 128 insertions(+), 146 deletions(-) diff --git a/sources/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md b/sources/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md index 071ffa9ab3..3125ef4db3 100644 --- a/sources/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md +++ b/sources/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md @@ -7,303 +7,285 @@ [#]: via: (https://itsfoss.com/image-viewers-linux/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -Top 11 best Image Viewer for Ubuntu and other Linux +Linux 下最棒的 11 个图片查看器 ====== -It is probably a good idea to stick with the default system image viewer unless you want a specific feature (that’s missing) or if you crave for better user experience. +如果不是因为系统自带的图片查看器没有你想要的功能,或者你想要更棒的体验,你大概不会想切换到其它图片查看器吧。 -However, if you like to experiment, you may try out different image viewers. You could end up loving the new user experience of viewing the images or get hooked on to the extra features offered. +不过,如果你喜欢折腾,你可能就会想用不同的图片查看器了吧。我猜最终你会被新图片查看器的全新用户体验或特色功能所吸引的。 -In this article, we have mentioned every kind of image viewers ranging from the simplest to the most advanced tool available for Ubuntu or any other Linux distro. +在本篇文章中,无论是简单的还是复杂的、无论是为 Ubuntu 准备的还是其它 Linux 发行版准备的,我们都有提到。 -### Best Image Viewers for Linux +### Linux 下最棒的图片查看器 -![Best image viewers for Ubuntu and other Linux distributions][1] +![Ubuntu 或其它 Linux 发行版适用的最棒的图片查看器][1] -**Note:** You should be able to find these image viewers listed in your software center or AppCenter. If you don’t find it there, we’ve mentioned the instructions for manual installation as well. +**注意:** 在准备安装一个图片查看器时,请前往您系统中预先安装的软件商店中查找。如果您没有任何软件商店或无法在软件商店中找到它,请手动执行我们给出的命令。 #### 1. Nomacs -![nomacs image viewer][2] +![Nomacs 图片查看器][2] -**What’s good about it?** +**它有什么特点?** - * Simple & Fast UI - * Image adjustment tools (color & size) - * Geolocation of the image - * Metadata information panel - * LAN Synchronization - * Fullscreen mode + * 轻快 + * 内建图像调整工具(可以调整色彩和大小) + * 拍摄位置信息 + * 元数据调节器 + * 局域网同步 + * 全屏模式 +Nomacs 是一款自由软件。虽然没有什么出众的功能,但是它的兼容性还不错,可以支持许多常见格式。 +它的界面超级简单,但是提供了简单的图片编辑功能(可以调整色彩、亮度、大小)。除此之外,它还支持全屏模式、元数据调整等功能。 -A free and open source image viewer that does not come baked with any fancy features. However, Nomacs does support most of the common image file formats if you want to use it. +**我该如何安装它?** -The user interface is very simple but it does offer some essential features for image adjustment (color, brightness, resize, crop, & cut). In addition to that, it also supports fullscreen mode, histogram, and a lot of different panels that you can toggle for metadata, edit history, and more such information. - -**How do I install it?** - -You can find it listed in the software center/AppCenter for easy installation. If you want to install it via terminal, you can take a look at their [GitHub page][3] or type in the command below: +简单起见,你可以在各种软件中心中安装它。如果你想通过终端安装它,请参见它的 [GitHub 界面][3] 。或者,在使用 APT 包管理的系统中使用如下命令安装: ``` sudo apt install nomacs ``` -#### 2. Eye Of Gnome -![eye of gnome][4] +#### 2. Gnome 之眼 +![Gnome 之眼][4] -**What’s good about it?** +**它有什么特点?** - * A dead simple image viewer - * Slideshow style (if that’s what you like) - * An image viewer tailored for GNOME desktop environment + * 极其简单的图像查看器 + * 幻灯片视图 + * 为 GNOME 量身打造的图片查看器 +这是一款经典的图片查看器,它在数年前作为 GNOME 项目的一部分被开发出来。不过需要注意的是,对它的维护目前已经不是很活跃了。不过它仍能在最新版 Ubuntu LTS 和部分 Linux 发行版中正常工作。 +如果你需要一个简单、有幻灯片视图并可以在侧栏看到元数据的图像查看器,Gnome 之眼是最佳选择。 -This is a classic image viewer developed as a part of The GNOME Project a lot of years ago. Do note that this isn’t actively maintained anymore. But, it still works on Ubuntu’s latest LTS release and several other Linux distros. +**我该如何安装它?** -If you want a dead simple image viewer where you browse through the images in a slideshow-type UI and get the meta info in the sidebar, Eye of GNOME should be your choice. One of the best for GNOME desktop environment! - -**How do I install it?** - -To manually install it on Ubuntu (or Ubuntu-based Linux distros) type in the following command: +若要在 Ubuntu 及基于 Ubuntu 的 Linux 发行版上安装它,仅需一条命令: ``` sudo apt install eog ``` -For other distros and source, you should follow the [GitHub page.][5] +如果你想在其它发行版中安装它,请参见 [项目的 GitHub 页面][5] 。 -#### 3. Eye Of MATE Image Viewer +#### 3. EOM -![eye of mate image viewer][6] +![EOM 图像查看器][6] -**What’s good about it?** +**它有什么特点?** - * A simple image viewer - * Plugins supported - * An image viewer tailored for MATE desktop environment + * 简洁 + * 可扩展 + * 为 MATE 量身打造的图片查看器 +另一个基本功能齐全,支持幻灯片视图和图像旋转的查看器。 +虽然它没什么特色功能,但它支持大部分的图像格式,并且还能处理大体积的图像。 -Yet another simple image viewer with the basic functionalities of slideshow view and rotating images. +**我该如何安装它?** -Even if doesn’t support any image manipulation feature, it does support numerous image file formats and can handle big image files. - -**How do I install it?** - -For Ubuntu/Ubuntu-based distros, type in the following command: +若要在 Ubuntu 及基于 Ubuntu 的 Linux 发行版上安装它,仅需一条命令: ``` sudo apt install eom ``` -If you need help for other distros and the source, follow their [GitHub page][7]. +如果你想在其它发行版中安装它,请参见 [项目的 GitHub 页面][7] 。 #### 4. Geeqie -![geeqie image viewer][8] +![Geeqie 图像查看器][8] -**What’s good about it?** +**它有什么特点?** - * A flexible image manager that supports plugins (you’ll find other image viewers supported as well) - * Information about the color profile + * 可扩展 + * 色彩信息显示 +Geeqie 是一个令用户印象深刻的图片管理/查看器。他支持将其它查看器作为扩展使用,不过它并不提供任何对图像操作的工具。 +如果你希望获取图像的颜色信息、元数据,或是查看/管理一堆图片,它将会是一个不错的选择。 -Geeqie is an impressive image manager and viewer. It supports other image viewers as plugins but does not offer any image manipulation tools. +**我该如何安装它?** -If you need to know the color profile, image info, and manage/view a collection of images. It should be a good choice for that. - -**How do I install it?** - -Type in the terminal: +在终端输入: ``` sudo apt install geeqie ``` -For the source, you can refer the [GitHub page][9]. +若想查看它的源代码,请前往 [它的 GitHub 主页][9]。 -#### 5. gThumb Image Viewer +#### 5. gThumb -![gthumb image viewer][10] +![gThumb 图片查看器][10] -**What’s good about it?** +**它有什么特点?** - * An all-in-one image viewer with the ability to manage, edit and view the images - * Reset EXIF orientation - * Convert image formats - * Find duplicate images + * 多种功能(查看、编辑和管理) + * 可清除 EXIF 信息 + * 图像格式转换 + * 查找重复的图像 +gThumb 会让你眼前一亮,因为它有很多功能。它的查看/管理界面和编辑工具(裁剪、颜色编辑等等)将会给你留下很深的印象。 +你甚至可以为图像添加评论或清除它的 EXIF 信息。它使得你可以方便地编辑或转码图像。 -gThumb is an amazing image viewer with a lot of features. You get an impressive user interface to view/manage your images along with the basic image manipulation tools (crop, resize, color, and so on.) +**我该如何安装它?** -You can also add comments to an image or reset the EXIF orientation info. It also gives you the ability to find duplicate images and convert image formats. - -**How do I install it?** - -You can enter this command in the terminal: +你可以在终端中输入这条命令: ``` sudo apt install gthumb ``` -If that doesn’t work, head to the [GitHub page][11] for more info. +输了没用?请参阅 [项目 GitHub 主页][11] 来获取帮助。 #### 6. Gwenview -![gwenview image viewer][12] +![Gwenview 图像查看器][12] -**What’s good about it?** +**它有什么特点?** - * A basic image viewer with common image manipulation tools to rotate and resize - * Feature extension using KIPI plugins + * 简单,有基础图像编辑功能(旋转、调整大小) + * 可使用 KIPI 插件扩展 +Gwenview 又是一个基本的图像查看器,它为 KDE 量身定做。不过这并不影响你在其它桌面环境中使用它。 +如果你使用 Konqueror 浏览器,你可以将 Gwenview 作为它的内嵌图片浏览器。你也可以为图片添加评论。此外,它还支持 [KIPI][13] 插件。 -Gwenview is just another basic image viewer tailored for KDE desktop environment. However, you can install it on other desktop environments as well. +**我该如何安装它?** -If you utilize the Konqueror web browser, you can use it as an embedded image viewer. Here, you can add comments/description to the image as well. In addition, it supports [KIPI][13] plugins. - -**How do I install it?** - -Type the following in the terminal to install it: +你可以在终端中输入这条命令: ``` sudo apt install gwenview ``` -For the source, check out their [GitHub page][14]. +若想查看它的源代码,请前往 [它的 GitHub 主页][14]。 #### 7. Mirage -![mirage image viewer][15] +![Mirage 图像查看器][15] -**What’s good about it?** +**它有什么特点?** - * Customizable interface even it is a basic UI - * Basic image manipulation tools - * Command-line access + * 可定制的 UI + * 基本图像编辑工具 + * 可在命令行使用 +如果你想要一个可在命令行中访问、支持全屏和幻灯片视图、带有基础编辑工具以及可定制 UI 的查看器,Mirage 是个不二之选。 +它是一个非常快速且兼容性优良的查看器。它支持包括 png、jpg、svg、xpm、gif、bmp 和 tifff 在内的多种图像格式。 -If you want a decent image viewer along with the ability to access it via command line, a fullscreen mode, slideshow mode, basic editing tools to resize/crop/rotate/flip, and a configurable interface – Mirage would be the simplest option. +**我该如何安装它?** -It is a very fast and capable image viewer that supports a lot of image formats that include png, jpg, svg, xpm, gif, bmp, and tifff. - -**How do I install it?** - -You need to type in the following: +你需要执行: ``` sudo apt install mirage ``` -For the source code and other installation instructions, refer the [GitHub page][16]. +访问 [项目 GitHub 页面][16] 来获取更多信息。 #### 8. KPhotoAlbum -![][17] +![KPhotoAlbum][17] -**What’s good about it?** +**它有什么特点?** - * Perfect image manager to tag and manage the pictures - * Demo databases - * Image compression - * Merge/Remove images to/from Stack + * 为图像添加标签 + * 数据库支持 + * 图片比较 + * 合并/移除一堆图像 +确切地说,KPhotoAlbum 其实不仅仅是一款图像查看器,它还能为图像添加标签并管理图像。 +你可以用它来比较图片以及使用标签搜索你的图片。你还可以使用幻灯片视图来观看图片。 -KPhotoAlbum is not exactly a dedicated image viewer but a photo manager to tag and manage the pictures you’ve got. +**我该如何安装它?** -You can opt for slideshows to view the image along with the ability to compress images and search them using the labels/tags. - -**How do I install it?** - -You can install it via the terminal by typing in: +在终端中输入: ``` sudo apt kphotoalbum ``` -In either case, you can check for the [official instructions on their website][18] to get it installed on your Linux distro. +跟从 [官网上的指引][18] 来在其它 Linux 发行版中安装它。 #### 9. Shotwell -![shotwell][19] +![Shotwell][19] -**What’s good about it?** +**它有什么特点?** - * Red-eye correction tool - * Upload photos to Facebook, Flickr, etc. - * Supports RAW file formats as well + * 红眼消除工具 + * 将照片上传到 Facebook 或 Flickr 等社交网络中 + * 支持原始格式(RAW)的图片 +Shotwell 是一个多功能照片管理器。在此,你能查看或管理你的照片。虽然它没带有许多图像编辑工具,但是你还是可以裁剪和调整亮度的。 +**我该如何安装它?** -Shotwell is a feature-rich photo manager. You can view and manage your photos. Although you do not get all the basic image manipulation tools baked in it – you can easily crop and enhance your photos in a single click (auto brightness/contrast adjustments). - -**How do I install it?** - -Go to the terminal and enter the following (Ubuntu/Ubuntu-based distros): +在终端中执行以下命令 (Ubuntu 及其衍生版本): +``` sudo apt install shotwell +``` -For more information, check out their [GitHub page][20]. +若想获取更多信息,请 [前往它的 GitHub 界面][20]。 #### 10. Ristretto -![ristretto][21] +![Ristretto][21] -**What’s good about it?** +**它有什么特点?** - * A dead simple image viewer - * Fullscreen mode & Slideshow + * 极其简单 + * 全屏模式 + * 幻灯片视图 +简易的图像查看器。它能查看、全屏查看、缩放查看或以幻灯片视图查看图片。 +它是为 Xfce 定制的,但你仍然可以在其它任何地方安装它。 -A very straightforward image viewer where you just get the ability to zoom, view in fullscreen mode and view the images as a slideshow. +**我该如何安装它?** -It is tailored for Xfce desktop environment – but you can install it anywhere. - -**How do I install it?** - -Even though it’s built for Xfce desktop environment, you can install it on any Ubuntu/Ubuntu-based distro by typing the following command in the terminal: +即使它是为 Xfce 桌面环境构建的,你仍能在其它地方安装它。对 Ubuntu 及其衍生发行版,请执行: ``` sudo apt install ristretto ``` + #### 11. digiKam -![digikam image viewer][22] +![digiKam 图像查看器][22] -**What’s good about it?** +**它有什么特点?** - * An all-in-one image viewer with advanced photo management features (editing/managing/viewing) - * Batch Queue Manager - * [Light Table][23] + * 带有高级图像管理功能(查看/管理/编辑)的多合一查看器 + * 可以进行批处理 + * 带有 [Light Table 功能][23] +digiKam 是一个带有多种图像编辑功能的高级照片管理器。你可以使用 SQLite 或 MySQL 来配置它的数据库。 +为了提升你的看图体验,你可以在预览图片时加载低画质的图片。这样一来,即使你有一大堆图片,它也丝滑般流畅。不仅如此,你还可以通过 Google、Facebook、Imgur 等来导入/导出图片。如果你希望使用一个超多功能的查看器,请务必试试这个 digiKam。 -digiKam is an advanced photo manager with some additional image manipulation tools. You get the ability to configure the database using SQLite or MySQL. +**我该如何安装它?** -To enhance your experience of viewing images, it lets you choose the reduced version of images while you preview them. So, that becomes super fast even if you have a lot of images. You get several import/export options via Google, Facebook, Imgur, and so on. If you want a feature-rich image viewer, this is the one you should have installed. - -**How do I install it?** - -Type in the following command: +执行这条命令: ``` sudo apt install digikam ``` -For more information, visit their [GitHub page][24]. +访问 [项目 GitHub 页面][24] 来获取更多信息。 -### Wrapping Up +### 尾声 -So, no matter whether you want a different user experience or a rich set of features and powerful tools to manage your photos – there’s something everyone. +总的来说,无论你想要不同的用户体验、丰富的功能还是强大的管理工具,上面总有适合你的工具。 -Which image viewer do you prefer to use? Is it the system’s default viewer? +你更喜欢哪个图像查看器呢?它是系统自带的吗? -Let us know in the comments below. +欢迎前往原文的评论区留下你的答案。 -------------------------------------------------------------------------------- @@ -311,7 +293,7 @@ via: https://itsfoss.com/image-viewers-linux/ 作者:[Ankush Das][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[zhs852](https://github.com/zhs852) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From dd2c61e1207d9093f8ae727d62853a601766b40d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 29 Dec 2018 21:18:33 +0800 Subject: [PATCH 115/322] PUB:20181221 Listen to the radio at the Linux terminal.md @geekpi https://linux.cn/article-10393-1.html --- .../20181221 Listen to the radio at the Linux terminal.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181221 Listen to the radio at the Linux terminal.md (98%) diff --git a/translated/tech/20181221 Listen to the radio at the Linux terminal.md b/published/20181221 Listen to the radio at the Linux terminal.md similarity index 98% rename from translated/tech/20181221 Listen to the radio at the Linux terminal.md rename to published/20181221 Listen to the radio at the Linux terminal.md index ffc4e4357e..431f579460 100644 --- a/translated/tech/20181221 Listen to the radio at the Linux terminal.md +++ b/published/20181221 Listen to the radio at the Linux terminal.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10393-1.html) [#]: subject: (Listen to the radio at the Linux terminal) [#]: via: (https://opensource.com/article/18/12/linux-toy-mplayer) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) From 3c3cc81a676652e65506accabe95e998a8486db5 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Sat, 29 Dec 2018 21:19:25 +0800 Subject: [PATCH 116/322] Move file to translated --- ...0181222 Top 11 best Image Viewer for Ubuntu and other Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md (100%) diff --git a/sources/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md b/translated/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md similarity index 100% rename from sources/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md rename to translated/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md From 2cb2643f4fcda8e0d73cf3f14f584066789995b1 Mon Sep 17 00:00:00 2001 From: yuqi Date: Sat, 29 Dec 2018 22:14:30 +0800 Subject: [PATCH 117/322] translated and proofread by yuqi --- .../tech/20171111 A CEOs Guide to Emacs.md | 116 ++++++++++-------- 1 file changed, 63 insertions(+), 53 deletions(-) diff --git a/translated/tech/20171111 A CEOs Guide to Emacs.md b/translated/tech/20171111 A CEOs Guide to Emacs.md index d7a5f8ad0d..9e7f9290d4 100644 --- a/translated/tech/20171111 A CEOs Guide to Emacs.md +++ b/translated/tech/20171111 A CEOs Guide to Emacs.md @@ -1,73 +1,73 @@ -一位 CEO 的 Emacs 指南 +一位 CEO 的 Emacs 指南(备选:CEO 的 Emacs 秘籍) =========== -几年前,不,是几十年前,我就在用 Emacs。不论是码代码、编写文档,还是管理邮件和日程,我都用这个编辑器或者是说操作系统,而且我还乐此不疲。许多年过去了,我也转向了其他更新、更好的工具。结果,我已经忘了如何在不用鼠标的情况下来浏览文件。大约三个月前,我意识到我在应用程序和计算机之间切换上耗费了大量的时间,于是就决定再试一次 Emacs。这是个很正确的决定,原因有以下几个。其中包括了 `.emacs` 和 Dropbox 的技巧,可以让你建立一个良好的、可移植的环境。 +几年前,不,是几十年前,我就在用 Emacs。不论是码代码、编写文档,还是管理邮件和日程,我都用这个编辑器,或者是说操作系统,而且我还乐此不疲。许多年过去了,我也转向了其他更新、更好的工具。结果,就连最基本的文件浏览,我都已经忘了在不用鼠标的情况下该怎么操作。大约三个月前,我意识到我在应用程序和计算机之间切换上耗费了大量的时间,于是我决定再次使用 Emacs。这是个很正确的决定,原因有以下几个。其中包括用 `.emacs` 和 Dropbox 来搭建一个良好的、可移植的环境的一些技巧。 -对于那些还没用过 Emacs 的人来说,你可能会讨厌它,但也可能喜欢上它。它有点像一个房子大小的鲁布·戈德堡机械Rube Goldberg machine,乍一看,它具备烤面包机的所有功能。这听起来不像是一种认可,但关键短语是“乍一看”。一旦你了解了 Emacs,你就会意识到它其实是一种可以作为发动机的热核烤面包机……好吧,你可以用来对文字做什么都可以。当考虑到你的计算生活在很大程度上与文本有关时,这是一个相当大胆的声明,真的很大胆。 +对于那些还没用过 Emacs 的人来说,Emacs 会让你爱恨交加。它有点像一个房子大小的鲁布·戈德堡机械Rube Goldberg machine,乍一看,它具备烤面包机的所有功能。这听起来不像是一种认可,但关键词是“乍一看”。一旦你了解了 Emacs,你就会意识到它其实是一台可以当发动机用的的热核烤面包机……好吧,只是文本处理的所有事情。当考虑到你计算机的使用周期在很大程度上都是与文本有关时,这是一个相当大胆的声明。大胆,但却是真的。 -也许对我来说更重要的是,它是我曾经使用过的一个应用程序,并让我觉得我真正的拥有它,而不是把我塑造成一个匿名的“用户”,就好像位于 [Soma][30](LCTT 译注:旧金山的一个街区)或雷蒙德(LCTT 译注:微软总部所在地)附近某个高档办公室的产品营销部门把钱作为明确的目标一样。现代生产力和创作应用程序(如 Pages 或 IDE)就像碳纤维赛车,它们装备得很好,也很齐全。而 Emacs 就像一盒经典的 [Campagnolo][31] (LCTT 译注:世界上最好的三个公路自行车套件系统品牌之一)零件和一个漂亮的自行车牵引式钢框架,但缺少曲柄臂和刹车杆,你必须在网上某个小众文化中找到它们。第一点是它是更快更完整的。第二点就是它会给你带来无尽的快乐或烦恼,这取决于你自己,而且会一直持续到你生命的最后一天。我是那种在找到一堆老古董或用 `Emacs Lisp` 配置编辑器时同样感到高兴的人,具体情况因人而异。 +也许对我来说更重要的是,Emacs 是我曾经使用过的一个应用,并让我觉得我真正的拥有它,而不是把我塑造成一个匿名的“用户”,就好像位于 [Soma][30](LCTT 译注:旧金山的一个街区)或雷蒙德(LCTT 译注:微软总部所在地)附近某个高档办公室的产品营销部门把钱作为明确的目标一样。现代生产力和创作应用程序(如 Pages 或 IDE)就像碳纤维赛车,它们装备得很好,也很齐全。而 Emacs 就像一盒经典的 [Campagnolo][31] (LCTT 译注:世界上最好的三个公路自行车套件系统品牌之一)零件和一个漂亮的自行车牵引式钢框架,但缺少曲柄臂和刹车杆,你必须在网上某个小众文化中找到它们。前者更快而且很完整,后者是无尽的快乐或烦恼的源泉,当然这取决于你自己,而且这种快乐或烦恼会伴随到你死。我就是那种在找到一堆老古董或用 `Emacs Lisp` 配置编辑器时会感到高兴的人,具体情况因人而异。 ![1933 steel bicycle](https://www.fugue.co/hubfs/Imported_Blog_Media/bicycle-1.jpg) *一辆我还在骑的1933年产的钢制自行车。你可以看看框架管差别: [https://www.youtube.com/watch?v=khJQgRLKMU0][6]* -这可能给人一种 Emacs 已经过气或过时的印象。但它不是,它是强大和永恒的,只要你耐心地去理解它的一些规则。它的规则很另类,也很奇怪,但其中的逻辑却引人注目,且很有魅力。对于我来说, Emacs 更像是未来而不是过去。就像牵引式钢框架在未来几十年里将会变得好用和舒适,而神奇的碳纤维自行车将会被扔进垃圾场,在撞击中粉碎一样,Emacs 也将会作为一种在最新的流行应用早已被遗忘的时候的好用的工具继续存在这里。 +这可能给人一种 Emacs 已经过气或过时的印象。然而并不是,Emacs 是强大和永恒的,只要你耐心地去理解它的一些规则。Emacs 的规则很另类,也很奇怪,但其中的逻辑却引人注目,且魅力十足。对于我来说, Emacs 更像是未来而不是过去。就像牵引式钢框架在未来几十年里将会变得好用和舒适,而神奇的碳纤维自行车将会被扔进垃圾场,在撞击中粉碎一样,Emacs 也将会作为一种在最新的流行应用早已被遗忘的时候的好用的工具继续存在这里。 -如果通过编辑 Lisp 代码来构建自己的个人工作环境,并将这种非常适合自己的环境移植到任何计算机的想法吸引了你,那么你可能会爱上 Emacs。如果你喜欢很潮、很炫的,又不想投入太多时间和精力的情况下就能直接工作的话,那么它可能不适合你。我已经不再写代码了(除了 Ludwig 和 Emacs Lisp),但是 Fugue 公司的很多工程师都使用 Emacs 来提高码代码的效率。我公司有 30% 的工程师用 Emacs,40% 用 IDE 和 30% 的用 vim。但这篇文章是关于 CEO 和其他[聪明的老板][32]Pointy-Haired Bosses(PHB[^1] )(以及,其它好奇的人)的 Emacs 指南,所以我将解释或者说辩解我为什么喜欢它以及我如何使用它。同时我也希望我能介绍清楚从而让你能有个良好的体验,而不是花上几个小时去 Google。 +使用 Lisp 代码来构建个人工作环境,并将这个恰到好处的环境移植到任何计算机,如果这种想法打动了你,那么你将会爱上 Emacs。如果你喜欢很潮、很炫的,又不想投入太多时间和精力的情况下就能直接工作的话,那么 Emacs 可能不适合你。我已经不再写代码了(除了 Ludwig 和 Emacs Lisp),但是 Fugue 公司的很多工程师都使用 Emacs 来提高码代码的效率。我公司有 30% 的工程师用 Emacs,40% 用 IDE 和 30% 的用 vim。但这篇文章是写给 CEO 和其他[精英][32]Pointy-Haired Bosses(PHB[^1] )(以及对 Emacs 感兴趣的人)的,所以我将解释或者说辩解我为什么喜欢它以及我如何使用它。同时我也希望我能介绍清楚,从而让你有个良好的体验,而不是花上几个小时去 Google。 ### 恒久优势 使用 Emacs 带来的长期优势是让生活更轻松。与最后的收获相比,最开始的付出完全值得。想想这些: -#### 无需上下文切换 +#### 简单高效 -Org 模式本身就值得花时间,但如果你像我一样,你通常要处理十几份左右的文件 —— 从博客帖子到会议需要做什么的清单,再到员工评估。在现代计算世界中,这通常意味着要使用多个应用程序,所有这些应用程序都有不同的用户界面、保存方式、排序和搜索方式。结果就是你需要不断转换思维环境,记住细节。我讨厌上下文切换,因为它是一种强加到我身上的方式,原因是破坏了界面模型[^2] ,并且我讨厌记住本该是计算机要为我记住的东西。在单个环境下,Emacs 对 PHB 甚至比对于程序员更有用,因为程序员更多时候只需要专注于一个程序。转换思维环境的成本比通常看起来的要高。操作系统和应用程序厂商已经构建了各种界面,以分散我们对这一现实的注意力。如果你是技术人员,通过快捷键(`M-:`)来访问功能强大的[语言解释器][33]会方便的多[^3] 。 +Org 模式本身就值得花时间,但如果你像我一样,你通常要处理十几份左右的文件 —— 从博客帖子到会议事务清单,再到员工评估。在现代计算世界中,这通常意味着要使用多个应用程序,所有这些程序都有不同的用户界面、保存方式、排序和搜索方式。结果就是你需要不断转换思维环境,记住各种细节。我讨厌在程序间切换,这是在强人所难,因为这是个不完整界面模型[^2] ,并且我讨厌记住本该由计算机记住的东西。在单个环境下,Emacs 对 PHB 甚至比对于程序员更高效,因为程序员更多时候只需要专注于一个程序。转换思维环境的成本比表面上的要更高。操作系统和应用程序厂商已经构建了各种界面,以分散我们对这一现实的注意力。如果你是技术人员,通过快捷键(`M-:`)来访问功能强大的[语言解释器][33]会方便的多[^3] 。 -许多应用程序可以全天全屏地用于编辑文本。Emacs 是惟一的,因为它既是编辑器也是 Emacs Lisp 解释器。从本质上说,你工作时只要用电脑上的一两个键就能完成。如果你对编程略知一二,就能发现这意味着你可以在 Emacs 中做 _任何事情_。一旦你在内存中有了这些命令,你的电脑就可以在你工作时几乎实时地为你提供高效的运转。你不会想用 Emacs Lisp 来重建 Excel,只要用简单的一两行代码就能实现 Excel 中大多数的功能。如果我需要处理数字,我更有可能转到 scratch 缓冲区,编写一些代码,而不是打开电子表格。即便是我有一封多行的邮件要写,我通常也会先在 Emacs 中写完,然后再复制粘贴到邮件客户端中。当你可以流畅的书写时,为什么要去切换呢?你可以先从一两个简单的算术开始,随着时间的推移,你可以很容易的在 Emacs 中添加你所需要处理的计算。这在应用程序中可能是独一无二的,同时还提供了让为其他的人创造的丰富特性。还记得艾萨克·阿西莫夫书中那些神奇的终端吗? Emacs 是我所遇到的最接近它们的东西[^4] 。我决定不再用什么应用程序来做这个或那个。相反,我只是工作。拥有一个伟大的工具并致力于此,这才是真正的动力和效率。 +许多应用程序可以全天全屏地用于编辑文本。但Emacs 是唯一的,因为它既是编辑器也是 Emacs Lisp 解释器。从本质上来说,你工作时只要用电脑上的一两个键就能完成。如果你略懂编程的话,就会发现这代表着你可以在 Emacs 中做 _任何事情_。一旦你在内存中存储了这些指令,你的电脑就可以在工作时几乎实时地为你提供高效的运转。你不会想用 Emacs Lisp 来重建 Excel,因为只要用简单的一两行代码就能实现 Excel 中大多数的功能。比如说我要处理数字,我更有可能转到 scratch 缓冲区,编写一些代码,而不是打开电子表格。即便是要写一封比较大的邮件时,我通常也会先在 Emacs 中写完,然后再复制粘贴到邮件客户端中。当你可以流畅的书写时,为什么要去切换呢?你可以先从一两个简单的算术开始,随着时间的推移,你可以很容易的在 Emacs 中添加你所需要处理的计算。这在应用程序中可能是独一无二的,同时还提供了让为其他的人创造的丰富特性。还记得艾萨克·阿西莫夫书中那些神奇的终端吗? Emacs 是我所遇到的最接近它们的东西[^4] 。我决定不再用什么应用程序来做这个或那个。相反,我只是工作。拥有一个伟大的工具并致力于此,这才是真正的动力和效率。 -#### 在安静中创造事情 +#### 静中造物 -拥有我所发现的最好的文本编辑功能的最终结果是什么?有一群人在做各种各样有用的补充吗?发挥了 Lisp 键盘的全部威力了吗?我用 Emacs 来完成所有的创作性工作,处理音乐和图片除外。 +拥有所发现的最好的文本编辑功能的最终结果是什么?有一群人在做各种各样有用的补充吗?发挥了 Lisp 键盘的全部威力了吗?我用 Emacs 来完成所有的创作性工作,音乐和图片除外。 -我的办公桌上有两个显示器。其中一块竖屏是将 Emacs 全天全屏显示,另一个显示浏览器,用来搜索和阅读,通常也会打开一个终端。我将日历、邮件等放在 OS X 的另一个桌面上,当我使用 Emacs 时,这个桌面是隐藏的,同时我也会关掉所有通知。这样就能让我专注于我手头上在做的事了。我发现,在更现代的 UI 应用程序中,消除干扰几乎是不可能的,因为这些应用程序致力于提供帮助和易用性。我不需要经常被提醒该如何操作,我已经做了成千上万次了,我真正需要的是一张干净整洁的白纸用来思考。也许因为年龄和自己的“恶习”,我不太喜欢处在嘈杂的环境中,但我认为这值得一试。看看在你电脑环境中有一些真正的宁静是怎样的。当然,现在很多应用程序都有隐藏界面的模式,谢天谢地,苹果和微软现在都有了真正意义上的全屏模式。但是,没有并没有应用程序可以强大到足以“处理”大多数事务。除非你整天写代码,或者像写一本书一样处理很长的文档,否则你仍然会面临其他应用程序的干扰。而且,大多数现代应用程序似乎同时显得自视甚高,缺乏功能和可用性[^5] 。比起 office 应用程序,我更讨厌其在线版。 +我办公桌上有两个显示器。其中一块竖屏是将 Emacs 全天全屏显示,另一个显示浏览器,用来搜索和阅读,我通常也会打开一个终端。我将日历、邮件等放在 OS X 的另一个桌面上,当我使用 Emacs 时,这个桌面会隐藏起来,同时我也会关掉所有通知。这样就能让我专注于我手头上在做的事了。我发现,越是先进的 UI 应用程序,消除干扰越是不可能,因为这些应用程序致力于提供帮助和易用性。我不需要经常被提醒该如何操作,我已经做了成千上万次了,我真正需要的是一张干净整洁的白纸用来思考。也许因为年龄和自己的“恶习”,我不太喜欢处在嘈杂的环境中,但我认为这值得一试。看看在你电脑环境中有一些真正的宁静是怎样的。当然,现在很多应用程序都有隐藏界面的模式,谢天谢地,苹果和微软现在都有了真正意义上的全屏模式。但是,没有并没有应用程序可以强大到足以“处理”大多数事务。除非你整天写代码,或者像出书一样,处理很长的文档,否则你仍然会面临其他应用程序的干扰。而且,大多数现代应用程序似乎同时显得自视甚高,缺乏功能和可用性[^5] 。比起 office 客户端版,我更讨厌它的在线版。 ![](https://www.fugue.co/hubfs/Imported_Blog_Media/desktop-1.jpg) *我的桌面布局, Emacs 在左边* -但是交流呢?创造和交流之间的差别很大。当我为两者留出不同的时间段时,我的效率会更高。我们 Fugue 公司使用 Slack,痛并快乐着。我把它和我的日历、电子邮件放在一个即时通讯的桌面上,这样,当我正在做事时,我很高兴地能够忽略所有的聊天。只要一个 Slackstorm 或一封风投或董事会董事的电子邮件,就能让我立刻丢掉手头工作。但是,大多数事情通常可以等上一两个小时。 +但是沟通呢?创造和沟通之间的差别很大。当我将这两件事在不同时间段处理时,我的效率会更高。我们 Fugue 公司使用 Slack,痛并快乐着。我把 Slack 和我的日历、电子邮件放在一个即时通讯的桌面上,这样,当我正在做事时,我就能够忽略所有的聊天信息了。虽然只要一个 Slackstorm 或一封风投或董事会董事的电子邮件,就能让我立刻丢掉手头工作。但是,大多数事情通常可以等上一两个小时。 #### 包罗万象,永久长青 -第三个原因是,我发现 Emacs 比其它的环境更有优势的是你可以很容易的用它来处理事务。我的意思是,你所需要的只是通过 Dropbox 类似的网站同步一两个目录,而不是让大量的应用程序以它们自己的方式进行交互和同步。然后,你可以在任何你已经精心打造了适合你的目的的套件的环境中工作了。我在 OS X、Windows,或有时在 Linux 都是这样做的。它非常简单可靠。这种功能很有用,以至于我害怕处理 Pages、Google Docs、Office 或其他类型的文件和应用程序,这些文件和应用程序会迫使我回到文件系统或云中的某个地方去寻找。 +第三个原因是,我发现 Emacs 比其它的环境更有优势的是,你可以很容易地用它来处理事务。我的意思是,你所需要的只是通过类似于 Dropbox 的网站同步一两个目录,而不是让大量的应用程序以它们自己的方式进行交互和同步。然后,你可以在任何你已经精心打造了适合你的目的的套件的环境中工作了。我在 OS X、Windows,或有时在 Linux 都是这样做的。它非常简单可靠。这种功能很有用,以至于我害怕处理 Pages、Google Docs、Office 或其他类型的文件和应用程序,这些文件和应用程序会迫使我回到文件系统或云中的某个地方去寻找。 -限制在计算机上永久存储的因素是文件格式。假设人类已经解决了存储问题[^6] ,随着时间的推移,我们面临的问题是我们能否够继续访问我们创建的信息。文本文件是最长青的计算格式。你可以用 Emacs 轻松地打开 1970 年的文本文件。然而对于 Office 应用程序却并非如此。同时文本文件要比 Office 应用程序数据文件小得多,也要好的多。作为一个数码背包迷,作为一个在脑子里一闪而过就会做很多小笔记的人,拥有一个简单、轻便、永久、随时可用的东西对我来说很重要。 +限制在计算机上永久存储的因素是文件格式。假设人类已经解决了存储问题[^6] ,随着时间的推移,我们面临的问题是我们能否够继续访问我们创建的信息。文本文件是保存时间最久的格式。你可以用 Emacs 轻松地打开 1970 年的文本文件。然而对于 Office 应用程序却并非如此。同时文本文件要比 Office 应用程序数据文件小得多,也要好的多。作为一个数码背包迷,作为一个在脑子里一闪而过就会做很多小笔记的人,拥有一个简单、轻便、永久、随时可用的东西对我来说很重要。 -如果你准备尝试 Emacs,请继续阅读!下面的部分不会取代完整的教程,但是在完成阅读时,就可以操作了。 +如果你准备尝试 Emacs,请继续读下去!下面的部分不是完整的教程,但是在读完后,就可以动手操作了。 -### 学会驾驭 Emacs —— 一个专业的配置 +### 驾驭之道 —— 专业定制 所有这些强大、精神上的平静和安宁的代价是,Emacs 有一个陡峭的学习曲线,它的一切都与你以前所习惯的不同。一开始,这会让你觉得你是在浪费时间在一个过时和奇怪的应用程序上,就好像穿越到过去。这有点像你只开过车,却要你去学骑自行车[^7] 。 -#### 该选哪个 Emacs +#### 类型抉择 我用的是来自 GNU 的 OS X 和 Windows 的通用版本的 Emacs。你可以在 [http://emacsformacos.com/][35] 获取 OS X 版本,在 [http://www.gnu.org/software/emacs/][37] 获取 Windows 版本。市面上还有很多其他版本,尤其是 Mac 版本,但我发现,要做一些功能强大的东西(涉及到 Lisp 和许多模式),学习曲线要比实际操作低得多。下载,然后我们就可以开始了[^8] ! -#### 首先,学会导航 +#### 驾驭之始 在本文中,我将使用 Emacs 的按键和组合键约定。`C` 表示 `Control` 键,`M` 表示 `meta`(通常是 `Alt` 或 `Option` 键),以及用于组合键的连字符。因此,`C-h t` 表示同时按下 `Control` 和 `h` 键,然后释放,再按下 `t`。这个组合快捷键会指向一个教程,这是你首先要做的一件事。 -不要使用方向键或鼠标。它们可以工作,但是你应该给自己一周的时间来使用 Emacs 教程中的原生的导航命令。一旦你这些命令变为了肌肉记忆,你可能就会乐在其中,无论到哪里,你都会非常想念它们。这个 Emacs 教程在介绍它们方面做得很好,但是我将进行总结,所以您不需要阅读全部内容。最无聊的是,不用方向键,用 `C-b` 向前移动,用 `C-f` 向后移动,上一行用 `C-p`,下一行用 `C-n`。你可能会想:“我用方向键就很好,为什么还要这样做?” 有几个原因。首先,你不需要从主键盘区将你的手移开。第二,使用 `Alt`(或用 Emacs 的说法 `Meta`)键来向前或向后在单词间移动。显而易见这样更方便。第三,如果想重复某个命令,可以在命令前面加上一个数字。在编辑文档时,我经常使用这种方法,通过估计向后移动多少个单词或向上或向下移动多少行,然后按下 `C-9 C-p` 或 `M-5 M-b` 之类的快捷键。其它真正重要的导航命令基于开头用 `a` 和结尾用 `e`。在行中使用 `C-a|e`,在句中使用 `M-a|e`。为了让句中的命令正常工作,需要在句号后增加两个空格,这同时提供了一个有用的特性,并消除了脑中一个过时的[观点][38]。如果需要将文档导出到单个空间[发布环境][39],可以编写一个宏来执行此操作。 +不要使用方向键或鼠标。它们可以工作,但是你应该给自己一周的时间来使用 Emacs 教程中的原生的导航命令。一旦你这些命令变为了肌肉记忆,你可能就会乐在其中,无论到哪里,你都会非常想念它们。这个 Emacs 教程在介绍它们方面做得很好,但是我将进行总结,所以你不需要阅读全部内容。最无聊的是,不用方向键,用 `C-b` 向前移动,用 `C-f` 向后移动,上一行用 `C-p`,下一行用 `C-n`。你可能会想:“我用方向键就很好,为什么还要这样做?” 有几个原因。首先,你不需要从主键盘区将你的手移开。第二,使用 `Alt`(或用 Emacs 的说法 `Meta`)键来向前或向后在单词间移动。显而易见这样更方便。第三,如果想重复某个命令,可以在命令前面加上一个数字。在编辑文档时,我经常使用这种方法,通过估计向后移动多少个单词或向上或向下移动多少行,然后按下 `C-9 C-p` 或 `M-5 M-b` 之类的快捷键。其它真正重要的导航命令基于开头用 `a` 和结尾用 `e`。在行中使用 `C-a|e`,在句中使用 `M-a|e`。为了让句中的命令正常工作,需要在句号后增加两个空格,这同时提供了一个有用的特性,并消除了脑中一个过时的[观点][38]。如果需要将文档导出到单个空间[发布环境][39],可以编写一个宏来执行此操作。 Emacs 所附带的教程很值得去看。对于真正缺乏耐心的人,我将介绍一些重要的命令,但那个教程非常有用。记住:用 `C-h t` 进入教程。 -#### 学会复制和粘贴 +#### 驾驭之复制粘贴 -你可以把 Emacs 设为 CUA 模式,这将会以熟悉的方式工作来操作复制粘贴,但是原生的 Emacs 方法更好,而且你一旦学会了它,就很容易。你可以使用 `Shift` 和导航命令来标记区域(如同选择)。所以 `C-F` 是选中光标前的一个字符,等等。亦可以用 `M-w` 来复制,用 `C-w` 剪切,然后用 `C-y` 粘贴。这些实际上叫做删除killing召回yanking,但它非常类似于剪切和粘贴。在删除中有些小技巧,但是现在,你只需要关注剪切、复制和粘贴。如果你开始尝试了,那么 `C-x u` 是撤销。 +你可以把 Emacs 设为 CUA 模式,这将会以熟悉的方式工作来操作复制粘贴,但是原生的 Emacs 方法更好,而且你一旦学会了它,就很容易。你可以使用 `Shift` 和导航命令来标记区域(如同选择)。所以 `C-F` 是选中光标前的一个字符,等等。亦可以用 `M-w` 来复制,用 `C-w` 剪切,然后用 `C-y` 粘贴。这些实际上叫做删除killing召回yanking,但它非常类似于剪切和粘贴。在删除中还有一些小技巧,但是现在,你只需要关注剪切、复制和粘贴。如果你开始尝试了,那么 `C-x u` 是撤销。 -#### 下一步,学会用 Ido 模式 +#### 驾驭之 Ido 模式 -相信我,Ido 会让文件的工作变得很简单。通常,你在 Emacs 中处理文件不需要使用一个单独的访达或文件资源管理器的窗口。相反的,你可以用编辑器的命令来创建、打开和保存文件。如果没有 Ido 的话,这将有点麻烦,所以我建议你在学习其他之前安装好它。 Ido 是 Emacs 的 22 版时开始出现的,但是需要对你的 `.emacs` 文件做一些调整,来确保它一直开启着。这是个配置环境的好理由。 +相信我,Ido 会让文件的工作变得很简单。通常,你在 Emacs 中处理文件不需要使用一个单独的访达或文件资源管理器的窗口。相反,你可以用编辑器的命令来创建、打开和保存文件。如果没有 Ido 的话,这将有点麻烦,所以我建议你在学习其他之前安装好它。 Ido 是 Emacs 的 22 版时开始出现的,但是需要对你的 `.emacs` 文件做一些调整,来确保它一直开启着。这是个配置环境的好理由。 Emacs 中的大多数功能都表现在模式上。要安装指定的模式,需要做两件事。嗯,一开始你需要做一些额外的事情,但这些只需要做一次,然后再做这两件事。那么,这件额外的事情是你需要一个单独的位置来放置所有 Emacs Lisp 文件,并且你需要告诉 Emacs 这个位置在哪。我建议你在 Dropbox 上创建一个单独的目录,那是你 Emacs 主目录。在这里,你需要创建一个 `.emacs` 文件和 `.emacs.d` 目录。在 `.emacs.d` 目录下,创建一个 `lisp` 的目录。就像这样: @@ -81,7 +81,7 @@ home -lisp ``` -你可以将那些比如模式的 `.el` 文件放到 `home/.emacs.d/lisp` 目录下,然后在你的 `.emacs` 文件中添加以下代码来指明该路径: +你可以将 `.el` 文件,比如说模式文件,放到 `home/.emacs.d/lisp` 目录下,然后在你的 `.emacs` 文件中添加以下代码来指明该路径: ``` (add-to-list 'load-path "~/.emacs.d/lisp/") @@ -89,11 +89,11 @@ home Ido 模式是 Emacs 自带的,所以你不需要在你的 `lisp` 目录中放这个 `.el` 文件,但你仍然需要添加上面代码,因为下面的介绍会使用到它. -#### 符号链接是你的好伙伴 +#### 驾驭之符号链接 等等,这里写的 `.emacs` 和 `.emacs.d` 都是存放在你的主目录下,但我们把它们放到了 Dropbox 的某些愚蠢的文件夹!对,这就让你的环境在任何地方都很容易使用。把所有东西都保存在 Dropbox 上,并做符号链接到 `~` 下的 `.emacs` 、`.emacs.d` 和你的主要存放文档的目录。在 OS X 上,使用 `ln -s` 命令非常简单,但在 Windows 上却很麻烦。幸运的是,Emacs 提供了一种简单的方法来替代 Windows 上的符号链接,Windows 的 `HOME` 环境变量。转到 Windows 的环境变量(Windows 10,你可以按 Windows 键然后输入 “环境变量” 来搜索,这是 Windows 10 最好的地方了),在你的帐户下创建一个指向你在 Dropbox 中 Emacs 的文件夹的 `HOME` 环境变量。如果你想方便地浏览 Dropbox 之外的本地文件,你可能想在你的实际主目录下建立一个到 Dropbox 下 Emacs 主目录的符号链接。 -至此,你已经完成了在任意机器上指向你的 Emacs 配置和文件所需的技巧。如果你买了一台新电脑,或者用别人的电脑一小时或一天,你就可以得到你的整个工作环境。第一次做这个似乎有点困难,但是一旦你知道你在做什么,就(最多)只需要 10 分钟。 +至此,你已经完成了在任意机器上指向你的 Emacs 配置和文件所需的技巧。如果你买了一台新电脑,或者用别人的电脑一小时或一天,你就可以得到你的整个工作环境。第一次操作起来似乎有点难,但是一旦你知道你在做什么,就(最多)只需要 10 分钟。 但我们现在是在配置 Ido …… @@ -121,9 +121,9 @@ C-x C-f ~/o[RET]/bl[RET].or[RET] 其中 `[RET]` 是我使用 `Ido` 模式的自动补全而按下的回车键。所以,这只需要按 12 个键,如果你习惯了的话, 这将比打开访达或文件资源管理器再用鼠标点要节省 _很_ 多时间。 Ido 模式很有用,而这只是操作 Emacs 的一种实用模式而已。下面让我们去探索一些其它对完成工作很有帮助的模式吧。 -#### 字体及风格 +#### 驾驭之字体风格 -我推荐在 Emacs 中使用漂亮的字体族。它们可以使用不同的括号、0 和其他字符进行自定义。你可以在字体文件本身中构建额外的行间距。我推荐 1.5 倍的行间距,并在代码和数据中使用不等宽字体。写作中我用 `Serif` 字体,它有一种紧凑但时髦的感觉。你可以在 [http://input.fontbureau.com/][40] 上找到它们,在那里你可以根据自己的喜好进行定制。你可以使用 Emacs 中的菜单手动设置字体,但这会将代码保存到你的 `.emacs` 文件中,如果您使用多个设备,您可能需要一些不同的设置。我将我的 `.emacs` 设置为根据使用的机器的名称来相应配置屏幕。代码如下: +我推荐在 Emacs 中使用漂亮的字体族。它们可以使用不同的括号、0 和其他字符进行自定义。你可以在字体文件本身中构建额外的行间距。我推荐 1.5 倍的行间距,并在代码和数据中使用不等宽字体。写作中我用 `Serif` 字体,它有一种紧凑但时髦的感觉。你可以在 [http://input.fontbureau.com/][40] 上找到它们,在那里你可以根据自己的喜好进行定制。你可以使用 Emacs 中的菜单手动设置字体,但这会将代码保存到你的 `.emacs` 文件中,如果你使用多个设备,你可能需要一些不同的设置。我将我的 `.emacs` 设置为根据使用的机器的名称来相应配置屏幕。代码如下: ``` ;; set up fonts for different OSes. OSX toggles to full screen. @@ -140,9 +140,9 @@ C-x C-f ~/o[RET]/bl[RET].or[RET] (set-face-attribute 'default nil :font myfont :height 104))) ``` -您应该将你的 Emacs 中的 `system-name` 的值替换成你通过 `(system-name)` 得到的值。注意,在 Sampo (我的 MacBook)上,我还将 Emacs 设置为全屏。我也想在 Windows 实现这个,但是 Windows 和 Emacs 并不真正喜欢对方,当我尝试这个时,它总是不稳定。相反,我只能在启动后手动全屏。 +你应该将 Emacs 中的 `system-name` 的值替换成你通过 `(system-name)` 得到的值。注意,在 Sampo (我的 MacBook)上,我还将 Emacs 设置为全屏。我也想在 Windows 实现这个功能,但是 Windows 和 Emacs 好像互相嫌弃对方,当我尝试配置时,它总是不稳定。相反,我只能在启动后手动全屏。 -我还建议去掉 Emacs 中的上世纪 90 年代出现的难看工具栏,当时最酷的事情是在应用程序中使用工具栏。我还去掉了一些其它的“电镀层”,这样我就有了一个简单、高效的界面。把这些加到你的 `.emacs` 的文件中来去掉工具栏和滚动条,但要保留菜单(在 OS X 上,它将被隐藏,除非你将鼠标到屏幕顶部): +我还建议去掉 Emacs 中的上世纪 90 年代出现的难看工具栏,当时比较流行在应用程序中使用工具栏。我还去掉了一些其它的“电镀层”,这样我就有了一个简单、高效的界面。把这些加到你的 `.emacs` 的文件中来去掉工具栏和滚动条,但要保留菜单(在 OS X 上,它将被隐藏,除非你将鼠标到屏幕顶部): ``` (if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1)) @@ -150,11 +150,11 @@ C-x C-f ~/o[RET]/bl[RET].or[RET] (if (fboundp 'menu-bar-mode) (menu-bar-mode 1)) ``` -#### Org 模式 +#### 驾驭之 Org 模式 -我基本上是在 Org 模式下处理工作的。它是我创作文档、记笔记、列任务清单以及 90% 其他工作的首选环境。Org 模式最初是由一个在会议中使用笔记本电脑的家伙构想出来的,它是笔记和待办事项列表的组合工具。我反对在会议中使用笔记本电脑,自己也不使用,所以我的用法与他的有些不同。对我来说,Org 模式主要是一种处理结构中内容的方式。在 Org 模式中有标题和副标题等,它们的作用就像一个大纲。Org 模式允许你展开或隐藏大纲树,还可以重新排列该树。这非常很符合我的想法,而且我发现用这种方式使用它是一种乐趣。 +我基本上是在 Org 模式下处理工作的。它是我创作文档、记笔记、列任务清单以及 90% 其他工作的首选环境。Org 模式是笔记和待办事项列表的组合工具,最初是由一个在会议中使用笔记本电脑的人构想出来的。我反对在会议中使用笔记本电脑,自己也不使用,所以我的用法与他的有些不同。对我来说,Org 模式主要是一种处理结构中内容的方式。在 Org 模式中有标题和副标题等,它们的作用就像一个大纲。Org 模式允许你展开或隐藏大纲树,还可以重新排列该树。这正合我意,并且我发现用这种方式使用它是一种乐趣。 -Org 模式也有很多让生活愉快的小功能。例如,脚注处理非常好,LaTeX/PDF 输出也很好。Org 模式能够根据所有文档中的待办事项生成议程,并能很好地将它们与日期/时间联系起来。我不把它用在任何形式的外部任务上,这些任务都是在一个共享的日历上处理的,但是在创建事物和跟踪我未来需要创建的东西时,它是无价的。安装它,你只要将 `org-mode.el` 放到你的 `lisp` 目录下,并且如果你想要它基于文档的结构进行缩进并在打开时全部展开的话,在你的 `.emacs` 文件中添加如下代码: +Org 模式也有很多让生活愉快的小功能。例如,脚注处理非常好,LaTeX/PDF 输出也很好。Org 模式能够根据所有文档中的待办事项生成议程,并能很好地将它们与日期/时间联系起来。我不把它用在任何形式的外部任务上,这些任务都是在一个共享的日历上处理的,但是在创建事物和跟踪我未来需要创建的东西时,它是无价的。安装它,你只要将 `org-mode.el` 放到你的 `lisp` 目录下。如果你想要它基于文档的结构进行缩进并在打开时全部展开的话,在你的 `.emacs` 文件中添加如下代码: ``` ;; set up org mode @@ -169,9 +169,9 @@ Org 模式也有很多让生活愉快的小功能。例如,脚注处理非常 ##### 用 Org 模式进行发布 -我关心的是文档的外观和格式化。我刚开始工作时是个设计师,而且我认为信息可以,也应该表现得清晰和美丽。Org 模式对将 LaTeX 生成 PDF 支持的很好,LaTeX 虽然也有学习曲线,但是做简单的事情非常简单。 +我关心的是文档的外观及格式。我刚开始工作时是个设计师,而且我认为信息可以,也应该表现得清晰和美丽。Org 模式对将 LaTeX 生成 PDF 支持的很好,LaTeX 虽然也有学习曲线,但是很容易处理一些简单的事务。 -如果你想使用字体和样式,而不是典型的 LaTeX 字体和样式,你需要做些事。首先,你要用到 XeLaTeX,这样就可以使用普通的系统字体,而不是 LaTeX 的特殊字体。接下来,您需要将以下代码添加到 `.emacs` 中: +如果你想使用字体和样式,而不是典型的 LaTeX 字体和样式,你需要做些事。首先,你要用到 XeLaTeX,这样就可以使用普通的系统字体,而不是 LaTeX 的特殊字体。接下来,你需要将以下代码添加到 `.emacs` 中: ``` (setq org-latex-pdf-process @@ -179,7 +179,7 @@ Org 模式也有很多让生活愉快的小功能。例如,脚注处理非常 "xelatex -interaction nonstopmode %f")) ``` -我把这个放在 `.emacs` 中 Org 模式配置部分的末尾来保持整洁。这让你在从 Org 模式发布时可以使用更多格式化选项。例如,我经常使用: +我把这个放在 `.emacs` 中 Org 模式配置部分的末尾,使文档变得更整洁。这让你在从 Org 模式发布时可以使用更多格式化选项。例如,我经常使用: ``` #+LaTeX_HEADER: \usepackage{fontspec} @@ -191,13 +191,12 @@ Org 模式也有很多让生活愉快的小功能。例如,脚注处理非常 #+TITLE: Document Title Here ``` -这些都可以在你的 `.org` 文件中找到。我们的公司规定的正文字体是 `Maison Neue`,但你也可以在这写上任何适当的东西。我强烈反对使用 `Maison Neue`。它是一种糟糕的字体,任何人都不应该使用它。 +这些都可以在 `.org` 文件中找到。我们的公司规定的正文字体是 `Maison Neue`,但你也可以在这写上任何适当的东西。我很是抵制 `Maison Neue`,因为这是一种糟糕的字体,任何人都不应该使用它。 这个文件是一个使用该配置输出为 PDF 的实例。这就是开箱即用的 LaTeX 一样。在我看来这还不错,但是字体很平淡,而且有点奇怪。此外,如果你使用标准格式,人们会觉得他们正在阅读的东西是、或者假装是一篇学术论文。别怪我没提醒你。 -#### Ace Jump 模式 - -这是个辅助而不是主要功能,但是或许你想使用。它的工作原理有点像之前的 Jef Raskin 的 Leap 功能[^9] 。 按下 `C-c C-SPC`,然后输入要跳转到单词的第一个字母。它会高亮显示所有以该字母开头的单词,并将其替换为字母表中的字母。您只需键入所需位置的字母,光标就会跳转到该位置。我自己经常用这个作为导航键或搜索。将 `.el` 文件下到你的 `lisp` 目录下,并在 `.emacs` 文件添加如下代码: +#### 驾驭之 Ace Jump 模式 +这只是一个辅助模式,而不是一个主模式,但是你也需要它。其工作原理有点像之前提到的 Jef Raskin 的 Leap 功能[^9] 。 按下 `C-c C-SPC`,然后输入要跳转到单词的第一个字母。它会高亮显示所有以该字母开头的单词,并将其替换为字母表中的字母。你只需键入所需位置的字母,光标就会跳转到该位置。我常将它作为导航键或是用来检索。将 `.el` 文件下到你的 `lisp` 目录下,并在 `.emacs` 文件添加如下代码: ``` ;; set up ace-jump-mode @@ -206,20 +205,29 @@ Org 模式也有很多让生活愉快的小功能。例如,脚注处理非常 (define-key global-map (kbd "C-c C-SPC" ) 'ace-jump-mode) ``` -### 更多 +### 待续 -这篇文章已经够详细了,你能在其中的到你所想要的。我很想了解除了编程之外(或用于编程)你对 Emacs 的使用情况,以及这是否有用。在我使用 Emacs 的过程中,可能存在一些自作聪明的老板式想法,如果你能指出它们,我将感激不尽。之后,我可能会写一些更新来介绍其它特性或模式。我很确定我将会向你展示如何在 Emacs 和 Ludwig 模式下使用 Fugue,因为我会将它发展成比代码高亮更有用的东西。请把你的想法发到 [@fugueHQ][41] 上。 +本文已经够详细了,你能在其中得到你所想要的。我很想知道除编程之外(或用于编程)Emacs 的使用情况,及其是否高效。在我使用 Emacs 的过程中,可能存在一些自作聪明的老板式想法,如果你能指出来,我将不胜感激。之后,我可能会写一些更新来介绍其它特性或模式。我很确定我将会向你展示如何在 Emacs 和 Ludwig 模式下使用 Fugue,因为我会将它发展成比代码高亮更有用的东西。更多想法,请在 Twitter 上 [@fugueHQ][41] 。 +### 脚注 -[^1]: If you are now a PHB of some sort, but were never technical, Emacs likely isn’t for you. There may be a handful of folks for whom Emacs will form a path into the more technical aspects of computing, but this is probably a small population. It’s helpful to know how to use a Unix or Windows terminal, to have edited a dotfile or two, and to have written some code at some point in your life for Emacs to make much sense. -[^2]: http://archive.wired.com/wired/archive/2.08/tufte.html -[^3]: I mainly use this to perform calculations while writing. For example, I was writing an offer letter to a new employee and wanted to calculate how many options to include in the offer. Since I have a variable defined in my `.emacs` for outstanding-shares, I can simply type `M-: (* .001 outstanding-shares)`and get a tenth of a point without opening a calculator or spreadsheet. I keep  _lots_ of numbers in variables like this so I can avoid context switching. -[^4]: The missing piece of this is the web. There is an Emacs web browser called eww that will allow you to browse in Emacs. I actually use this, as it is both a great ad-blocker and removes most of the poor choices in readability from the web designer's hands. It's a bit like Reading Mode in Safari. Unfortunately, most websites have lots of annoying cruft and navigation that translates poorly into text. -[^5]: Usability is often confused with learnability. Learnability is how difficult it is to learn a tool. Usability is how useful the tool is. Often, these are at odds, such as with the mouse and menus. Menus are highly learnable, but have poor usability, so there have been keyboard shortcuts from the earliest days. Raskin was right on many points where he was ignored about GUIs in general. Now, OSes are putting things like decent search onto a keyboard shortcut. On OS X and Windows, my default method of navigation is search. Ubuntu's search is badly broken, as is the rest of its GUI. -[^6]: AWS S3 has effectively solved file storage for as long as we have the Internet. Trillions of objects are stored in S3 and they've never lost one of them. Most every service out there that offers cloud storage is built on S3 or imitates it. No one has the scale of S3, so I keep important stuff there, via Dropbox. -[^7]: By now, you might be thinking "what is it with this guy and bicycles?" ... I love them on every level. They are the most mechanically efficient form of transportation ever invented. They can be objects of real beauty. And, with some care, they can last a lifetime. I had Rivendell Bicycle Works build a frame for me back in 2001 and it still makes me happy every time I look at it. Bicycles and UNIX are the two best inventions I've interacted with. Well, they and Emacs. -[^8]: This is not a tutorial for Emacs. It comes with one and it's excellent. I do walk through some of the things that I find most important to getting a useful Emacs setup, but this is not a replacement in any way. -[^9]: Jef Raskin designed the Canon Cat computer in the 1980s after falling out with Steve Jobs on the Macintosh project, which he originally led. The Cat had a document-centric interface (as all computers should) and used the keyboard in innovative ways that you can now imitate with Emacs. If I could have a modern, powerful Cat with a giant high-res screen and Unix underneath, I'd trade my Mac for it right away. [][27][https://youtu.be/o_TlE_U_X3c?t=19s][28] +[^1]: 如果你是位精英,但从没涉及过技术方面,那么 Emacs 并不适合你。对于少数的人来说,Emacs 可能会为他们开辟一条通往计算机技术方面的道路,但这只是极少数。如果你知道怎么使用 Unix 或 Windows 的终端,或者曾编辑过 dotfile,或者说你曾写过一点代码的话,这对使用 Emacs 有很大的帮助。 + +[^2]: 参考链接: http://archive.wired.com/wired/archive/2.08/tufte.html + +[^3]: 我主要是在写作时使用这个模式来进行一些运算。比如说,当我在给一个新雇员写一封入职信时,我想要算这封入职信中有多少个选项。由于我在我的 `.emacs` 为 outstanding-shares 定义了一个变量,所以我只要按下 `M-:` 然后输入 `(* .001 outstanding-shares)` 就能再无需打开计算器或电子表格的情况下得到精度为 0.001 的结果。我使用了 _大量_ 的变量来避免程序间切换。 + +[^4]: 缺少的部分是 web。有个名为 eww 的 Emacs 网页浏览器能够让你在 Emacs 中浏览网页。我用的就是这个,因为它既能拦截广告(译者注:实质上是无法显示,/laugh),同时也在可读性方面为 web 开发者消除了大多数差劲的选项。这个其实有点类似于 Safari 的阅读模式。不幸的是,大部分网站都有很多令人讨厌的繁琐的东西以及难以转换为文本的导航, + +[^5]: 易用性和易学性这两者经常容易被搞混。易学性是指学习使用工具的难易程度。而易用性是指工具高效的程度。通常来说,这是要差别的,就想鼠标和菜单栏的差别一样。菜单栏很容易学会,但是却不怎么高效,以致于早期会存在一些键盘的快捷键。除了在 GUI 方面上,Raskin 在很多方面上的观点都很正确。如今,操作系统正在将一些合适的搜索映射到键盘的快捷键上。比如说在 OS X 和 Windows 上,我默认的导航方式就是搜索。Ubuntu 的搜索做的很差劲,如同它的 GUI 一样差劲。 + +[^6]: 在有网的情况下, [AWSAmazon Web Services S3][42] 是解决文件存储问题的有效方案。数万亿个对象存在 S3 中,但是从来没有遗失过。大部分提供云存储的服务都是在 S3 上或是模拟 S3 构建的。没人能够拥有 S3 一样的规模,所以我将重要的文件通过 Dropbox 存储在上面。 + +[^7]: 目前,你可能会想:“这个人和自行车有什么关系?”……我在各个层面上都喜欢自行车。自行车是迄今为止发明的最具机械效率的交通工具。自行车可以是真正美丽的事物。而且,只要注意点的话,自行车可以用一辈子。早在 2001 年,我曾向 Rivendell Bicycle Works 订购了一辆自行车,现在我每次看到那辆自行车依然很高兴,自行车和 Unix 是我接触过的最好的两个发明。对了,还有 Emacs。 + +[^8]: 这个网站有一个很棒的 Emacs 教程,但不是这个。当我浏览这个页面时,我确实得到了一些对获取高效的 Emacs 配置很重要的知识,但无论怎么说,这都不是个替代品。 + +[^9]: 20世纪80年代,Jef Raskin 与 Steve Jobs 在 Macintosh 项目上闹翻后, Jef Raskin 又设计了 [Canon Cat 计算机][43]。这台 Cat 是以文档为中心的界面(所有的计算机都应如此),并以一种全新的方式使用键盘,你现在可以用 Emacs 来模仿这种键盘。如果现在有一台现代的,功能强大的 Cat 并配有一个高分辨的显示器和 Unix 系统的话,我立马会用 Mac 来换。[][27][https://youtu.be/o_TlE_U_X3c?t=19s][28] -------------------------------------------------------------------------------- @@ -227,7 +235,7 @@ via: https://blog.fugue.co/2015-11-11-guide-to-emacs.html 作者:[Josh Stella][a] 译者:[oneforalone](https://github.com/oneforalone) -校对:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy), [oneforalone](https://github.com/oneforalone) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -273,3 +281,5 @@ via: https://blog.fugue.co/2015-11-11-guide-to-emacs.html [39]:http://practicaltypography.com/one-space-between-sentences.html [40]:http://input.fontbureau.com/ [41]:https://twitter.com/fugueHQ +[42]:https://baike.baidu.com/item/amazon%20s3/10809744?fr=aladdin +[43]:https://en.wikipedia.org/wiki/Canon_Cat From 35948ed908998ae2ab8c1a9a4be2505e299f93b2 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 29 Dec 2018 22:47:30 +0800 Subject: [PATCH 118/322] PRF:20181212 How to Build a Netboot Server, Part 2.md @qhwdw --- ...2 How to Build a Netboot Server, Part 2.md | 178 +++++++++--------- 1 file changed, 89 insertions(+), 89 deletions(-) diff --git a/translated/tech/20181212 How to Build a Netboot Server, Part 2.md b/translated/tech/20181212 How to Build a Netboot Server, Part 2.md index 8887d84ba1..af3487c169 100644 --- a/translated/tech/20181212 How to Build a Netboot Server, Part 2.md +++ b/translated/tech/20181212 How to Build a Netboot Server, Part 2.md @@ -1,18 +1,18 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) -[#]: reviewer: () -[#]: publisher: () -[#]: url: () +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) [#]: subject: (How to Build a Netboot Server, Part 2) [#]: via: (https://fedoramagazine.org/how-to-build-a-netboot-server-part-2/) [#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/) -如何构建一台网络引导服务器(第二部分) +如何构建一台网络引导服务器(二) ====== ![](https://fedoramagazine.org/wp-content/uploads/2018/12/netboot2-816x345.jpg) -在 [如何构建一台网络引导服务器(第一部分)][1] 的文章中,我们展示了如何创建一个网络引导镜像,在那个镜像中使用了一个名为 “liveuser” 帐户,它的 home 目录位于内存中,重启后 home 中的内容将全部消失。然而很多用户都希望机器重启后保存他们的文件和设置。因此,在本系列的第二部分,我们将向你展示如何在第一部分的基础上,重新配置网络引导镜像,使它能够使用 [活动目录][2] 中的用户帐户进行登陆,然后能够从一个 NFS 服务器上自动挂载他们的 home 目录。 +在 [如何构建一台网络引导服务器(一)][1] 的文章中,我们展示了如何创建一个网络引导镜像,在那个镜像中使用了一个名为 `liveuser` 帐户,它的家目录位于内存中,重启后家目录中的内容将全部消失。然而很多用户都希望机器重启后保存他们的文件和设置。因此,在本系列的第二部分,我们将向你展示如何在第一部分的基础上,重新配置网络引导镜像,以便 [活动目录][2] 中的用户帐户可以进行登录,然后从一个 NFS 服务器上自动挂载他们的家目录。 本系列的第三部分,我们将向你展示网络引导客户端如何与中心化配置的 iPXE 引导菜单进行交互。 @@ -22,7 +22,7 @@ ### 删除 Liveuser 帐户 -删除本系列文章第一部分中创建的 “liveuser” 帐户: +删除本系列文章第一部分中创建的 `liveuser` 帐户: ``` $ sudo -i @@ -33,7 +33,7 @@ $ sudo -i ### 配置 NTP、KRB5 和 SSSD -接下来,我们需要将 NTP、KRB5、和 SSSD 的配置文件复制进客户端使用的镜像中,以便于它们能够使用同一个帐户: +接下来,我们需要将 NTP、KRB5 和 SSSD 的配置文件复制进客户端使用的镜像中,以便于它们能够使用同一个帐户: ``` # MY_HOSTNAME=$(> /fc28/etc/$i; done ``` -### 连接活动目录 +### 加入活动目录 -接下来,你将执行一个 chroot 将客户端镜像连接到活动目录。从删除预置在网络引导镜像中相同的计算机帐户开始: +接下来,你将执行一个 `chroot` 将客户端镜像加入到活动目录。从删除预置在网络引导镜像中同名的计算机帐户开始: ``` # MY_USERNAME=jsmith @@ -73,20 +73,20 @@ $ sudo -i # adcli delete-computer "${MY_CLIENT_HOSTNAME%%.*}" -U "$MY_USERNAME" ``` -在网络引导镜像中如果有 krb5.keytab 文件,也删除它: +在网络引导镜像中如果有 `krb5.keytab` 文件,也删除它: ``` # rm -f /fc28/etc/krb5.keytab ``` -在网络引导镜像中执行一个 chroot 操作: +`chroot` 到网络引导镜像中: ``` # for i in dev dev/pts dev/shm proc sys run; do mount -o bind /$i /fc28/$i; done # chroot /fc28 /usr/bin/bash --login ``` -执行一个 join 操作: +执行一个加入操作: ``` # MY_USERNAME=jsmith @@ -97,7 +97,7 @@ $ sudo -i # adcli join $MY_DOMAIN --login-user="$MY_USERNAME" --computer-name="${MY_HOSTNAME%%.*}" --host-fqdn="$MY_HOSTNAME" --user-principal="host/$MY_HOSTNAME@$MY_REALM" --domain-ou="$MY_OU" ``` -现在登出 chroot,并清除命令历史: +现在登出 chroot,并清除 root 用户的命令历史: ``` # logout @@ -105,9 +105,9 @@ $ sudo -i # > /fc28/root/.bash_history ``` -### 安装和配置 PAM Mount +### 安装和配置 PAM 挂载 -我们希望客户端登入后自动挂载它的 home 目录。为实现这个目的,我们将要使用 “pam_mount” 模块。安装和配置 pam_mount: +我们希望客户端登入后自动挂载用户家目录。为实现这个目的,我们将要使用 `pam_mount` 模块。安装和配置 `pam_mount`: ``` # dnf install -y --installroot=/fc28 pam_mount @@ -123,7 +123,7 @@ $ sudo -i END ``` -重新配置 PAM 去使用 pam_mount: +重新配置 PAM 去使用 `pam_mount`: ``` # dnf install -y patch @@ -131,23 +131,23 @@ END # echo 'initgroups: files' >> /fc28/etc/authselect/custom/sssd/nsswitch.conf # patch /fc28/etc/authselect/custom/sssd/system-auth << END @@ -12 +12,2 @@ --auth sufficient pam_sss.so forward_pass -+auth requisite pam_mount.so {include if "with-pammount"} -+auth sufficient pam_sss.so {if "with-pammount":use_first_pass|forward_pass} +-auth sufficient pam_sss.so forward_pass ++auth requisite pam_mount.so {include if "with-pammount"} ++auth sufficient pam_sss.so {if "with-pammount":use_first_pass|forward_pass} @@ -35,2 +36,3 @@ - session required pam_unix.so -+session optional pam_mount.so {include if "with-pammount"} - session optional pam_sss.so + session required pam_unix.so ++session optional pam_mount.so {include if "with-pammount"} + session optional pam_sss.so END # patch /fc28/etc/authselect/custom/sssd/password-auth << END @@ -9 +9,2 @@ --auth sufficient pam_sss.so forward_pass -+auth requisite pam_mount.so {include if "with-pammount"} -+auth sufficient pam_sss.so {if "with-pammount":use_first_pass|forward_pass} +-auth sufficient pam_sss.so forward_pass ++auth requisite pam_mount.so {include if "with-pammount"} ++auth sufficient pam_sss.so {if "with-pammount":use_first_pass|forward_pass} @@ -32,2 +33,3 @@ - session required pam_unix.so -+session optional pam_mount.so {include if "with-pammount"} - session optional pam_sss.so + session required pam_unix.so ++session optional pam_mount.so {include if "with-pammount"} + session optional pam_sss.so END # chroot /fc28 authselect select custom/sssd with-pammount --force ``` @@ -159,17 +159,17 @@ END # echo "$MY_IP $MY_HOSTNAME ${MY_HOSTNAME%%.*}" >> /fc28/etc/hosts ``` -可选,允许所有用户去使用 sudo: +可选,允许所有用户可以使用 `sudo`: ``` # echo '%users ALL=(ALL) NOPASSWD: ALL' > /fc28/etc/sudoers.d/users ``` -### 转换 NFS Root 到一个 iSCSI 背后的存储 +### 转换 NFS 根目录到一个 iSCSI 后备存储器 -在一个 nfsroot 连接建立之后,目前版本的 nfs-utils 可能很难为 home 目录维护一个从客户端到 NFS 服务器的二次连接。当尝试去访问 home 目录时,客户端将被挂住。因此,为了网络引导镜像可共享使用,我们将使用一个不同的协议(iSCSI)来解决这个问题。 +在一个 nfsroot 连接建立之后,目前版本的 nfs-utils 可能很难为家目录建立一个从客户端到 NFS 服务器的第二个连接。当尝试去访问家目录时,客户端将被挂起。因此,为了共享网络引导镜像,我们将使用一个不同的协议(iSCSI)来规避这个问题。 -首先 chroot 到镜像中,去重新配置它的 initramfs,让它从一个 iSCSI root 中去引导: +首先 `chroot` 到镜像中,重新配置它的 `initramfs`,让它从一个 iSCSI 根目录中去引导: ``` # for i in dev dev/pts dev/shm proc sys run; do mount -o bind /$i /fc28/$i; done @@ -186,16 +186,16 @@ END # > /fc28/root/.bash_history ``` -在测试时,qedi 驱动会破坏 iscsi,因此我们将它禁用。 +在测试时,qedi 驱动会破坏 iSCSI,因此我们将它禁用。 -接着,创建一个 fc28.img 的 [稀疏文件][4]。这个稀疏文件代表 iSCSI 目标的背后存储: +接着,创建一个 `fc28.img` [稀疏文件][4]。这个稀疏文件代表 iSCSI 目标的后备存储器: ``` # FC28_SIZE=$(du -ms /fc28 | cut -f 1) # dd if=/dev/zero of=/fc28.img bs=1MiB count=0 seek=$(($FC28_SIZE*2)) ``` -(如果你有一个可使用的稀疏文件、一个单独的分区或磁盘驱动器,就可以代替它了,不用再去创建这个稀疏文件了。) +(如果你有一个可使用的独立分区或磁盘驱动器,也可以用它,而不用再去创建这个稀疏文件了。) 接着,使用一个文件系统去格式化镜像、挂载它、然后将网络引导镜像复制进去: @@ -207,31 +207,31 @@ END # umount $TEMP_MNT ``` -在使用 SquashFS 测试时,客户端偶尔会出现小状况。似乎是因为 SquashFS 在多处理器客户端上没法执行一个随机 I/O。(更多内容见 [squashfs 读取卡顿的奇怪案例][5])。如果你希望使用一个压缩文件系统来提升吞吐性能,[ZFS][6] 或许是个很好的选择。 +在使用 SquashFS 测试时,客户端偶尔会出现小状况。似乎是因为 SquashFS 在多处理器客户端上没法执行随机 I/O。(更多内容见 [squashfs 读取卡顿的奇怪案例][5])。如果你希望使用文件系统压缩来提升吞吐性能,[ZFS][6] 或许是个很好的选择。 如果你对 iSCSI 服务器的吞吐性能要求非常高(比如,成百上千的客户端要连接它),可能需要使用带 [负载均衡][7] 的 [Ceph][8] 集群了。更多相关内容,请查看 [使用 HAProxy 和 Keepalived 负载均衡的 Ceph 对象网关][9]。 ### 安装和配置 iSCSI -为了给我们的客户端提供网络引导镜像,安装 scsi-target-utils 包: +为了给我们的客户端提供网络引导镜像,安装 `scsi-target-utils` 包: ``` # dnf install -y scsi-target-utils ``` -配置 iSCSI 守护程序去提供 fc28.img 文件: +配置 iSCSI 守护程序去提供 `fc28.img` 文件: ``` # MY_REVERSE_HOSTNAME=$(echo $MY_HOSTNAME | tr '.' "\n" | tac | tr "\n" '.' | cut -b -${#MY_HOSTNAME}) # cat << END > /etc/tgt/conf.d/fc28.conf - backing-store /fc28.img - readonly 1 + backing-store /fc28.img + readonly 1 END ``` -通过 /usr/lib/dracut/modules.d/40network/net-lib.sh 来指示预期的 iqn。 +开头的 `iqn.` 是 `/usr/lib/dracut/modules.d/40network/net-lib.sh` 所需要的。 添加一个防火墙例外,并启用和启动这个服务: @@ -242,7 +242,7 @@ END # systemctl start tgtd.service ``` -你现在应该能够使用 tatadm 命令看到这个共享后的镜像: +你现在应该能够使用 `tatadm` 命令看到这个镜像共享了: ``` # tgtadm --mode target --op show @@ -252,42 +252,42 @@ END ``` Target 1: iqn.edu.example.server-01:fc28 - System information: - Driver: iscsi - State: ready - I_T nexus information: - LUN information: - LUN: 0 - Type: controller - SCSI ID: IET 00010000 - SCSI SN: beaf10 - Size: 0 MB, Block size: 1 - Online: Yes - Removable media: No - Prevent removal: No - Readonly: No - SWP: No - Thin-provisioning: No - Backing store type: null - Backing store path: None - Backing store flags: -  LUN: 1 - Type: disk - SCSI ID: IET 00010001 - SCSI SN: beaf11 - Size: 10488 MB, Block size: 512 - Online: Yes - Removable media: No - Prevent removal: No - Readonly: Yes - SWP: No - Thin-provisioning: No - Backing store type: rdwr - Backing store path: /fc28.img - Backing store flags: - Account information: - ACL information: - ALL + System information: + Driver: iscsi + State: ready + I_T nexus information: + LUN information: + LUN: 0 + Type: controller + SCSI ID: IET 00010000 + SCSI SN: beaf10 + Size: 0 MB, Block size: 1 + Online: Yes + Removable media: No + Prevent removal: No + Readonly: No + SWP: No + Thin-provisioning: No + Backing store type: null + Backing store path: None + Backing store flags: + LUN: 1 + Type: disk + SCSI ID: IET 00010001 + SCSI SN: beaf11 + Size: 10488 MB, Block size: 512 + Online: Yes + Removable media: No + Prevent removal: No + Readonly: Yes + SWP: No + Thin-provisioning: No + Backing store type: rdwr + Backing store path: /fc28.img + Backing store flags: + Account information: + ACL information: + ALL ``` 现在,我们可以去删除本系列文章的第一部分中创建的 NFS 共享了: @@ -300,11 +300,11 @@ Target 1: iqn.edu.example.server-01:fc28 # sed -i '/^\/fc28 /d' /etc/fstab ``` -你也可以删除 /fc28 文件系统,但为了以后进一步更新,你可能需要保留它。 +你也可以删除 `/fc28` 文件系统,但为了以后进一步更新,你可能需要保留它。 ### 更新 ESP 去使用 iSCSI 内核 -更新 ESP 去包含启用了 iSCSI 的 initramfs: +更新 ESP 去包含启用了 iSCSI 的 `initramfs`: ``` $ rm -vf $HOME/esp/linux/*.fc28.* @@ -313,7 +313,7 @@ $ cp $(find /fc28/lib/modules -maxdepth 2 -name 'vmlinuz' | grep -m 1 $MY_KRNL) $ cp $(find /fc28/boot -name 'init*' | grep -m 1 $MY_KRNL) $HOME/esp/linux/initramfs-$MY_KRNL.img ``` -更新 boot.cfg 文件去传递新的 root 和 netroot 参数: +更新 `boot.cfg` 文件去传递新的 `root` 和 `netroot` 参数: ``` $ MY_NAME=server-01.example.edu @@ -322,7 +322,7 @@ $ MY_ADDR=$(host -t A $MY_NAME | awk '{print $4}') $ sed -i "s! root=[^ ]*! root=/dev/disk/by-path/ip-$MY_ADDR:3260-iscsi-iqn.$MY_EMAN:fc28-lun-1 netroot=iscsi:$MY_ADDR::::iqn.$MY_EMAN:fc28!" $HOME/esp/linux/boot.cfg ``` -现在,你只需要从 $HOME/esp/linux 目录中复制更新后的文件到所有客户端系统的 ESP 中。你应该会看到类似下面屏幕截图的结果: +现在,你只需要从 `$HOME/esp/linux` 目录中复制更新后的文件到所有客户端系统的 ESP 中。你应该会看到类似下面屏幕截图的结果: ![][10] @@ -334,7 +334,7 @@ $ sed -i "s! root=[^ ]*! root=/dev/disk/by-path/ip-$MY_ADDR:3260-iscsi-iqn.$MY_E # cp -a /fc28 /fc29 ``` -Chroot 进入到镜像的新副本: +`chroot` 进入到镜像的新副本: ``` # for i in dev dev/pts dev/shm proc sys run; do mount -o bind /$i /fc29/$i; done @@ -401,7 +401,7 @@ END # tgt-admin --update ALL ``` -添加新内核并 initramfs 到 ESP: +添加新内核和 `initramfs` 到 ESP: ``` $ MY_KRNL=$(ls -c /fc29/lib/modules | head -n 1) @@ -409,7 +409,7 @@ $ cp $(find /fc29/lib/modules -maxdepth 2 -name 'vmlinuz' | grep -m 1 $MY_KRNL) $ cp $(find /fc29/boot -name 'init*' | grep -m 1 $MY_KRNL) $HOME/esp/linux/initramfs-$MY_KRNL.img ``` -更新 ESP 的 boot.cfg: +更新 ESP 的 `boot.cfg`: ``` $ MY_DNS1=192.0.2.91 @@ -426,7 +426,7 @@ boot || exit END ``` -最后,从我的 $HOME/esp/linux 目录中复制文件到所有客户端系统的 ESP 中去使用它吧! +最后,从我的 `$HOME/esp/linux` 目录中复制文件到所有客户端系统的 ESP 中去使用它吧! -------------------------------------------------------------------------------- @@ -435,13 +435,13 @@ via: https://fedoramagazine.org/how-to-build-a-netboot-server-part-2/ 作者:[Gregory Bartholomew][a] 选题:[lujun9972][b] 译者:[qhwdw](https://github.com/qhwdw) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://fedoramagazine.org/author/glb/ [b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/how-to-build-a-netboot-server-part-1/ +[1]: https://linux.cn/article-10379-1.html [2]: https://en.wikipedia.org/wiki/Active_Directory [3]: https://fedoramagazine.org/secure-nfs-home-directories-kerberos [4]: https://en.wikipedia.org/wiki/Sparse_file From 3bfca1be933cb7c42d2759ef5fbc234b9c00eed7 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 29 Dec 2018 22:48:06 +0800 Subject: [PATCH 119/322] PUB:20181212 How to Build a Netboot Server, Part 2.md @qhwdw https://linux.cn/article-10396-1.html --- .../20181212 How to Build a Netboot Server, Part 2.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181212 How to Build a Netboot Server, Part 2.md (99%) diff --git a/translated/tech/20181212 How to Build a Netboot Server, Part 2.md b/published/20181212 How to Build a Netboot Server, Part 2.md similarity index 99% rename from translated/tech/20181212 How to Build a Netboot Server, Part 2.md rename to published/20181212 How to Build a Netboot Server, Part 2.md index af3487c169..ea136a4317 100644 --- a/translated/tech/20181212 How to Build a Netboot Server, Part 2.md +++ b/published/20181212 How to Build a Netboot Server, Part 2.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10396-1.html) [#]: subject: (How to Build a Netboot Server, Part 2) [#]: via: (https://fedoramagazine.org/how-to-build-a-netboot-server-part-2/) [#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/) From c9dfca3c759dd96b0941943dac7e9f65ac366a72 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 30 Dec 2018 10:39:19 +0800 Subject: [PATCH 120/322] PRF:20180128 Getting Linux Jobs.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @Ryze-Borgia 翻译的不错,不过有些细节可以再认真些。 --- .../talk/20180128 Getting Linux Jobs.md | 69 ++++++++++--------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/translated/talk/20180128 Getting Linux Jobs.md b/translated/talk/20180128 Getting Linux Jobs.md index 1f7b5791af..9bfaf0e1e5 100644 --- a/translated/talk/20180128 Getting Linux Jobs.md +++ b/translated/talk/20180128 Getting Linux Jobs.md @@ -1,80 +1,81 @@ Linux 求职建议 ====== -通过对招聘网站数据的仔细研究,我们发现,即使是非常有经验的 Linux 程序员,也很难在面试中表现的很出色。 +通过对招聘网站数据的仔细研究,我们发现,即使是非常有经验的 Linux 程序员,也会在面试中陷入困境。 -这就导致了很多优秀并且有经验的人找不到合适的工作,所以我们可能需要一些手段来提高自己的竞争力。 +这就导致了很多优秀并且有经验的人无缘无故地找不到合适的工作,因为如今的就业市场需要我们有一些手段来提高自己的竞争力。 -我有两个同事和一个表哥,他们都有 RedHat 认证,管理过比较大的服务器机房,也都收到过老员工的推荐。 +我有两个同事和一个表哥,他们都有 RedHat 认证,管理过比较大的服务器机房,也都收到过前雇主的认真推荐。 -可是,在他们应聘的时候,所有的这些证书、本身的能力、工作经验好像都没有起到任何作用,他们面对的是一些 -从术语列表中临时挑选的一些技术词汇片段所组成的问题。 +可是,在他们应聘的时候,所有的这些证书、本身的能力、工作经验好像都没有起到任何作用,他们所面对的招聘广告是某人从技术词汇中临时挑选的一些“技能片段”所组成的。 -现如今,礼貌变得过时了,**不回应**变成了公司招人时最好的沟通方式。 +现如今,礼貌变得过时了,**不回应**变成了发布招聘广告的公司的新沟通方式。 这同样也意味着大多公司的招聘或者人事可能会**错过**非常优秀的应聘者。 我之所以敢说的如此肯定,是因为现在招聘广告大多数看上去都非常的滑稽。 -Walter ,[Reallylinux.com][3] 另一位特约撰稿人,发表过一篇关于 [招聘广告疯掉了][4] 的文章。 +[Reallylinux.com][3] 另一位特约撰稿人 Walter ,发表过一篇关于 [招聘广告疯掉了][4] 的文章。 -他说的没错,可是我认为 Linux 工作应聘者可以通过注意招聘广告的**三个关键词**避免落入陷阱。 +他说的也许是对的,可是我认为 Linux 工作应聘者可以通过注意招聘广告的**三个关键点**避免落入陷阱。 -首先,很少会有 Linux 领域的招聘广告只对 Linux 有要求 。 +**首先**,很少会有 Linux 系统管理员的招聘广告只针对 Linux 有要求。 -一定要注意 Linux 相关工作的工作场合,公司很有可能会要求你在服务器上跑 Linux ,另外,通过 “Linux” 搜索得到的结果有很多实际上是会涉及到 NX (数字化产品开发系统)的。 +一定要注意很少有 Linux 系统管理员的职位是实际在服务器上跑 Linux的,反而,很多在搜索 “Linux 管理员” 得到的职位实际上是指大量的 *NX 操作系统的。 -举个例子,现在有一则关于 **Linux 管理员招聘** 的招聘广告: -参与建立系统集成,尤其是 BSD 应用的系统安装... +举个例子,有一则关于 **Linux 管理员** 的招聘广告: + +> 该职位需要为建立系统集成提供支持,尤其是 BSD 应用的系统安装... 或者有一些其他的要求: -有 Windows 系统管理经验的 -最为讽刺的是,如果你在应聘面试的时候表现出精通 Linux 的话,你可能不会被聘用。 +> 有 Windows 系统管理经验的。 -另外,如果你直接把 Linux 写在你的特长或者专业上,他们可能都不会仔细看你的简历,因为他们根本区分不了 UNIX, BSD, Linux。 +最为讽刺的是,如果你在应聘面试的时候表现出专注于 Linux 的话,你可能不会被聘用。 -最终的结果就是,如果你只在简历上写了 Linux ,你可能会被直接掉,但是如果你改成 UNIX/Linux 的话,可能会走得更远。 +另外,如果你直接把 Linux 写在你的特长或者专业上,他们可能都不会仔细看你的简历,因为他们根本区分不了 UNIX、BSD、Linux。 -我有两个同事最后修改了他们的简历,然后获得了更好的面试机会,但是依旧没有被聘用,因为大多数招聘广告其实已经内定人员了,这些招聘信息被放出来仅仅是为了表现出他们有招聘的想法。 +最终的结果就是,如果你太老实,只在简历上写了 Linux,你可能会被直接过掉,但是如果你把 Linux 改成 UNIX/Linux 的话,可能会走得更远。 -第二点,公司里真正需要了解系统管理的只有特聘的科技主管,其他人包括人事或管理层根本不关心这个。 +我有两个同事最后修改了他们的简历,然后获得了更好的面试机会,虽然依旧没有被聘用,因为大多数招聘广告其实已经内定人员了,这些招聘信息被放出来仅仅是为了表现出他们有招聘的想法。 -我记得有一次开会的时候,听见一个执行副总裁把服务器管理人员说成“一毛钱一打的人”,这种想法是多么的奇怪啊。 +**第二点**,公司里唯一在乎系统管理员职位的只有技术主管,其他人包括人事或管理层根本不关心这个。 -讽刺的是,等到邮件系统出故障,交换机连接时不时会断开,或者核心商业文件从企业内网中消失的时候,这些总裁又是最先打电话给系统管理员的。 +我记得有一次开会旁听的时候,听见一个执行副总裁把服务器管理人员说成“一毛钱一打的人”,这种想法是多么的奇怪啊。 -或许如果他们不整天说些空话,或者不往邮件里塞满妻子的照片和旅行途中的照片的话,服务器可能就不会崩溃。 +讽刺的是,等到邮件系统出故障,电话交换机连接时不时会断开,或者核心商业文件从企业内网中消失的时候,这些总裁又是最先打电话给系统管理员的。 -在找工作的时候一定要关注招聘 Linux 运维或者服务器管理人员的广告,因为这种一般都是在公司技术层有迫切的需求的时候才会有的。你也不需要和人事或者公司高层聊什么,搞清楚谁要招聘然后打电话给他们。 +或许如果他们不整天在电话留言中说那么多空话,或者不往邮件里塞满妻子的照片和旅行途中的照片的话,服务器可能就不会崩溃。 -你需要直接联系他们因为有些技术问题人事是解决不了的,即使你只有 60 秒的时间可以和他们交流,你也必须抓住这个机会和真正有需求并且懂技术的人沟通。 +请注意,招聘 Linux 运维或者服务器管理员的广告被放出来是因为公司**技术层**认为有迫切的需求。你也不需要和人事或者公司高层聊什么,搞清楚谁是招聘的技术经理然后打电话给他们。 -那如果人事不让你进怎么办呢? +你需要直接联系他们因为“有些技术问题”是人事回答不了的,即使你只有 60 秒的时间可以和他们交流,你也必须抓住这个机会和真正有需求并且懂技术的人沟通。 -记得问人事一些技术性问题,比如说他们的 Linux 群组是如何建立的,能不能独立运行虚拟机。这些技术性的问题会让人事变得不耐烦,最后让你有机会问出“我能不能直接联系你们团队的技术人员”。 +那如果人事的漂亮 MM 不让你直接联系技术怎么办呢? -如果对方的回答是“应该可以”或者“稍后回复你”,那么他们可能已经在两周前就已经计划好了找一个人来填补这个空缺,比如说人事部员工的未婚夫。他们只是不希望看起来太像裙带主义,而是带有一点利己主义的不确定主义。 +开始记得问人事一些技术性问题,比如说他们的 Linux 集群是如何建立的,它们运行在独立的虚拟机上吗?这些技术性的问题会让人事变得不耐烦,最后让你有机会问出“我能不能直接联系你们团队的技术人员”。 -所以一定要记得花点时间弄清楚到底谁是发布招聘广告的直接技术负责人然后和他们聊一聊,这可能会让你少一番胡扯并且让你更有可能应聘成功。 +如果对方的回答是“应该可以”或者“稍后回复你”,那么他们可能已经在两周前就已经计划好了找一个人来填补这个空缺,比如说人事部员工的未婚夫。**他们只是不希望看起来太像裙带主义,而是带有一点利己主义的不确定主义。** -第三点,现在的广告很少有完全真实的内容了。 +所以一定要记得花点时间弄清楚到底谁是发布招聘广告的直接**技术**负责人,然后和他们聊一聊,这可能会让你少一番胡扯并且让你更有可能应聘成功。 -我以前见过一个招聘具有高级专家所不具备的专门知识的初级系统管理员的广告,计划是列出公司的发展计划蓝图,然后找到应聘者。 +**第三点**,现在的招聘广告很少有完全真实的内容了。 + +我以前见过一个招聘具有高级别专家也不会有的专门知识的初级系统管理员的广告,他们的计划是列出公司的发展计划蓝图,然后找到应聘者。 在这种情况下,你应聘 Linux 管理员职位应该提供几个关键性信息,例如工作经验和相关证书。 -诀窍在于,在你的简历中给出与他们的招聘信息相匹配的关键词,这样他们就基本找不到你存在的问题。 +诀窍在于,用这些关键词尽量装点你的简历,以匹配他们的招聘信息,这样他们几乎不可能发现你缺失了哪个关键词。 这并不一定会让你成功找到一份工作,但它可以让你获得一次面试机会,这也算是一个巨大的进步。 -通过理解和应用以上三点,或许可以让那些寻求 Linux 管理员工作的人能够比那些在地狱中只有一线希望的人有一个好的开始。 +通过理解和应用以上三点,或许可以让那些寻求 Linux 管理员工作的人能够比那些只有一线地狱机会的人领先一步。 即使这些建议不能让你马上得到面试机会,你也可以利用这些经验和意识去参加贸易展或公司主办的技术会议等活动。 -我强烈建议你们也经常参加这种活动,尤其是当它们时间比较接近的时候,可以给你一个扩展人脉的机会。 +我强烈建议你们也经常参加这种活动,尤其是当它们比较近的话,可以给你一个扩展人脉的机会。 -请记住,如今的“求职网日”已经失去了原来的意义了,现在只是可以用来获取“哪些公司实际上在招聘、哪些公司只是为了给股东带来增长的表象而在工作方面撒谎”的小道消息。 +请记住,如今的职业人脉已经失去了原来的意义了,现在只是可以用来获取“哪些公司实际上在招聘、哪些公司只是为了给股东带来增长的表象而在职位方面撒谎”的小道消息。 -------------------------------------------------------------------------------- @@ -83,7 +84,7 @@ via: http://reallylinux.com/docs/gettinglinuxjobs.shtml 作者:[Andrea W.Codingly][a] 译者:[Ryze-Borgia](https://github.com/Ryze-Borgia) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 3a7cb9df70db0aff71d014f9101c05593116e309 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 30 Dec 2018 10:39:44 +0800 Subject: [PATCH 121/322] PUB:20180128 Getting Linux Jobs.md @Ryze-Borgia https://linux.cn/article-10397-1.html --- {translated/talk => published}/20180128 Getting Linux Jobs.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/20180128 Getting Linux Jobs.md (100%) diff --git a/translated/talk/20180128 Getting Linux Jobs.md b/published/20180128 Getting Linux Jobs.md similarity index 100% rename from translated/talk/20180128 Getting Linux Jobs.md rename to published/20180128 Getting Linux Jobs.md From a56d94e73f20c3181657965046c8523dcc061f99 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 30 Dec 2018 11:15:04 +0800 Subject: [PATCH 122/322] PRF:20181206 Take a break at the Linux command line with Nyan Cat.md @zhs852 --- ...at the Linux command line with Nyan Cat.md | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/translated/tech/20181206 Take a break at the Linux command line with Nyan Cat.md b/translated/tech/20181206 Take a break at the Linux command line with Nyan Cat.md index 81e74a8a13..abb0559790 100644 --- a/translated/tech/20181206 Take a break at the Linux command line with Nyan Cat.md +++ b/translated/tech/20181206 Take a break at the Linux command line with Nyan Cat.md @@ -1,41 +1,48 @@ [#]: collector: (lujun9972) [#]: translator: (zhs852) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: subject: (Take a break at the Linux command line with Nyan Cat) [#]: via: (https://opensource.com/article/18/12/linux-toy-nyancat) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) [#]: url: ( ) -在 Linux 命令行中观看 Nyan Cat 来稍适休息 +在 Linux 命令行中观看彩虹猫来稍事休息 ====== + > 你甚至可以在终端里欣赏彩虹猫。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-nyancat.png?itok=eg1aEmBw) 今天是《Linux 命令行小玩具介绍》的第六天。在本系列文章中,我们将会探索一些娱乐用途(甚至有时完全没用)的 Linux 命令行小玩具。所有我们介绍的小玩具都是开源的。 -也许你会问,他们都很独特吗?是的。不过,他们对你是否独特,我就不知道了。但是,我们相信你应该能在这系列文章结束之前找到至少一个好玩的玩具。 +也许你会问,它们都很独特吗?是的。不过,它们对你是否独特,我就不知道了。但是,我们相信你应该能在这系列文章结束之前找到至少一个好玩的玩具。 从[昨天的选题][1]继续:我们谈到了猫和彩虹。不过,在 Linux 命令行下有更有趣的彩虹和猫结合的程序吗?答案是肯定的。 -我们不妨看看之前可以在命令行中使用 Nyan Cat 的方式吧。意料之中,2011 年发布的 [Nyan Cat][2] 可以用 **nyancat** 呈现在终端中。你想念这只曾火遍网络的 Nyan Cat 吗?看看下面这个视频记录吧,我会等你看完的。 +我们不妨看看之前可以在命令行中使用彩虹猫的方式吧。意料之中,2011 年发布的 [彩虹猫][2] 可以用 `nyancat` 呈现在终端中。你想念这只曾火遍网络的彩虹猫吗?看看下面这个视频记录吧,我会等你看完的。 - +- -现在,让我们在终端中重新感受这个令人惊奇的体验吧。**Nyancat** 包正在很多地方被分发(比如 Arch、Debian、Gentoo、Ubuntu 等等…),不过我的系统(Fedora)没有,但是我们仍然可以很轻松地从源码编译它。事实上,我们只需要一行命令就能做完所有工作: +现在,让我们在终端中重新感受这个令人惊奇的体验吧。`nyancat` 包正在很多发行版上(比如 Arch、Debian、Gentoo、Ubuntu 等等……)都有,不过我的系统(Fedora)没有,但是我们仍然可以很轻松地从源码编译它。 + +根据读者的一个很好的提醒,对于我来说,这应该在该系列中提及:要警惕从不受信任的来源安装应用程序,或者编译和运行你在网上找到的任何代码,就像你在这样的文章中找到这个一样。如果您不确定,请采取适当的预防措施,特别是如果您在生产机器上。 + +从这里克隆源代码: ``` -git clone https://github.com/klange/nyancat.git && cd nyancat && make && cd src && ./nyancat +git clone https://github.com/klange/nyancat.git ``` -这直接为我带来了一个 Nyan Cat 体验,甚至还有个计时器来显示我享受 “Nyan Cat 魔法”的时间。 +然后使用 `make` 编译,并用 `./nyancat` 来运行。 + +这直接为我带来了彩虹猫体验,甚至还有个计时器来显示我享受 “彩虹猫魔法”的时间。 ![](https://opensource.com/sites/default/files/uploads/linux-toy-nyancat-animated.gif) -你可以在 [GitHub][3] 上找到 **nyancat** 的源码,它正以 [NCSA 许可证][4] 开源。 +你可以在 [GitHub][3] 上找到 `nyancat` 的源码,它正以 [NCSA 许可证][4] 开源。 -命令行版本的 Nyan Cat 可在[这个公共 Telnet 服务器上访问][5](或者 [netcat][6] 也行),所以理论上来说你不必安装它。不过不幸的是,由于带宽限制,该服务器目前已经被关闭了。尽管如此,在各种老设备上连接老 Telnet 服务器上运行 Nyan Cat 的[照片][5]还是值得一看的,说不准你还会萌生搭建一个能让大家连接的公共服务器的想法呢(如果你真的搭建了,请务必告知作者,万一他们可能会向公众分享呢?)。 +命令行版本的彩虹猫可在[这个公共 Telnet 服务器上访问][5](或者用另外一个猫 [netcat][6] 也行),所以理论上来说你不必安装它。不过不幸的是,由于带宽限制,该服务器目前已经被关闭了。尽管如此,在各种老设备上连接老 Telnet 服务器上运行彩虹猫的[照片][5]还是值得一看的,说不准你还会萌生搭建一个能让大家连接的公共服务器的想法呢(如果你真的搭建了,请务必告知作者,万一他们可能会向公众分享呢?)。 你想让我介绍一下你最喜爱的命令行玩具吗?请在原文下留言,作者会考虑介绍的。 @@ -48,7 +55,7 @@ via: https://opensource.com/article/18/12/linux-toy-nyancat 作者:[Jason Baker][a] 选题:[lujun9972][b] 译者:[zhs852](https://github.com/zhs852) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From c03a6f617a341f1f20caac85e1b7dd18aa7c410d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 30 Dec 2018 11:15:55 +0800 Subject: [PATCH 123/322] PUB:20181206 Take a break at the Linux command line with Nyan Cat.md @zhs852 https://linux.cn/article-10398-1.html --- ...06 Take a break at the Linux command line with Nyan Cat.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181206 Take a break at the Linux command line with Nyan Cat.md (98%) diff --git a/translated/tech/20181206 Take a break at the Linux command line with Nyan Cat.md b/published/20181206 Take a break at the Linux command line with Nyan Cat.md similarity index 98% rename from translated/tech/20181206 Take a break at the Linux command line with Nyan Cat.md rename to published/20181206 Take a break at the Linux command line with Nyan Cat.md index abb0559790..78674925a6 100644 --- a/translated/tech/20181206 Take a break at the Linux command line with Nyan Cat.md +++ b/published/20181206 Take a break at the Linux command line with Nyan Cat.md @@ -1,11 +1,11 @@ [#]: collector: (lujun9972) [#]: translator: (zhs852) [#]: reviewer: (wxy) -[#]: publisher: ( ) +[#]: publisher: (wxy) [#]: subject: (Take a break at the Linux command line with Nyan Cat) [#]: via: (https://opensource.com/article/18/12/linux-toy-nyancat) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) -[#]: url: ( ) +[#]: url: (https://linux.cn/article-10398-1.html) 在 Linux 命令行中观看彩虹猫来稍事休息 ====== From fffdab2919ac6a970220af95710d80a61021c465 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 30 Dec 2018 19:33:54 +0800 Subject: [PATCH 124/322] PRF:20180716 Users, Groups and Other Linux Beasts- Part 2.md @MjSeven --- ..., Groups and Other Linux Beasts- Part 2.md | 51 +++++++++++-------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/translated/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md b/translated/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md index c4f20dbf77..b71802c145 100644 --- a/translated/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md +++ b/translated/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md @@ -1,30 +1,35 @@ -用户、组及其他 Linux 特性:第二部分 +用户、组及其它 Linux 特性(二) ====== +> 我们继续创建和管理用户和组的 Linux 教程之旅。 -![](https://www.linux.com/blog/learn/intro-to-linux/2018/7/users-groups-and-other-linux-beasts-part-2) +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ducks-94911_1920.jpg?itok=7_ZPiph7) -在正在进行的 Linux 之旅中,我们了解了[如何操作文件夹或目录][1],现在我们继续讨论 _权限_,_用户_ 和 _组_,这对于确定谁可以操作哪些文件和目录是必要的。[上次][2],我们展示了如何创建新用户,现在我们将重新来一遍: +在正在进行的 Linux 之旅中,我们了解了[如何操作文件夹或目录][1],现在我们继续讨论 _权限_、_用户_ 和 _组_,这对于确定谁可以操作哪些文件和目录是必要的。[上次][2],我们展示了如何创建新用户,现在我们将重新起航: 你可以使用 `groupadd` 命令创建新组,然后随意添加用户。例如,使用: + ``` sudo groupadd photos ``` -这将会创建 _photos_ 组。 +这将会创建 `photos` 组。 你需要在根目录下[创建一个目录][1]: + ``` sudo mkdir /photos ``` 如果你运行 `ls -l /`,结果中会有如下这一行: + ``` drwxr-xr-x 1 root root 0 jun 26 21:14 photos ``` -输出中的第一个 _root_ 是所属的用户,第二个 _root_ 是所属的组。 +输出中的第一个 `root` 是所属的用户,第二个 `root` 是所属的组。 + +要将 `/photos` 目录的所有权转移到 `photos` 组,使用: -要将 _/photos_ 目录的所有权转移到 _photos_ 组,使用: ``` chgrp photos /photos ``` @@ -32,49 +37,53 @@ chgrp photos /photos `chgrp` 命令通常采用两个参数,第一个参数是将要获得文件或目录所有权的组,第二个参数是希望交给组的文件或目录。 接着,运行 `ls -l /`,你会发现刚才那一行变了: + ``` drwxr-xr-x 1 root photos 0 jun 26 21:14 photos ``` -你已成功将新目录的所有权转移到了 _photos_ 组。 +你已成功将新目录的所有权转移到了 `photos` 组。 + +然后,将你自己的用户和 `guest` 用户添加到 `photos` 组: -然后,将你自己的用户和 _guest_ 用户添加到 _photos_ 组: ``` sudo usermod <你的用户名> -a -G photos sudo usermod guest -a -G photos ``` -你可能必须注销并重新登录才能看到更改,但是当你这样做时,运行 `groups` 会将 _photos_ 显示为你所属的组之一。 +你可能必须注销并重新登录才能看到更改,但是当你这样做时,运行 `groups` 会将 `photos` 显示为你所属的组之一。 + +关于上面提到的 `usermod` 命令,需要指明几点。第一:注意要使用 `-G` 选项而不是 `-g` 选项。`-g` 选项更改你的主要组,如果你意外地使用它,它可能会锁定你的一些东西。另一方面,`-G` 将你添加到列出的组中,并没有干扰主要组。如果要将用户添加到多个组中,在 `-G` 之后逐个列出它们,用逗号分隔,不要有空格: -(to 校正:这里的 primary group 翻译成什么更好点呢) -关于上面提到的 `usermod` 命令,需要指明几点。第一:注意要使用 `-G` 选项而不是 `-g` 选项。`-g` 选项更改你的主要组,如果你意外地使用它,它可能会锁定你的一些东西。另一方面,`-G` 将你 _添加(add)_ 到列出的组中,并没有干扰主要组。如果要将用户添加到多个组中,在 `-G` 之后逐个列出他们,用逗号分隔,不要有空格: ``` sudo usermod -a -G photos,pizza,spaceforce ``` -第二点:小心点不要忘记 `-a` 参数。`-a` 参数代表 _追加(append)_,将你传递给 `-G` 的组列表附加到你已经属于的组。这意味着,如果你不包含 `-a`,那么你之前所属的组列表将被覆盖,再次将你从你需要的东西中锁定。(to 校正:最后这句话什么意思呢) +第二点:小心点不要忘记 `-a` 参数。`-a` 参数代表追加,将你传递给 `-G` 的组列表附加到你已经属于的组。这意味着,如果你不包含 `-a`,那么你之前所属的组列表将被覆盖,再次将你拒之门外。 -这些都不是灾难性问题,但这意味着你必须手动将用户添加回你所属的所有组,这可能是个麻烦,特别是如果你失去了对 _sudo_ 和 _wheel_ 组的访问权限。 +这些都不是灾难性问题,但这意味着你必须手动将用户添加回你所属的所有组,这可能是个麻烦,特别是如果你失去了对 `sudo` 和 `wheel` 组的访问权限。 ### 权限 -在将图像复制到 _/photos_ 目录之前,还要做一件事情。注意,当你执行上面的 `ls -l /` 时,该文件夹的权限将以 _drwxr-xr-x_ 形式返回。 +在将图像复制到 `/photos` 目录之前,还要做一件事情。注意,当你执行上面的 `ls -l /` 时,该文件夹的权限将以 `drwxr-xr-x` 形式返回。 -如果你阅读[我在本文开头推荐的文章][3],你将知道第一个 _d_ 表示文件系统中的条目是一个目录,接着你有三组三个字符 (_rwx_, _r-x_, _r-x_),它们表示目录的所属用户 (_rwx_) 的权限,然后是所属组 (_r-x_)的权限,最后是其他用户 (_r-x_) 的权限。这意味着到目前为止唯一具有写权限的人,即能够在 _/photos_ 目录中复制或创建文件的唯一人员是 _root_ 用户。 +如果你阅读[我在本文开头推荐的文章][3],你将知道第一个 `d` 表示文件系统中的条目是一个目录,接着你有三组三个字符(`rwx`、`r-x`、`r-x`),它们表示目录的所属用户(`rwx`)的权限,然后是所属组(`r-x`)的权限,最后是其他用户(`r-x`)的权限。这意味着到目前为止唯一具有写权限的人,即能够在 `/photos` 目录中复制或创建文件的唯一人员是 `root` 用户。 但是[我提到的那篇文章也告诉你如何更改目录或文件的权限][3]: + ``` sudo chmod g+w /photos ``` -运行 `ls -l /`,你会看到 _/photos_ 权限变为了 _drwxrwxr-x_。这就是你希望的:组成员现在可以对目录进行写操作了。 +运行 `ls -l /`,你会看到 `/photos` 权限变为了 `drwxrwxr-x`。这就是你希望的:组成员现在可以对目录进行写操作了。 现在你可以尝试将图像或任何其他文件复制到目录中,它应该没有问题: + ``` cp image.jpg /photos ``` -_guest_ 用户也可以从目录中读取和写入。他们也可以读取和写入,甚至移动或删除共享目录中其他用户创建的文件。(to 校正:这里 guest 可以从目录中读取和写入吗?guest 不应该是 r-x 权限吗?) +`guest` 用户也可以从目录中读取和写入。他们也可以读取和写入,甚至移动或删除共享目录中其他用户创建的文件。 ### 总结 @@ -84,7 +93,7 @@ Linux 中的权限和特权系统已经磨练了几十年,它继承自昔日 回头见! -通过 Linux 基金会和 edX 的免费[" Linux 简介"][4]课程了解有关 Linux 的更多信息。 +通过 Linux 基金会和 edX 的免费[“Linux 简介”][4]课程了解有关 Linux 的更多信息。 -------------------------------------------------------------------------------- @@ -94,12 +103,12 @@ via: https://www.linux.com/blog/learn/intro-to-linux/2018/7/users-groups-and-oth 作者:[Paul Brown][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[MjSeven](https://github.com/MjSeven) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]:https://www.linux.com/users/bro66 -[1]:https://www.linux.com/blog/learn/2018/5/manipulating-directories-linux -[2]:https://www.linux.com/learn/intro-to-linux/2018/7/users-groups-and-other-linux-beasts +[1]:https://linux.cn/article-10066-1.html +[2]:https://linux.cn/article-10370-1.html [3]:https://www.linux.com/learn/understanding-linux-file-permissions [4]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux From 682e52dc1fc4cdec5629af8790af60e8104ce8fa Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 30 Dec 2018 19:34:14 +0800 Subject: [PATCH 125/322] PUB:20180716 Users, Groups and Other Linux Beasts- Part 2.md @MjSeven https://linux.cn/article-10399-1.html --- .../20180716 Users, Groups and Other Linux Beasts- Part 2.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180716 Users, Groups and Other Linux Beasts- Part 2.md (100%) diff --git a/translated/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md b/published/20180716 Users, Groups and Other Linux Beasts- Part 2.md similarity index 100% rename from translated/tech/20180716 Users, Groups and Other Linux Beasts- Part 2.md rename to published/20180716 Users, Groups and Other Linux Beasts- Part 2.md From 7d70f5891f949b2c76a4f4841fac43c6a66d46f4 Mon Sep 17 00:00:00 2001 From: WangYue <815420852@qq.com> Date: Sun, 30 Dec 2018 20:27:38 +0800 Subject: [PATCH 126/322] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E7=BF=BB=E8=AF=91=20?= =?UTF-8?q?20180625=208=20reasons=20to=20use=20the=20Xfce=20Linux=20deskto?= =?UTF-8?q?p=20environment.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 申请翻译 20180625 8 reasons to use the Xfce Linux desktop environment.md --- ...80625 8 reasons to use the Xfce Linux desktop environment.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md b/sources/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md index 254f725a36..974faa1f75 100644 --- a/sources/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md +++ b/sources/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md @@ -1,3 +1,5 @@ +translating by WangYueScream +=========================== 8 reasons to use the Xfce Linux desktop environment ====== From 6cd035ec1a0028c16ffd633ac0ccae06438f8b6b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 31 Dec 2018 00:17:33 +0800 Subject: [PATCH 127/322] PRF:20180130 Graphics and music tools for game development.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @robsean 翻译的不够认真,希望下回再接再厉。 --- ...cs and music tools for game development.md | 98 ++++++++++--------- 1 file changed, 50 insertions(+), 48 deletions(-) diff --git a/translated/tech/20180130 Graphics and music tools for game development.md b/translated/tech/20180130 Graphics and music tools for game development.md index 1cdb157bc4..7e77e30d67 100644 --- a/translated/tech/20180130 Graphics and music tools for game development.md +++ b/translated/tech/20180130 Graphics and music tools for game development.md @@ -1,133 +1,135 @@ 用于游戏开发的图形和音乐工具 ====== +> 要在三天内打造一个可玩的游戏,你需要一些快速而稳定的好工具。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_Life_opengame.png?itok=JPxruL3k) -在十月初,我们的俱乐部,来自马歇尔大学的 [Geeks and Gadgets][1] , 参加就职 [Open Jam][2], 一个游戏 jam ,庆祝最好的开源工具。游戏 jams 是参与者为娱乐像团队协作的来开发计算机游戏的事件。Jams 倾向于非常简短--仅三天时间长--并非常让人精疲力尽。Opensource.com 在八月下旬 [宣布][3] Open Jam ,更多 [three dozen games][4] 进入到竞赛中。 +在十月初,我们的俱乐部马歇尔大学的 [Geeks and Gadgets][1] 参加了首次 [Open Jam][2],这是一个庆祝最佳开源工具的游戏 Jam。游戏 Jam 是一种活动,参与者以团队协作的方式来开发有趣的计算机游戏。Jam 一般都很短,仅有三天,并且非常累。Opensource.com 在八月下旬[发布了][3] Open Jam 活动,足有 [45 支游戏][4] 进入到了竞赛中。 -我们的俱乐部希望在我们的工程中创建和使用开放源码软件,所以 Open Jam 自然是我们想要参与的 jam 。我们的提交的文件是一个实验性的名称为 [Mark My Words][5] 的游戏。我们使用多种自由和开放源码 (FOSS) 工具来开发它;在这篇文章中,我们将讨论一些我们使用和意识到有潜在的障碍物的工具。 +我们的俱乐部希望在我们的项目中创建和使用开放源码软件,所以 Open Jam 自然是我们想要参与的 Jam 了。我们提交的游戏是一个实验性的游戏,名为 [Mark My Words][5]。我们使用了多种自由和开放源码 (FOSS) 工具来开发它;在这篇文章中,我们将讨论一些我们使用的工具和我们注意到可能有潜在阻碍的地方。 ### 音频工具 #### MilkyTracker -[MilkyTracker][6] 是最好的可用于构成旧样式电子游戏音乐的软件包中的一个。它是一个 [music tracker][7] 的一个示例,一个强大的带有特殊的基于网格的图形编辑器的 MOD 和 XM 文件创建器。在我们的游戏中,我们使用它来构成大多数的音乐片段。这个程序最好的特点是,它比我们其它的大多数工具消耗更少的硬盘空间和 RAM 。虽然如此,MilkyTracker 仍然非常强大。 +[MilkyTracker][6] 是一个可用于编曲老式视频游戏中的音乐的软件包。它是一种[音乐声道器][7]music tracker,是一个强大的 MOD 和 XM 文件创建器,带有基于特征网格的模式编辑器。在我们的游戏中,我们使用它来编曲大多数的音乐片段。这个程序最好的地方是,它比我们其它的大多数工具消耗更少的硬盘空间和内存。虽然如此,MilkyTracker 仍然非常强大。 ![](https://opensource.com/sites/default/files/u128651/mtracker.png) -用户界面需要一会来习惯,这里有对一些想试用MilkyTracker的音乐家的一些提示: +其用户界面需要一会来习惯,这里有对一些想试用 MilkyTracker 的音乐家的一些提示: - * 转到 Config > Misc. ,设置 edit 模式控制样式为 "MilkyTracker." 这将给你几乎所有的现代键盘快捷方式 - * 撤销 Ctrl+Z - * 重做 Ctrl+Y - * 切换 pattern-edit 模式 空格键 - * 删除先前的注释 退格键 - * 插入一行 Insert键 - * 默认情况下,一个注释将持续作用,直到它在这频道上被替换。你可以明确地结束一个注释,通过使用一个反引号 (`) 键插入一个 KeyOff 注释 - * 在你开始谱写乐曲前,你将不得不创建或查找示例。我们建议在网站上查找 [Creative Commons][8] 协议的示例,例如 [Freesound][9] 或 [ccMixter][10] + * 转到 “Config > Misc.” ,设置编辑模式的控制风格为 “MilkyTracker”,这将给你提供几乎全部现代键盘快捷方式。 + * 用 `Ctrl+Z` 撤销 + * 用 `Ctrl+Y` 重做 + * 用空格键切换模式编辑方式 + * 用退格键删除先前的音符 + * 用插入键来插入一行 + * 默认情况下,一个音符将持续作用,直到它在该频道上被替换。你可以明确地结束一个音符,通过使用一个反引号(`)键来插入一个 KeyOff 音符 + * 在你开始谱写乐曲前,你需要创建或查找采样。我们建议在诸如 [Freesound][9] 或 [ccMixter][10] 这样的网站上查找采用 [Creative Commons][8] 协议的采样, - - -另外,保持 [MilkyTracker 文档页面][11] 在手边。它含有数不清的教程和手册的链接。一个好的开始点是在该项目 wiki 上的 [MilkyTracker 指南][12] 。 +另外,把 [MilkyTracker 文档页面][11] 放在手边。它含有数不清的教程和手册的链接。一个好的起点是在该项目 wiki 上的 [MilkyTracker 指南][12]。 #### LMMS -我们中的两个音乐家使用多用途和现代音乐创建工具 [LMMS][13] 。它带来一个绝妙的示例和效果库,加一个灵活的多种多样的插件来生成独特的声音。 The learning curve for LMMS 的学习曲线令人吃惊的低,在某种程度上是因为友好的节拍/低音线编辑器。 +我们的两个音乐家使用多用途的现代音乐创建工具 [LMMS][13]。它带有一个绝妙的采样和效果库,以及多种多样的灵活的插件来生成独特的声音。LMMS 的学习曲线令人吃惊的低,在某种程度上是因为其好用的节拍/低音线编辑器。 ![](https://opensource.com/sites/default/files/u128651/lmms_plugins.png) -我们对音乐家有一个建议,尝试 LMMS:使用插件。 对于 [chiptune][14]-样式音乐,我们推荐 [sfxr][15] ,[BitInvader][16] ,和 [FreeBoy][17] 。对于其它样式, [ZynAddSubFX][18] 是一个好的选择。它带来一个宽波段的可以被你任意更改的人工合成工具。 +我们对于想试试 LMMS 的音乐家有一个建议:使用插件。对于 [chiptune][14]式音乐,我们推荐 [sfxr][15]、[BitInvader][16] 和 [FreeBoy][17]。对于其它风格,[ZynAddSubFX][18] 是一个好的选择。它配备了各种合成仪器,可以根据您的需要进行更改。 ### 图形工具 #### Tiled -在开放源码游戏开发中,[Tiled][19] 是一个流行的组件地图类(tilemap)编辑器。我们使用它为来为我们在游戏场景中组合连续的,复古的背景。 +在开放源码游戏开发中,[Tiled][19] 是一个流行的贴片地图编辑器。我们使用它为来为我们在游戏场景中组合连续的、复古式的背景。 ![](https://opensource.com/sites/default/files/u128651/tiled.png) -Tiled 可以导出地图为 XM L,JSON ,或平坦的图像。它是稳定的和跨平台的。 +Tiled 可以导出地图为 XML、JSON 或普通的图片。它是稳定的、跨平台的。 -Tiled 的特征一,在 jam 期间,我们不能使用, 允许你定义和随意的放置游戏对象,例如硬币和永久能力提升道具到地图上。你需要做的全部是加载对象的图像为一个平铺显示集,然后使用插入平铺显示放置它们。 +Tiled 的功能之一允许你在地图上定义和放置随意的游戏对象,例如硬币和提升道具,但在 jam 期间我们没有使用它。你需要做的全部是以贴片集的方式加载对象的图像,然后使用“插入平铺”来放置它们。 -一般来说,对于一些需要一个地图编辑器的工程,Tiled 是我们建议软件的一个主要的部分。 +一般来说,对于需要一个地图编辑器的项目,Tiled 是我们所推荐的软件中一个不可或缺的部分。 #### Piskel -[Piskel][20] 是一个像素艺术编辑器,它的源文件代码是在 [Apache 协议, 版本 2.0][21] 协议下。在 jam 期间,我们对我们的大多数的图像资源使用 Piskel ,我们当然也将在未来的工程中使用它。 +[Piskel][20] 是一个像素艺术编辑器,它的源文件代码以 [Apache 2.0 协议][21] 发布。在这次 Jam 期间,们的大多数的图像资源都使用 Piskel 来处理,我们当然也将在未来的工程中使用它。 -Piskel 的特征二,在 jam 的 onion skin和Spritesheet导出期间极大地帮助我们。 +在这个 Jam 期间,Piskel 极大地帮助我们的两个功能是洋葱皮Onion skin精灵序列图spritesheet导出。 -##### Onion skin +##### 洋葱皮 -onion skin 特征将使 Piskel 显示你编辑的动画的前一帧和后一帧的一个幽灵似的覆盖物,像这样: +洋葱皮功能将使 Piskel 以虚影显示你编辑的动画的前一帧和后一帧的,像这样: ![](https://opensource.com/sites/default/files/u128651/onionshow.gif) -Onion skin 是便于使用的,因为它适合作为一个绘制指南和在动画进程期间帮助你维护在你的角色上连续的图形和声音。为启用它,只需要在屏幕的右上方预览窗体的下面单击 onion-shaped 图标。 +洋葱皮是很方便的,因为它适合作为一个绘制指引和帮助你在整个动画进程中保持角色的一致形状和体积。 要启用它,只需单击屏幕右上角预览窗口下方的洋葱形图标即可。 ![](https://opensource.com/sites/default/files/u128651/onionenable.png) -##### Spritesheet 导出 +##### 精灵序列图导出 -Piskel 的能力是导出动画为一个 spritesheet ,也是非常有用的。一个 spritesheet 是一个单个光栅图象,它包含一个动画的所有的帧。例如,这是一个我们从 Piskel 导出的 spritesheet : +Piskel 将动画导出为精灵序列图的能力也非常有用。精灵序列图是一个包含动画所有帧的光栅图像。例如,这是我们从 Piskel 导出的精灵序列图: ![](https://opensource.com/sites/default/files/u128651/sprite-artist.png) -spritesheet 包含两幅帧。一幅帧是图像的上半部分,另一帧是图像的下半部分。Spritesheets 通过启用一个完整的动画来从单个文件加载,大大地简化一个游戏的代码。这是上面的 spritesheet 的一个动画版本: +该精灵序列图包含两帧。一帧位于图像的上半部分,另一帧位于图像的下半部分。精灵序列图通过从单个文件加载整个动画,大大简化了游戏的代码。这是上面精灵序列图的动画版本: ![](https://opensource.com/sites/default/files/u128651/sprite-artist-anim.gif) ##### Unpiskel.py -在 jam 期间,我们很多次想批量转换 Piskel 文件到 PNG 文件。尽管 Piskel 文件格式基于 JSON ,我们写一个小的 GPLv3 协议的称为 [unpiskel.py][22] 的 Python 脚本来做转换。 +在 Jam 期间,我们很多次想批量转换 Piskel 文件到 PNG 文件。由于 Piskel 文件格式基于 JSON,我们写一个基于 GPLv3 协议的名为 [unpiskel.py][22] 的 Python 小脚本来做转换。 + +它像这样被调用的: -它像这样被引用: ``` python unpiskel.py input.piskel ``` -这个脚本将从一个 Piskel 文件(这里 `input.piskel`)中提取 PNG 数据帧和层,并存储它们在它们拥有的文件中。这些文件采用模式 `NAME_XX_YY.png` ,在这里 `NAME` 是 Piskel 文件的缩减名称,`XX` 是帧的编号,`YY` 是层的编号。 +这个脚本将从一个 Piskel 文件(这里是 `input.piskel`)中提取 PNG 数据帧和图层,并将它们各自存储。这些文件采用模式 `NAME_XX_YY.png` 命名,在这里 `NAME` 是 Piskel 文件的缩减名称,`XX` 是帧的编号,`YY` 是层的编号。 + +因为脚本可以从一个 shell 中调用,它可以用在整个文件列表中。 -因为脚本可以从一个 shell 中引用,它可以被使用在文件的整个列表中。 ``` for f in *.piskel; do python unpiskel.py "$f"; done ``` -### Python, Pygame, 和 cx_Freeze +### Python、Pygame 和 cx_Freeze #### Python 和 Pygame -我们使用 [Python][23] 语言来自制作我们的游戏。它是一个脚本语言,通常被用于文本处理和桌面应用程序开发。它也可以用于游戏开发,例如工程,像 [Angry Drunken Dwarves][24] 和 [Ren'Py][25] 已经显示。这两个工程都使用一个称为 [Pygame][26] 的 Python 库来显示图形和产生声音,所以我们也决定在 Open Jam 中使用这个库。 +我们使用 [Python][23] 语言来制作我们的游戏。它是一个脚本语言,通常被用于文本处理和桌面应用程序开发。它也可以用于游戏开发,例如像 [Angry Drunken Dwarves][24] 和 [Ren'Py][25] 这样的项目所展示的。这两个项目都使用一个称为 [Pygame][26] 的 Python 库来显示图形和产生声音,所以我们也决定在 Open Jam 中使用这个库。 -Pygame 被证明是既稳定又富有特色,并且它对我们创建的街机游戏来说是优秀的。在低分辨率时,库的速度足够快的,但是在高分辨率时,它的仅 CPU 渲染开始变慢。这是因为 Pygame 不使用硬件加速渲染。然而,开发者可以充分利用 OpenGL 基础设施。 +Pygame 被证明是既稳定又富有特色,并且它对我们创建的街机式游戏来说是很棒的。在低分辨率时,库的速度足够快的,但是在高分辨率时,它只用 CPU 的渲染开始变慢。这是因为 Pygame 不使用硬件加速渲染。然而,开发者可以充分利用 OpenGL 基础设施的优势。 -如果你正在寻找一个好的 2D 游戏编程库,Pygame 是值得密切注意的一个。它的网站有 [一个好的教程][27] 来开始。务必看看它! +如果你正在寻找一个好的 2D 游戏编程库,Pygame 是值得密切注意的一个。它的网站有 [一个好的教程][27] 可以作为起步。务必看看它! #### cx_Freeze -准备发行我们的游戏是有趣的。我们知道,Windows 用户不喜欢有一个 Python 安装,并且要求他们来安装它可能很过分。除此之外,他们也可能不得不安装 Pygame ,在 Windows 上,这不是一个简单的工作。 +准备发行我们的游戏是有趣的。我们知道,Windows 用户不喜欢装一套 Python,并且要求他们来安装它可能很过分。除此之外,他们也可能必须安装 Pygame,在 Windows 上,这不是一个简单的工作。 -有一件事很清楚:我们不得不放置我们的游戏到一个更方便的结构中。很多其他的 Open Jam 参与者使用专有的游戏引擎 Unity ,它能够使它们的游戏在网页浏览器中来玩。这使得它们非常方便地来玩。便利性是一个我们的游戏恰巧一丝的都没有的东西。但是,感谢生机勃勃的 Python 生态系统,我们有选择。在 Windows 上现有的工具帮助 Python 程序员准备发行他们的游戏。我们考虑的两个是 [cx_Freeze][28] 和 [Pygame2exe][29] (它使用 [py2exe][30])。我们下决心在 cx_Freeze 上,因为它是跨平台的。 +很显然:我们必须放置我们的游戏到一个更方便的格式中。很多其他的 Open Jam 参与者使用专有的游戏引擎 Unity,它能够使他们的游戏在网页浏览器中来玩。这使得它们非常方便地来玩。便利性是一个我们的游戏中根本不存在的东西。但是,感谢生机勃勃的 Python 生态系统,我们有选择。已有的工具可以帮助 Python 程序员将他们的游戏做成 Windows 上的发布版本。我们考虑过的两个工具是 [cx_Freeze][28] 和 [Pygame2exe][29](它使用 [py2exe][30])。我们最终决定用 cx_Freeze,因为它是跨平台的。 + +在 cx_Freeze 中,你可以把一个单脚本游戏打包成发布版本,只要在 shell 中运行一个命令,像这样: -在 cx_Freeze 中,你可以为发行版打包一个单个脚本游戏,只要在shell运行一个命令,像这样: ``` cxfreeze main.py --target-dir dist ``` -`cxfreeze` 的这个调用将拿你的脚本(这里 `main.py`) 和在你系统上的 Python 解释器,并捆绑定它们到 `dist` 目录。一旦完成它,你需要做的是手动复制你的游戏的数据文件到 `dist` 目录。你将发现,`dist` 目录包含一个可以运行来开始你的游戏的可执行文件。 +`cxfreeze` 的这个调用将把你的脚本(这里是 `main.py`)和在你系统上的 Python 解释器捆绑到到 `dist` 目录。一旦完成,你需要做的是手动复制你的游戏的数据文件到 `dist` 目录。你将看到,`dist` 目录包含一个可以运行来开始你的游戏的可执行文件。 -这里有更复杂难解的方法来使用 cx_Freeze ,允许你自动地复制数据文件,但是我们发现简单的调用 `cxfreeze` 足够我们的需要。感谢这个工具,我们使我们的游戏稍微便利的运行。 +这里有使用 cx_Freeze 的更复杂的方法,允许你自动地复制数据文件,但是我们发现简单的调用 `cxfreeze` 足够满足我们的需要。感谢这个工具,我们使我们的游戏玩起来更便利一些。 -### 庆祝开放源码 +### 庆祝开源 -Open Jam 是重要的,因为它庆祝软件开发的开放源码模式。这是来分析开放源码工具的当前状态和我们在未来工作中需求的一个机会。,对于游戏开发者来设法推动它们的工具的使用范围,学习必需提高未来游戏开发者的益处,游戏 jams 或许是最好的时间。 +Open Jam 是庆祝开源模式的软件开发的重要活动。这是一个分析开源工具的当前状态和我们在未来工作中需求的一个机会。对于游戏开发者探求其工具的使用极限,学习未来游戏开发所必须改进的地方,游戏 Jam 或许是最好的时机。 -开放源码工具使人们能够探索他们的创造性,而不妥协他们的自由和前期的投资。尽管我们可能不能成为专业的游戏开发者,我们仍然能获取它的一段小的体验,使用我们简短的,实验性的称为 [Mark My Words][5] 的游戏。它是一个语言学方面地的有特定主题的游戏,它描述一个小说写作系统在它历史期间的演化。Open Jam 有一些令人愉快的提交,并且它们是值得校核。真的, [去看看][31] ! +开源工具使人们能够在不损害自由的情况下探索自己的创造力,而无需预先投入资金。虽然我们可能不会成为专业的游戏开发者,但我们仍然能够通过我们的简短的实验性游戏 [Mark My Words][5] 获得一点点体验。它是一个以语言学为主题的游戏,描绘了虚构的书写系统在其历史中的演变。还有很多其他不错的作品提交给了 Open Jam,它们都值得一试。 真的,[去看看][31]! -在结束前,我们想要感谢所有的 [参加俱乐部的成员][32],使这次经历真正的有价值。我们也想要感谢 [Michael Clayton][33],[Jared Sprague][34] 和 [Opensource.com][35] 主办 open Jam。它是一次欢乐。 +在本文结束前,我们想要感谢所有的 [参加俱乐部的成员][32],使得这次经历真正的有价值。我们也想要感谢 [Michael Clayton][33]、[Jared Sprague][34] 和 [Opensource.com][35] 主办 Open Jam。简直酷毙了。 -现在,我们对读者有一些问题。你是一个 FOSS 游戏开发者吗?你选择的工具是什么?务必在下面留下一个评论! +现在,我们对读者提出了一些问题。你是一个 FOSS 游戏开发者吗?你选择的工具是什么?务必在下面留下一个评论! -------------------------------------------------------------------------------- @@ -135,7 +137,7 @@ via: https://opensource.com/article/18/1/graphics-music-tools-game-dev 作者:[Charlie Murphy][a] 译者:[robsean](https://github.com/robsean) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From a4675e566aaec6f516f808efe995ff489fd2d898 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 31 Dec 2018 00:18:02 +0800 Subject: [PATCH 128/322] PUB:20180130 Graphics and music tools for game development.md @robsean https://linux.cn/article-10400-1.html --- .../20180130 Graphics and music tools for game development.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180130 Graphics and music tools for game development.md (100%) diff --git a/translated/tech/20180130 Graphics and music tools for game development.md b/published/20180130 Graphics and music tools for game development.md similarity index 100% rename from translated/tech/20180130 Graphics and music tools for game development.md rename to published/20180130 Graphics and music tools for game development.md From 102c89d8621e0d376c3fb053b53f3c6d5c0f5410 Mon Sep 17 00:00:00 2001 From: Ryze-Borgia <42087725+Ryze-Borgia@users.noreply.github.com> Date: Mon, 31 Dec 2018 18:14:56 +0800 Subject: [PATCH 129/322] =?UTF-8?q?=E7=94=B3=E9=A2=86=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/tech/20180914 A day in the life of a log message.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180914 A day in the life of a log message.md b/sources/tech/20180914 A day in the life of a log message.md index 8d60ec9fe6..cc6ebd0f5b 100644 --- a/sources/tech/20180914 A day in the life of a log message.md +++ b/sources/tech/20180914 A day in the life of a log message.md @@ -1,3 +1,4 @@ +Ryze-Borgia is translating A day in the life of a log message ====== From 83acec62165c1605823c6abcc48b47e7bfddeed0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 31 Dec 2018 20:24:23 +0800 Subject: [PATCH 130/322] PRF:20171111 A CEOs Guide to Emacs.md @oneforalone --- .../tech/20171111 A CEOs Guide to Emacs.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/translated/tech/20171111 A CEOs Guide to Emacs.md b/translated/tech/20171111 A CEOs Guide to Emacs.md index 9e7f9290d4..670b8e78f9 100644 --- a/translated/tech/20171111 A CEOs Guide to Emacs.md +++ b/translated/tech/20171111 A CEOs Guide to Emacs.md @@ -1,15 +1,15 @@ -一位 CEO 的 Emacs 指南(备选:CEO 的 Emacs 秘籍) +一位 CEO 的 Emacs 秘籍 =========== 几年前,不,是几十年前,我就在用 Emacs。不论是码代码、编写文档,还是管理邮件和日程,我都用这个编辑器,或者是说操作系统,而且我还乐此不疲。许多年过去了,我也转向了其他更新、更好的工具。结果,就连最基本的文件浏览,我都已经忘了在不用鼠标的情况下该怎么操作。大约三个月前,我意识到我在应用程序和计算机之间切换上耗费了大量的时间,于是我决定再次使用 Emacs。这是个很正确的决定,原因有以下几个。其中包括用 `.emacs` 和 Dropbox 来搭建一个良好的、可移植的环境的一些技巧。 -对于那些还没用过 Emacs 的人来说,Emacs 会让你爱恨交加。它有点像一个房子大小的鲁布·戈德堡机械Rube Goldberg machine,乍一看,它具备烤面包机的所有功能。这听起来不像是一种认可,但关键词是“乍一看”。一旦你了解了 Emacs,你就会意识到它其实是一台可以当发动机用的的热核烤面包机……好吧,只是文本处理的所有事情。当考虑到你计算机的使用周期在很大程度上都是与文本有关时,这是一个相当大胆的声明。大胆,但却是真的。 +对于那些还没用过 Emacs 的人来说,Emacs 会让你爱恨交加。它有点像一个房子大小的鲁布·戈德堡机械Rube Goldberg machine,乍一看,它具备烤面包机的所有功能。这听起来不像是一种认可,但关键词是“乍一看”。一旦你了解了 Emacs,你就会意识到它其实是一台可以当发动机用的的热核烤面包机……好吧,只是指文本处理的所有事情。当考虑到你计算机的使用周期在很大程度上都是与文本有关时,这是一个相当大胆的声明。大胆,但却是真的。 也许对我来说更重要的是,Emacs 是我曾经使用过的一个应用,并让我觉得我真正的拥有它,而不是把我塑造成一个匿名的“用户”,就好像位于 [Soma][30](LCTT 译注:旧金山的一个街区)或雷蒙德(LCTT 译注:微软总部所在地)附近某个高档办公室的产品营销部门把钱作为明确的目标一样。现代生产力和创作应用程序(如 Pages 或 IDE)就像碳纤维赛车,它们装备得很好,也很齐全。而 Emacs 就像一盒经典的 [Campagnolo][31] (LCTT 译注:世界上最好的三个公路自行车套件系统品牌之一)零件和一个漂亮的自行车牵引式钢框架,但缺少曲柄臂和刹车杆,你必须在网上某个小众文化中找到它们。前者更快而且很完整,后者是无尽的快乐或烦恼的源泉,当然这取决于你自己,而且这种快乐或烦恼会伴随到你死。我就是那种在找到一堆老古董或用 `Emacs Lisp` 配置编辑器时会感到高兴的人,具体情况因人而异。 ![1933 steel bicycle](https://www.fugue.co/hubfs/Imported_Blog_Media/bicycle-1.jpg) -*一辆我还在骑的1933年产的钢制自行车。你可以看看框架管差别: [https://www.youtube.com/watch?v=khJQgRLKMU0][6]* +*一辆我还在骑的 1933 年产的钢制自行车。你可以看看框架管差别: [https://www.youtube.com/watch?v=khJQgRLKMU0][6]* 这可能给人一种 Emacs 已经过气或过时的印象。然而并不是,Emacs 是强大和永恒的,只要你耐心地去理解它的一些规则。Emacs 的规则很另类,也很奇怪,但其中的逻辑却引人注目,且魅力十足。对于我来说, Emacs 更像是未来而不是过去。就像牵引式钢框架在未来几十年里将会变得好用和舒适,而神奇的碳纤维自行车将会被扔进垃圾场,在撞击中粉碎一样,Emacs 也将会作为一种在最新的流行应用早已被遗忘的时候的好用的工具继续存在这里。 @@ -29,7 +29,7 @@ Org 模式本身就值得花时间,但如果你像我一样,你通常要处 拥有所发现的最好的文本编辑功能的最终结果是什么?有一群人在做各种各样有用的补充吗?发挥了 Lisp 键盘的全部威力了吗?我用 Emacs 来完成所有的创作性工作,音乐和图片除外。 -我办公桌上有两个显示器。其中一块竖屏是将 Emacs 全天全屏显示,另一个显示浏览器,用来搜索和阅读,我通常也会打开一个终端。我将日历、邮件等放在 OS X 的另一个桌面上,当我使用 Emacs 时,这个桌面会隐藏起来,同时我也会关掉所有通知。这样就能让我专注于我手头上在做的事了。我发现,越是先进的 UI 应用程序,消除干扰越是不可能,因为这些应用程序致力于提供帮助和易用性。我不需要经常被提醒该如何操作,我已经做了成千上万次了,我真正需要的是一张干净整洁的白纸用来思考。也许因为年龄和自己的“恶习”,我不太喜欢处在嘈杂的环境中,但我认为这值得一试。看看在你电脑环境中有一些真正的宁静是怎样的。当然,现在很多应用程序都有隐藏界面的模式,谢天谢地,苹果和微软现在都有了真正意义上的全屏模式。但是,没有并没有应用程序可以强大到足以“处理”大多数事务。除非你整天写代码,或者像出书一样,处理很长的文档,否则你仍然会面临其他应用程序的干扰。而且,大多数现代应用程序似乎同时显得自视甚高,缺乏功能和可用性[^5] 。比起 office 客户端版,我更讨厌它的在线版。 +我办公桌上有两个显示器。其中一块竖屏是将 Emacs 全天全屏显示,另一个显示浏览器,用来搜索和阅读,我通常也会打开一个终端。我将日历、邮件等放在 OS X 的另一个桌面上,当我使用 Emacs 时,这个桌面会隐藏起来,同时我也会关掉所有通知。这样就能让我专注于我手头上在做的事了。我发现,越是先进的 UI 应用程序,消除干扰越是不可能,因为这些应用程序致力于提供帮助和易用性。我不需要经常被提醒该如何操作,我已经做了成千上万次了,我真正需要的是一张干净整洁的白纸用来思考。也许因为年龄和自己的“恶习”,我不太喜欢处在嘈杂的环境中,但我认为这值得一试。看看在你电脑环境中有一些真正的宁静是怎样的。当然,现在很多应用程序都有隐藏界面的模式,谢天谢地,苹果和微软现在都有了真正意义上的全屏模式。但是,没有并没有应用程序可以强大到足以“处理”大多数事务。除非你整天写代码,或者像出书一样,处理很长的文档,否则你仍然会面临其他应用程序的干扰。而且,大多数现代应用程序似乎同时显得自视甚高,缺乏功能和可用性[^5] 。比起 office 桌面版,我更讨厌它的在线版。 ![](https://www.fugue.co/hubfs/Imported_Blog_Media/desktop-1.jpg) @@ -37,7 +37,7 @@ Org 模式本身就值得花时间,但如果你像我一样,你通常要处 但是沟通呢?创造和沟通之间的差别很大。当我将这两件事在不同时间段处理时,我的效率会更高。我们 Fugue 公司使用 Slack,痛并快乐着。我把 Slack 和我的日历、电子邮件放在一个即时通讯的桌面上,这样,当我正在做事时,我就能够忽略所有的聊天信息了。虽然只要一个 Slackstorm 或一封风投或董事会董事的电子邮件,就能让我立刻丢掉手头工作。但是,大多数事情通常可以等上一两个小时。 -#### 包罗万象,永久长青 +#### 普适恒久 第三个原因是,我发现 Emacs 比其它的环境更有优势的是,你可以很容易地用它来处理事务。我的意思是,你所需要的只是通过类似于 Dropbox 的网站同步一两个目录,而不是让大量的应用程序以它们自己的方式进行交互和同步。然后,你可以在任何你已经精心打造了适合你的目的的套件的环境中工作了。我在 OS X、Windows,或有时在 Linux 都是这样做的。它非常简单可靠。这种功能很有用,以至于我害怕处理 Pages、Google Docs、Office 或其他类型的文件和应用程序,这些文件和应用程序会迫使我回到文件系统或云中的某个地方去寻找。 @@ -196,6 +196,7 @@ Org 模式也有很多让生活愉快的小功能。例如,脚注处理非常 这个文件是一个使用该配置输出为 PDF 的实例。这就是开箱即用的 LaTeX 一样。在我看来这还不错,但是字体很平淡,而且有点奇怪。此外,如果你使用标准格式,人们会觉得他们正在阅读的东西是、或者假装是一篇学术论文。别怪我没提醒你。 #### 驾驭之 Ace Jump 模式 + 这只是一个辅助模式,而不是一个主模式,但是你也需要它。其工作原理有点像之前提到的 Jef Raskin 的 Leap 功能[^9] 。 按下 `C-c C-SPC`,然后输入要跳转到单词的第一个字母。它会高亮显示所有以该字母开头的单词,并将其替换为字母表中的字母。你只需键入所需位置的字母,光标就会跳转到该位置。我常将它作为导航键或是用来检索。将 `.el` 文件下到你的 `lisp` 目录下,并在 `.emacs` 文件添加如下代码: ``` @@ -217,17 +218,17 @@ Org 模式也有很多让生活愉快的小功能。例如,脚注处理非常 [^3]: 我主要是在写作时使用这个模式来进行一些运算。比如说,当我在给一个新雇员写一封入职信时,我想要算这封入职信中有多少个选项。由于我在我的 `.emacs` 为 outstanding-shares 定义了一个变量,所以我只要按下 `M-:` 然后输入 `(* .001 outstanding-shares)` 就能再无需打开计算器或电子表格的情况下得到精度为 0.001 的结果。我使用了 _大量_ 的变量来避免程序间切换。 -[^4]: 缺少的部分是 web。有个名为 eww 的 Emacs 网页浏览器能够让你在 Emacs 中浏览网页。我用的就是这个,因为它既能拦截广告(译者注:实质上是无法显示,/laugh),同时也在可读性方面为 web 开发者消除了大多数差劲的选项。这个其实有点类似于 Safari 的阅读模式。不幸的是,大部分网站都有很多令人讨厌的繁琐的东西以及难以转换为文本的导航, +[^4]: 缺少的部分是 web。有个名为 eww 的 Emacs 网页浏览器能够让你在 Emacs 中浏览网页。我用的就是这个,因为它既能拦截广告(LCTT 译注:实质上是无法显示,/laugh),同时也在可读性方面为 web 开发者消除了大多数差劲的选项。这个其实有点类似于 Safari 的阅读模式。不幸的是,大部分网站都有很多令人讨厌的繁琐的东西以及难以转换为文本的导航, [^5]: 易用性和易学性这两者经常容易被搞混。易学性是指学习使用工具的难易程度。而易用性是指工具高效的程度。通常来说,这是要差别的,就想鼠标和菜单栏的差别一样。菜单栏很容易学会,但是却不怎么高效,以致于早期会存在一些键盘的快捷键。除了在 GUI 方面上,Raskin 在很多方面上的观点都很正确。如今,操作系统正在将一些合适的搜索映射到键盘的快捷键上。比如说在 OS X 和 Windows 上,我默认的导航方式就是搜索。Ubuntu 的搜索做的很差劲,如同它的 GUI 一样差劲。 -[^6]: 在有网的情况下, [AWSAmazon Web Services S3][42] 是解决文件存储问题的有效方案。数万亿个对象存在 S3 中,但是从来没有遗失过。大部分提供云存储的服务都是在 S3 上或是模拟 S3 构建的。没人能够拥有 S3 一样的规模,所以我将重要的文件通过 Dropbox 存储在上面。 +[^6]: 在有网的情况下,[AWS S3][42] 是解决文件存储问题的有效方案。数万亿个对象存在 S3 中,但是从来没有遗失过。大部分提供云存储的服务都是在 S3 上或是模拟 S3 构建的。没人能够拥有 S3 一样的规模,所以我将重要的文件通过 Dropbox 存储在上面。 [^7]: 目前,你可能会想:“这个人和自行车有什么关系?”……我在各个层面上都喜欢自行车。自行车是迄今为止发明的最具机械效率的交通工具。自行车可以是真正美丽的事物。而且,只要注意点的话,自行车可以用一辈子。早在 2001 年,我曾向 Rivendell Bicycle Works 订购了一辆自行车,现在我每次看到那辆自行车依然很高兴,自行车和 Unix 是我接触过的最好的两个发明。对了,还有 Emacs。 [^8]: 这个网站有一个很棒的 Emacs 教程,但不是这个。当我浏览这个页面时,我确实得到了一些对获取高效的 Emacs 配置很重要的知识,但无论怎么说,这都不是个替代品。 -[^9]: 20世纪80年代,Jef Raskin 与 Steve Jobs 在 Macintosh 项目上闹翻后, Jef Raskin 又设计了 [Canon Cat 计算机][43]。这台 Cat 是以文档为中心的界面(所有的计算机都应如此),并以一种全新的方式使用键盘,你现在可以用 Emacs 来模仿这种键盘。如果现在有一台现代的,功能强大的 Cat 并配有一个高分辨的显示器和 Unix 系统的话,我立马会用 Mac 来换。[][27][https://youtu.be/o_TlE_U_X3c?t=19s][28] +[^9]: 20 世纪 80 年代,Jef Raskin 与 Steve Jobs 在 Macintosh 项目上闹翻后, Jef Raskin 又设计了 [Canon Cat 计算机][43]。这台 Cat 计算机是以文档为中心的界面(所有的计算机都应如此),并以一种全新的方式使用键盘,你现在可以用 Emacs 来模仿这种键盘。如果现在有一台现代的,功能强大的 Cat 计算机并配有一个高分辨的显示器和 Unix 系统的话,我立马会用 Mac 来换。[https://youtu.be/o_TlE_U_X3c?t=19s][28] -------------------------------------------------------------------------------- From 62a05a3f208ef5636666244f15a980de1f696904 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 31 Dec 2018 20:24:58 +0800 Subject: [PATCH 131/322] PUB:20171111 A CEOs Guide to Emacs.md @oneforalone https://linux.cn/article-10401-1.html --- {translated/tech => published}/20171111 A CEOs Guide to Emacs.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20171111 A CEOs Guide to Emacs.md (100%) diff --git a/translated/tech/20171111 A CEOs Guide to Emacs.md b/published/20171111 A CEOs Guide to Emacs.md similarity index 100% rename from translated/tech/20171111 A CEOs Guide to Emacs.md rename to published/20171111 A CEOs Guide to Emacs.md From 0b639c43c115981dd788d64466ed1d9ae272a6eb Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 31 Dec 2018 20:26:13 +0800 Subject: [PATCH 132/322] PRF:20171111 A CEOs Guide to Emacs.md --- published/20171111 A CEOs Guide to Emacs.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/published/20171111 A CEOs Guide to Emacs.md b/published/20171111 A CEOs Guide to Emacs.md index 670b8e78f9..4a92e5710b 100644 --- a/published/20171111 A CEOs Guide to Emacs.md +++ b/published/20171111 A CEOs Guide to Emacs.md @@ -1,9 +1,9 @@ -一位 CEO 的 Emacs 秘籍 +CEO 的 Emacs 秘籍 =========== 几年前,不,是几十年前,我就在用 Emacs。不论是码代码、编写文档,还是管理邮件和日程,我都用这个编辑器,或者是说操作系统,而且我还乐此不疲。许多年过去了,我也转向了其他更新、更好的工具。结果,就连最基本的文件浏览,我都已经忘了在不用鼠标的情况下该怎么操作。大约三个月前,我意识到我在应用程序和计算机之间切换上耗费了大量的时间,于是我决定再次使用 Emacs。这是个很正确的决定,原因有以下几个。其中包括用 `.emacs` 和 Dropbox 来搭建一个良好的、可移植的环境的一些技巧。 -对于那些还没用过 Emacs 的人来说,Emacs 会让你爱恨交加。它有点像一个房子大小的鲁布·戈德堡机械Rube Goldberg machine,乍一看,它具备烤面包机的所有功能。这听起来不像是一种认可,但关键词是“乍一看”。一旦你了解了 Emacs,你就会意识到它其实是一台可以当发动机用的的热核烤面包机……好吧,只是指文本处理的所有事情。当考虑到你计算机的使用周期在很大程度上都是与文本有关时,这是一个相当大胆的声明。大胆,但却是真的。 +对于那些还没用过 Emacs 的人来说,Emacs 会让你爱恨交加。它有点像一个房子大小的鲁布·戈德堡机械Rube Goldberg machine,乍一看,它具备烤面包机的所有功能。这听起来不像是一种认可,但关键词是“乍一看”。一旦你了解了 Emacs,你就会意识到它其实是一台可以当发动机用的热核烤面包机……好吧,只是指文本处理的所有事情。当考虑到你计算机的使用周期在很大程度上都是与文本有关时,这是一个相当大胆的声明。大胆,但却是真的。 也许对我来说更重要的是,Emacs 是我曾经使用过的一个应用,并让我觉得我真正的拥有它,而不是把我塑造成一个匿名的“用户”,就好像位于 [Soma][30](LCTT 译注:旧金山的一个街区)或雷蒙德(LCTT 译注:微软总部所在地)附近某个高档办公室的产品营销部门把钱作为明确的目标一样。现代生产力和创作应用程序(如 Pages 或 IDE)就像碳纤维赛车,它们装备得很好,也很齐全。而 Emacs 就像一盒经典的 [Campagnolo][31] (LCTT 译注:世界上最好的三个公路自行车套件系统品牌之一)零件和一个漂亮的自行车牵引式钢框架,但缺少曲柄臂和刹车杆,你必须在网上某个小众文化中找到它们。前者更快而且很完整,后者是无尽的快乐或烦恼的源泉,当然这取决于你自己,而且这种快乐或烦恼会伴随到你死。我就是那种在找到一堆老古董或用 `Emacs Lisp` 配置编辑器时会感到高兴的人,具体情况因人而异。 From 2497bfcf68cf2d4037698e73be997813876bdc9a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 31 Dec 2018 23:41:24 +0800 Subject: [PATCH 133/322] =?UTF-8?q?=E5=BD=92=E6=A1=A3=20201812?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 一年又过去了…… --- ...st Sources For Linux - -BSD - Unix Documentation On the Web.md | 0 published/{ => 201812}/20171012 7 Best eBook Readers for Linux.md | 0 .../20171108 Continuous infrastructure- The other CI.md | 0 published/{ => 201812}/20171111 A CEOs Guide to Emacs.md | 0 ...171129 TLDR pages Simplified Alternative To Linux Man Pages.md | 0 ...1223 Celebrate Christmas In Linux Way With These Wallpapers.md | 0 ...personal Email setup - Notmuch, mbsync, postfix and dovecot.md | 0 .../20180101 27 open solutions to everything in education.md | 0 ...0104 How Creative Commons benefits artists and big business.md | 0 published/{ => 201812}/20180128 Getting Linux Jobs.md | 0 .../20180130 Graphics and music tools for game development.md | 0 ...r your first HTML code lets help Batman write a love letter.md | 0 ...ring project requirements using the Open Decision Framework.md | 0 .../{ => 201812}/20180221 12 useful zypper command examples.md | 0 .../20180226 -Getting to Done- on the Linux command line.md | 0 published/{ => 201812}/20180228 Emacs -2- Introducing org-mode.md | 0 published/{ => 201812}/20180302 Emacs -3- More on org-mode.md | 0 .../20180328 What NASA Has Been Doing About Open Science.md | 0 ...Emacs -4- Automated emails to org-mode and org-mode syncing.md | 0 ...0180404 Emacs -5- Documents and Presentations with org-mode.md | 0 .../20180412 A new approach to security instrumentation.md | 0 .../20180419 Migrating to Linux- Network and System Settings.md | 0 .../20180420 How To Remove Password From A PDF File in Linux.md | 0 ...0422 Command Line Tricks For Data Scientists - kade killary.md | 0 ...04 How a university network assistant used Linux in the 90s.md | 0 ...iabetes finds open source and builds her own medical device.md | 0 published/{ => 201812}/20180518 How to Manage Fonts in Linux.md | 0 .../{ => 201812}/20180523 How to dual-boot Linux and Windows.md | 0 ...25 How to Set Different Wallpaper for Each Monitor in Linux.md | 0 published/{ => 201812}/20180623 The IBM 029 Card Punch.md | 0 .../{ => 201812}/20180707 Version Control Before Git with CVS.md | 0 .../20180709 5 Firefox extensions to protect your privacy.md | 0 .../20180710 Users, Groups, and Other Linux Beasts.md | 0 .../20180716 Users, Groups and Other Linux Beasts- Part 2.md | 0 .../20180717 11 Uses for a Raspberry Pi Around the Office.md | 0 ...0180806 GPaste Is A Great Clipboard Manager For Gnome Shell.md | 0 .../{ => 201812}/20180806 Systemd Timers- Three Use Cases.md | 0 ...180814 HTTP request routing and validation with gorilla-mux.md | 0 ...17 Mixing software development roles produces great results.md | 0 .../20180826 How to Install and Use FreeDOS on VirtualBox.md | 0 ...uction to Quantum Computing with Open Source Cirq Framework.md | 0 .../20180831 Publishing Markdown to HTML with MDwiki.md | 0 .../{ => 201812}/20180904 Why schools of the future are open.md | 0 .../20180911 Know Your Storage- Block, File - Object.md | 0 .../20180912 How to turn on an LED with Fedora IoT.md | 0 published/{ => 201812}/20181004 Archiving web sites.md | 0 published/{ => 201812}/20181004 Lab 3- User Environments.md | 0 published/{ => 201812}/20181016 Lab 4- Preemptive Multitasking.md | 0 .../{ => 201812}/20181016 Lab 5- File system, Spawn and Shell.md | 0 ...prove login security with challenge-response authentication.md | 0 .../20181025 How to write your favorite R functions in Python.md | 0 ...recting traffic- Demystifying internet-scale load balancing.md | 0 .../20181102 Create a containerized machine learning model.md | 0 .../20181105 5 Easy Tips for Linux Web Browser Security.md | 0 .../20181106 How to partition and format a drive on Linux.md | 0 .../{ => 201812}/20181107 Automate a web browser with Selenium.md | 0 .../20181107 Top 30 OpenStack Interview Questions and Answers.md | 0 ...20181112 A Free Guide for Setting Your Open Source Strategy.md | 0 ...20181112 A Free, Secure And Cross-platform Password Manager.md | 0 published/{ => 201812}/20181112 The Source History of Cat.md | 0 ...ion to Udev- The Linux subsystem for managing device events.md | 0 ... 3 best practices for continuous integration and deployment.md | 0 .../20181119 7 command-line tools for writers - Opensource.com.md | 0 .../20181119 9 obscure Python libraries for data science.md | 0 ...to give thanks to open source and free software maintainers.md | 0 .../20181121 Coupled commands with control operators in Bash.md | 0 published/{ => 201812}/20181121 DevOps is for everyone.md | 0 .../20181121 How to swap Ctrl and Caps Lock keys in Linux.md | 0 .../20181123 How to Build a Netboot Server, Part 1.md | 0 .../20181124 How To Configure IP Address In Ubuntu 18.04 LTS.md | 0 ...to use the sudo command to deploy superuser powers on Linux.md | 0 ...1128 OpenSnitch - an Application Firewall for Linux -Review.md | 0 .../20181128 Standalone web applications with GNOME Web.md | 0 published/{ => 201812}/20181129 4 open source Markdown editors.md | 0 ...1130 SMPlayer in Linux- Features, Download and Installation.md | 0 ...atives To ‘top- Command line Utility You Might Want To Know.md | 0 .../20181201 Boxing yourself in on the Linux command line.md | 0 .../20181202 Drive a locomotive through your Linux terminal.md | 0 ...Four Easy Ways to Search Or Find Files And Folders in Linux.md | 0 published/{ => 201812}/20181204 3 implications of serverless.md | 0 .../{ => 201812}/20181204 Have a cow at the Linux command line.md | 0 .../20181205 Bash Variables- Environmental and Otherwise.md | 0 ...0181205 Bring some color to your Linux terminal with lolcat.md | 0 ...ily Convert Audio File Formats with SoundConverter in Linux.md | 0 ...0181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md | 0 ...181206 Take a break at the Linux command line with Nyan Cat.md | 0 .../{ => 201812}/20181208 Play Tetris at your Linux terminal.md | 0 ...o Check Laptop Battery Status And Level From Linux Terminal.md | 0 published/{ => 201812}/20181210 How to get started in AI.md | 0 ...ow to Install Putty on Ubuntu and Other Linux Distributions.md | 0 published/{ => 201812}/20181212 Aliases- DIY Shell Commands.md | 0 .../20181212 How to Build a Netboot Server, Part 2.md | 0 .../20181212 Patch into The Matrix at the Linux command line.md | 0 .../20181213 Relax by the fire at your Linux terminal.md | 0 .../20181214 How To Install Rust Programming Language In Linux.md | 0 ...181217 Take a swim at your Linux terminal with asciiquarium.md | 0 .../20181221 Listen to the radio at the Linux terminal.md | 0 97 files changed, 0 insertions(+), 0 deletions(-) rename published/{ => 201812}/20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md (100%) rename published/{ => 201812}/20171012 7 Best eBook Readers for Linux.md (100%) rename published/{ => 201812}/20171108 Continuous infrastructure- The other CI.md (100%) rename published/{ => 201812}/20171111 A CEOs Guide to Emacs.md (100%) rename published/{ => 201812}/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md (100%) rename published/{ => 201812}/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md (100%) rename published/{ => 201812}/20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md (100%) rename published/{ => 201812}/20180101 27 open solutions to everything in education.md (100%) rename published/{ => 201812}/20180104 How Creative Commons benefits artists and big business.md (100%) rename published/{ => 201812}/20180128 Getting Linux Jobs.md (100%) rename published/{ => 201812}/20180130 Graphics and music tools for game development.md (100%) rename published/{ => 201812}/20180131 For your first HTML code lets help Batman write a love letter.md (100%) rename published/{ => 201812}/20180208 Gathering project requirements using the Open Decision Framework.md (100%) rename published/{ => 201812}/20180221 12 useful zypper command examples.md (100%) rename published/{ => 201812}/20180226 -Getting to Done- on the Linux command line.md (100%) rename published/{ => 201812}/20180228 Emacs -2- Introducing org-mode.md (100%) rename published/{ => 201812}/20180302 Emacs -3- More on org-mode.md (100%) rename published/{ => 201812}/20180328 What NASA Has Been Doing About Open Science.md (100%) rename published/{ => 201812}/20180331 Emacs -4- Automated emails to org-mode and org-mode syncing.md (100%) rename published/{ => 201812}/20180404 Emacs -5- Documents and Presentations with org-mode.md (100%) rename published/{ => 201812}/20180412 A new approach to security instrumentation.md (100%) rename published/{ => 201812}/20180419 Migrating to Linux- Network and System Settings.md (100%) rename published/{ => 201812}/20180420 How To Remove Password From A PDF File in Linux.md (100%) rename published/{ => 201812}/20180422 Command Line Tricks For Data Scientists - kade killary.md (100%) rename published/{ => 201812}/20180504 How a university network assistant used Linux in the 90s.md (100%) rename published/{ => 201812}/20180508 Person with diabetes finds open source and builds her own medical device.md (100%) rename published/{ => 201812}/20180518 How to Manage Fonts in Linux.md (100%) rename published/{ => 201812}/20180523 How to dual-boot Linux and Windows.md (100%) rename published/{ => 201812}/20180525 How to Set Different Wallpaper for Each Monitor in Linux.md (100%) rename published/{ => 201812}/20180623 The IBM 029 Card Punch.md (100%) rename published/{ => 201812}/20180707 Version Control Before Git with CVS.md (100%) rename published/{ => 201812}/20180709 5 Firefox extensions to protect your privacy.md (100%) rename published/{ => 201812}/20180710 Users, Groups, and Other Linux Beasts.md (100%) rename published/{ => 201812}/20180716 Users, Groups and Other Linux Beasts- Part 2.md (100%) rename published/{ => 201812}/20180717 11 Uses for a Raspberry Pi Around the Office.md (100%) rename published/{ => 201812}/20180806 GPaste Is A Great Clipboard Manager For Gnome Shell.md (100%) rename published/{ => 201812}/20180806 Systemd Timers- Three Use Cases.md (100%) rename published/{ => 201812}/20180814 HTTP request routing and validation with gorilla-mux.md (100%) rename published/{ => 201812}/20180817 Mixing software development roles produces great results.md (100%) rename published/{ => 201812}/20180826 How to Install and Use FreeDOS on VirtualBox.md (100%) rename published/{ => 201812}/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md (100%) rename published/{ => 201812}/20180831 Publishing Markdown to HTML with MDwiki.md (100%) rename published/{ => 201812}/20180904 Why schools of the future are open.md (100%) rename published/{ => 201812}/20180911 Know Your Storage- Block, File - Object.md (100%) rename published/{ => 201812}/20180912 How to turn on an LED with Fedora IoT.md (100%) rename published/{ => 201812}/20181004 Archiving web sites.md (100%) rename published/{ => 201812}/20181004 Lab 3- User Environments.md (100%) rename published/{ => 201812}/20181016 Lab 4- Preemptive Multitasking.md (100%) rename published/{ => 201812}/20181016 Lab 5- File system, Spawn and Shell.md (100%) rename published/{ => 201812}/20181022 Improve login security with challenge-response authentication.md (100%) rename published/{ => 201812}/20181025 How to write your favorite R functions in Python.md (100%) rename published/{ => 201812}/20181026 Directing traffic- Demystifying internet-scale load balancing.md (100%) rename published/{ => 201812}/20181102 Create a containerized machine learning model.md (100%) rename published/{ => 201812}/20181105 5 Easy Tips for Linux Web Browser Security.md (100%) rename published/{ => 201812}/20181106 How to partition and format a drive on Linux.md (100%) rename published/{ => 201812}/20181107 Automate a web browser with Selenium.md (100%) rename published/{ => 201812}/20181107 Top 30 OpenStack Interview Questions and Answers.md (100%) rename published/{ => 201812}/20181112 A Free Guide for Setting Your Open Source Strategy.md (100%) rename published/{ => 201812}/20181112 A Free, Secure And Cross-platform Password Manager.md (100%) rename published/{ => 201812}/20181112 The Source History of Cat.md (100%) rename published/{ => 201812}/20181113 An introduction to Udev- The Linux subsystem for managing device events.md (100%) rename published/{ => 201812}/20181115 3 best practices for continuous integration and deployment.md (100%) rename published/{ => 201812}/20181119 7 command-line tools for writers - Opensource.com.md (100%) rename published/{ => 201812}/20181119 9 obscure Python libraries for data science.md (100%) rename published/{ => 201812}/20181121 10 ways to give thanks to open source and free software maintainers.md (100%) rename published/{ => 201812}/20181121 Coupled commands with control operators in Bash.md (100%) rename published/{ => 201812}/20181121 DevOps is for everyone.md (100%) rename published/{ => 201812}/20181121 How to swap Ctrl and Caps Lock keys in Linux.md (100%) rename published/{ => 201812}/20181123 How to Build a Netboot Server, Part 1.md (100%) rename published/{ => 201812}/20181124 How To Configure IP Address In Ubuntu 18.04 LTS.md (100%) rename published/{ => 201812}/20181126 How to use the sudo command to deploy superuser powers on Linux.md (100%) rename published/{ => 201812}/20181128 OpenSnitch - an Application Firewall for Linux -Review.md (100%) rename published/{ => 201812}/20181128 Standalone web applications with GNOME Web.md (100%) rename published/{ => 201812}/20181129 4 open source Markdown editors.md (100%) rename published/{ => 201812}/20181130 SMPlayer in Linux- Features, Download and Installation.md (100%) rename published/{ => 201812}/20181130 Some Alternatives To ‘top- Command line Utility You Might Want To Know.md (100%) rename published/{ => 201812}/20181201 Boxing yourself in on the Linux command line.md (100%) rename published/{ => 201812}/20181202 Drive a locomotive through your Linux terminal.md (100%) rename published/{ => 201812}/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md (100%) rename published/{ => 201812}/20181204 3 implications of serverless.md (100%) rename published/{ => 201812}/20181204 Have a cow at the Linux command line.md (100%) rename published/{ => 201812}/20181205 Bash Variables- Environmental and Otherwise.md (100%) rename published/{ => 201812}/20181205 Bring some color to your Linux terminal with lolcat.md (100%) rename published/{ => 201812}/20181205 Easily Convert Audio File Formats with SoundConverter in Linux.md (100%) rename published/{ => 201812}/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md (100%) rename published/{ => 201812}/20181206 Take a break at the Linux command line with Nyan Cat.md (100%) rename published/{ => 201812}/20181208 Play Tetris at your Linux terminal.md (100%) rename published/{ => 201812}/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md (100%) rename published/{ => 201812}/20181210 How to get started in AI.md (100%) rename published/{ => 201812}/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md (100%) rename published/{ => 201812}/20181212 Aliases- DIY Shell Commands.md (100%) rename published/{ => 201812}/20181212 How to Build a Netboot Server, Part 2.md (100%) rename published/{ => 201812}/20181212 Patch into The Matrix at the Linux command line.md (100%) rename published/{ => 201812}/20181213 Relax by the fire at your Linux terminal.md (100%) rename published/{ => 201812}/20181214 How To Install Rust Programming Language In Linux.md (100%) rename published/{ => 201812}/20181217 Take a swim at your Linux terminal with asciiquarium.md (100%) rename published/{ => 201812}/20181221 Listen to the radio at the Linux terminal.md (100%) diff --git a/published/20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md b/published/201812/20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md similarity index 100% rename from published/20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md rename to published/201812/20111221 30 Best Sources For Linux - -BSD - Unix Documentation On the Web.md diff --git a/published/20171012 7 Best eBook Readers for Linux.md b/published/201812/20171012 7 Best eBook Readers for Linux.md similarity index 100% rename from published/20171012 7 Best eBook Readers for Linux.md rename to published/201812/20171012 7 Best eBook Readers for Linux.md diff --git a/published/20171108 Continuous infrastructure- The other CI.md b/published/201812/20171108 Continuous infrastructure- The other CI.md similarity index 100% rename from published/20171108 Continuous infrastructure- The other CI.md rename to published/201812/20171108 Continuous infrastructure- The other CI.md diff --git a/published/20171111 A CEOs Guide to Emacs.md b/published/201812/20171111 A CEOs Guide to Emacs.md similarity index 100% rename from published/20171111 A CEOs Guide to Emacs.md rename to published/201812/20171111 A CEOs Guide to Emacs.md diff --git a/published/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md b/published/201812/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md similarity index 100% rename from published/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md rename to published/201812/20171129 TLDR pages Simplified Alternative To Linux Man Pages.md diff --git a/published/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md b/published/201812/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md similarity index 100% rename from published/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md rename to published/201812/20171223 Celebrate Christmas In Linux Way With These Wallpapers.md diff --git a/published/20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md b/published/201812/20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md similarity index 100% rename from published/20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md rename to published/201812/20171223 My personal Email setup - Notmuch, mbsync, postfix and dovecot.md diff --git a/published/20180101 27 open solutions to everything in education.md b/published/201812/20180101 27 open solutions to everything in education.md similarity index 100% rename from published/20180101 27 open solutions to everything in education.md rename to published/201812/20180101 27 open solutions to everything in education.md diff --git a/published/20180104 How Creative Commons benefits artists and big business.md b/published/201812/20180104 How Creative Commons benefits artists and big business.md similarity index 100% rename from published/20180104 How Creative Commons benefits artists and big business.md rename to published/201812/20180104 How Creative Commons benefits artists and big business.md diff --git a/published/20180128 Getting Linux Jobs.md b/published/201812/20180128 Getting Linux Jobs.md similarity index 100% rename from published/20180128 Getting Linux Jobs.md rename to published/201812/20180128 Getting Linux Jobs.md diff --git a/published/20180130 Graphics and music tools for game development.md b/published/201812/20180130 Graphics and music tools for game development.md similarity index 100% rename from published/20180130 Graphics and music tools for game development.md rename to published/201812/20180130 Graphics and music tools for game development.md diff --git a/published/20180131 For your first HTML code lets help Batman write a love letter.md b/published/201812/20180131 For your first HTML code lets help Batman write a love letter.md similarity index 100% rename from published/20180131 For your first HTML code lets help Batman write a love letter.md rename to published/201812/20180131 For your first HTML code lets help Batman write a love letter.md diff --git a/published/20180208 Gathering project requirements using the Open Decision Framework.md b/published/201812/20180208 Gathering project requirements using the Open Decision Framework.md similarity index 100% rename from published/20180208 Gathering project requirements using the Open Decision Framework.md rename to published/201812/20180208 Gathering project requirements using the Open Decision Framework.md diff --git a/published/20180221 12 useful zypper command examples.md b/published/201812/20180221 12 useful zypper command examples.md similarity index 100% rename from published/20180221 12 useful zypper command examples.md rename to published/201812/20180221 12 useful zypper command examples.md diff --git a/published/20180226 -Getting to Done- on the Linux command line.md b/published/201812/20180226 -Getting to Done- on the Linux command line.md similarity index 100% rename from published/20180226 -Getting to Done- on the Linux command line.md rename to published/201812/20180226 -Getting to Done- on the Linux command line.md diff --git a/published/20180228 Emacs -2- Introducing org-mode.md b/published/201812/20180228 Emacs -2- Introducing org-mode.md similarity index 100% rename from published/20180228 Emacs -2- Introducing org-mode.md rename to published/201812/20180228 Emacs -2- Introducing org-mode.md diff --git a/published/20180302 Emacs -3- More on org-mode.md b/published/201812/20180302 Emacs -3- More on org-mode.md similarity index 100% rename from published/20180302 Emacs -3- More on org-mode.md rename to published/201812/20180302 Emacs -3- More on org-mode.md diff --git a/published/20180328 What NASA Has Been Doing About Open Science.md b/published/201812/20180328 What NASA Has Been Doing About Open Science.md similarity index 100% rename from published/20180328 What NASA Has Been Doing About Open Science.md rename to published/201812/20180328 What NASA Has Been Doing About Open Science.md diff --git a/published/20180331 Emacs -4- Automated emails to org-mode and org-mode syncing.md b/published/201812/20180331 Emacs -4- Automated emails to org-mode and org-mode syncing.md similarity index 100% rename from published/20180331 Emacs -4- Automated emails to org-mode and org-mode syncing.md rename to published/201812/20180331 Emacs -4- Automated emails to org-mode and org-mode syncing.md diff --git a/published/20180404 Emacs -5- Documents and Presentations with org-mode.md b/published/201812/20180404 Emacs -5- Documents and Presentations with org-mode.md similarity index 100% rename from published/20180404 Emacs -5- Documents and Presentations with org-mode.md rename to published/201812/20180404 Emacs -5- Documents and Presentations with org-mode.md diff --git a/published/20180412 A new approach to security instrumentation.md b/published/201812/20180412 A new approach to security instrumentation.md similarity index 100% rename from published/20180412 A new approach to security instrumentation.md rename to published/201812/20180412 A new approach to security instrumentation.md diff --git a/published/20180419 Migrating to Linux- Network and System Settings.md b/published/201812/20180419 Migrating to Linux- Network and System Settings.md similarity index 100% rename from published/20180419 Migrating to Linux- Network and System Settings.md rename to published/201812/20180419 Migrating to Linux- Network and System Settings.md diff --git a/published/20180420 How To Remove Password From A PDF File in Linux.md b/published/201812/20180420 How To Remove Password From A PDF File in Linux.md similarity index 100% rename from published/20180420 How To Remove Password From A PDF File in Linux.md rename to published/201812/20180420 How To Remove Password From A PDF File in Linux.md diff --git a/published/20180422 Command Line Tricks For Data Scientists - kade killary.md b/published/201812/20180422 Command Line Tricks For Data Scientists - kade killary.md similarity index 100% rename from published/20180422 Command Line Tricks For Data Scientists - kade killary.md rename to published/201812/20180422 Command Line Tricks For Data Scientists - kade killary.md diff --git a/published/20180504 How a university network assistant used Linux in the 90s.md b/published/201812/20180504 How a university network assistant used Linux in the 90s.md similarity index 100% rename from published/20180504 How a university network assistant used Linux in the 90s.md rename to published/201812/20180504 How a university network assistant used Linux in the 90s.md diff --git a/published/20180508 Person with diabetes finds open source and builds her own medical device.md b/published/201812/20180508 Person with diabetes finds open source and builds her own medical device.md similarity index 100% rename from published/20180508 Person with diabetes finds open source and builds her own medical device.md rename to published/201812/20180508 Person with diabetes finds open source and builds her own medical device.md diff --git a/published/20180518 How to Manage Fonts in Linux.md b/published/201812/20180518 How to Manage Fonts in Linux.md similarity index 100% rename from published/20180518 How to Manage Fonts in Linux.md rename to published/201812/20180518 How to Manage Fonts in Linux.md diff --git a/published/20180523 How to dual-boot Linux and Windows.md b/published/201812/20180523 How to dual-boot Linux and Windows.md similarity index 100% rename from published/20180523 How to dual-boot Linux and Windows.md rename to published/201812/20180523 How to dual-boot Linux and Windows.md diff --git a/published/20180525 How to Set Different Wallpaper for Each Monitor in Linux.md b/published/201812/20180525 How to Set Different Wallpaper for Each Monitor in Linux.md similarity index 100% rename from published/20180525 How to Set Different Wallpaper for Each Monitor in Linux.md rename to published/201812/20180525 How to Set Different Wallpaper for Each Monitor in Linux.md diff --git a/published/20180623 The IBM 029 Card Punch.md b/published/201812/20180623 The IBM 029 Card Punch.md similarity index 100% rename from published/20180623 The IBM 029 Card Punch.md rename to published/201812/20180623 The IBM 029 Card Punch.md diff --git a/published/20180707 Version Control Before Git with CVS.md b/published/201812/20180707 Version Control Before Git with CVS.md similarity index 100% rename from published/20180707 Version Control Before Git with CVS.md rename to published/201812/20180707 Version Control Before Git with CVS.md diff --git a/published/20180709 5 Firefox extensions to protect your privacy.md b/published/201812/20180709 5 Firefox extensions to protect your privacy.md similarity index 100% rename from published/20180709 5 Firefox extensions to protect your privacy.md rename to published/201812/20180709 5 Firefox extensions to protect your privacy.md diff --git a/published/20180710 Users, Groups, and Other Linux Beasts.md b/published/201812/20180710 Users, Groups, and Other Linux Beasts.md similarity index 100% rename from published/20180710 Users, Groups, and Other Linux Beasts.md rename to published/201812/20180710 Users, Groups, and Other Linux Beasts.md diff --git a/published/20180716 Users, Groups and Other Linux Beasts- Part 2.md b/published/201812/20180716 Users, Groups and Other Linux Beasts- Part 2.md similarity index 100% rename from published/20180716 Users, Groups and Other Linux Beasts- Part 2.md rename to published/201812/20180716 Users, Groups and Other Linux Beasts- Part 2.md diff --git a/published/20180717 11 Uses for a Raspberry Pi Around the Office.md b/published/201812/20180717 11 Uses for a Raspberry Pi Around the Office.md similarity index 100% rename from published/20180717 11 Uses for a Raspberry Pi Around the Office.md rename to published/201812/20180717 11 Uses for a Raspberry Pi Around the Office.md diff --git a/published/20180806 GPaste Is A Great Clipboard Manager For Gnome Shell.md b/published/201812/20180806 GPaste Is A Great Clipboard Manager For Gnome Shell.md similarity index 100% rename from published/20180806 GPaste Is A Great Clipboard Manager For Gnome Shell.md rename to published/201812/20180806 GPaste Is A Great Clipboard Manager For Gnome Shell.md diff --git a/published/20180806 Systemd Timers- Three Use Cases.md b/published/201812/20180806 Systemd Timers- Three Use Cases.md similarity index 100% rename from published/20180806 Systemd Timers- Three Use Cases.md rename to published/201812/20180806 Systemd Timers- Three Use Cases.md diff --git a/published/20180814 HTTP request routing and validation with gorilla-mux.md b/published/201812/20180814 HTTP request routing and validation with gorilla-mux.md similarity index 100% rename from published/20180814 HTTP request routing and validation with gorilla-mux.md rename to published/201812/20180814 HTTP request routing and validation with gorilla-mux.md diff --git a/published/20180817 Mixing software development roles produces great results.md b/published/201812/20180817 Mixing software development roles produces great results.md similarity index 100% rename from published/20180817 Mixing software development roles produces great results.md rename to published/201812/20180817 Mixing software development roles produces great results.md diff --git a/published/20180826 How to Install and Use FreeDOS on VirtualBox.md b/published/201812/20180826 How to Install and Use FreeDOS on VirtualBox.md similarity index 100% rename from published/20180826 How to Install and Use FreeDOS on VirtualBox.md rename to published/201812/20180826 How to Install and Use FreeDOS on VirtualBox.md diff --git a/published/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md b/published/201812/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md similarity index 100% rename from published/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md rename to published/201812/20180828 An Introduction to Quantum Computing with Open Source Cirq Framework.md diff --git a/published/20180831 Publishing Markdown to HTML with MDwiki.md b/published/201812/20180831 Publishing Markdown to HTML with MDwiki.md similarity index 100% rename from published/20180831 Publishing Markdown to HTML with MDwiki.md rename to published/201812/20180831 Publishing Markdown to HTML with MDwiki.md diff --git a/published/20180904 Why schools of the future are open.md b/published/201812/20180904 Why schools of the future are open.md similarity index 100% rename from published/20180904 Why schools of the future are open.md rename to published/201812/20180904 Why schools of the future are open.md diff --git a/published/20180911 Know Your Storage- Block, File - Object.md b/published/201812/20180911 Know Your Storage- Block, File - Object.md similarity index 100% rename from published/20180911 Know Your Storage- Block, File - Object.md rename to published/201812/20180911 Know Your Storage- Block, File - Object.md diff --git a/published/20180912 How to turn on an LED with Fedora IoT.md b/published/201812/20180912 How to turn on an LED with Fedora IoT.md similarity index 100% rename from published/20180912 How to turn on an LED with Fedora IoT.md rename to published/201812/20180912 How to turn on an LED with Fedora IoT.md diff --git a/published/20181004 Archiving web sites.md b/published/201812/20181004 Archiving web sites.md similarity index 100% rename from published/20181004 Archiving web sites.md rename to published/201812/20181004 Archiving web sites.md diff --git a/published/20181004 Lab 3- User Environments.md b/published/201812/20181004 Lab 3- User Environments.md similarity index 100% rename from published/20181004 Lab 3- User Environments.md rename to published/201812/20181004 Lab 3- User Environments.md diff --git a/published/20181016 Lab 4- Preemptive Multitasking.md b/published/201812/20181016 Lab 4- Preemptive Multitasking.md similarity index 100% rename from published/20181016 Lab 4- Preemptive Multitasking.md rename to published/201812/20181016 Lab 4- Preemptive Multitasking.md diff --git a/published/20181016 Lab 5- File system, Spawn and Shell.md b/published/201812/20181016 Lab 5- File system, Spawn and Shell.md similarity index 100% rename from published/20181016 Lab 5- File system, Spawn and Shell.md rename to published/201812/20181016 Lab 5- File system, Spawn and Shell.md diff --git a/published/20181022 Improve login security with challenge-response authentication.md b/published/201812/20181022 Improve login security with challenge-response authentication.md similarity index 100% rename from published/20181022 Improve login security with challenge-response authentication.md rename to published/201812/20181022 Improve login security with challenge-response authentication.md diff --git a/published/20181025 How to write your favorite R functions in Python.md b/published/201812/20181025 How to write your favorite R functions in Python.md similarity index 100% rename from published/20181025 How to write your favorite R functions in Python.md rename to published/201812/20181025 How to write your favorite R functions in Python.md diff --git a/published/20181026 Directing traffic- Demystifying internet-scale load balancing.md b/published/201812/20181026 Directing traffic- Demystifying internet-scale load balancing.md similarity index 100% rename from published/20181026 Directing traffic- Demystifying internet-scale load balancing.md rename to published/201812/20181026 Directing traffic- Demystifying internet-scale load balancing.md diff --git a/published/20181102 Create a containerized machine learning model.md b/published/201812/20181102 Create a containerized machine learning model.md similarity index 100% rename from published/20181102 Create a containerized machine learning model.md rename to published/201812/20181102 Create a containerized machine learning model.md diff --git a/published/20181105 5 Easy Tips for Linux Web Browser Security.md b/published/201812/20181105 5 Easy Tips for Linux Web Browser Security.md similarity index 100% rename from published/20181105 5 Easy Tips for Linux Web Browser Security.md rename to published/201812/20181105 5 Easy Tips for Linux Web Browser Security.md diff --git a/published/20181106 How to partition and format a drive on Linux.md b/published/201812/20181106 How to partition and format a drive on Linux.md similarity index 100% rename from published/20181106 How to partition and format a drive on Linux.md rename to published/201812/20181106 How to partition and format a drive on Linux.md diff --git a/published/20181107 Automate a web browser with Selenium.md b/published/201812/20181107 Automate a web browser with Selenium.md similarity index 100% rename from published/20181107 Automate a web browser with Selenium.md rename to published/201812/20181107 Automate a web browser with Selenium.md diff --git a/published/20181107 Top 30 OpenStack Interview Questions and Answers.md b/published/201812/20181107 Top 30 OpenStack Interview Questions and Answers.md similarity index 100% rename from published/20181107 Top 30 OpenStack Interview Questions and Answers.md rename to published/201812/20181107 Top 30 OpenStack Interview Questions and Answers.md diff --git a/published/20181112 A Free Guide for Setting Your Open Source Strategy.md b/published/201812/20181112 A Free Guide for Setting Your Open Source Strategy.md similarity index 100% rename from published/20181112 A Free Guide for Setting Your Open Source Strategy.md rename to published/201812/20181112 A Free Guide for Setting Your Open Source Strategy.md diff --git a/published/20181112 A Free, Secure And Cross-platform Password Manager.md b/published/201812/20181112 A Free, Secure And Cross-platform Password Manager.md similarity index 100% rename from published/20181112 A Free, Secure And Cross-platform Password Manager.md rename to published/201812/20181112 A Free, Secure And Cross-platform Password Manager.md diff --git a/published/20181112 The Source History of Cat.md b/published/201812/20181112 The Source History of Cat.md similarity index 100% rename from published/20181112 The Source History of Cat.md rename to published/201812/20181112 The Source History of Cat.md diff --git a/published/20181113 An introduction to Udev- The Linux subsystem for managing device events.md b/published/201812/20181113 An introduction to Udev- The Linux subsystem for managing device events.md similarity index 100% rename from published/20181113 An introduction to Udev- The Linux subsystem for managing device events.md rename to published/201812/20181113 An introduction to Udev- The Linux subsystem for managing device events.md diff --git a/published/20181115 3 best practices for continuous integration and deployment.md b/published/201812/20181115 3 best practices for continuous integration and deployment.md similarity index 100% rename from published/20181115 3 best practices for continuous integration and deployment.md rename to published/201812/20181115 3 best practices for continuous integration and deployment.md diff --git a/published/20181119 7 command-line tools for writers - Opensource.com.md b/published/201812/20181119 7 command-line tools for writers - Opensource.com.md similarity index 100% rename from published/20181119 7 command-line tools for writers - Opensource.com.md rename to published/201812/20181119 7 command-line tools for writers - Opensource.com.md diff --git a/published/20181119 9 obscure Python libraries for data science.md b/published/201812/20181119 9 obscure Python libraries for data science.md similarity index 100% rename from published/20181119 9 obscure Python libraries for data science.md rename to published/201812/20181119 9 obscure Python libraries for data science.md diff --git a/published/20181121 10 ways to give thanks to open source and free software maintainers.md b/published/201812/20181121 10 ways to give thanks to open source and free software maintainers.md similarity index 100% rename from published/20181121 10 ways to give thanks to open source and free software maintainers.md rename to published/201812/20181121 10 ways to give thanks to open source and free software maintainers.md diff --git a/published/20181121 Coupled commands with control operators in Bash.md b/published/201812/20181121 Coupled commands with control operators in Bash.md similarity index 100% rename from published/20181121 Coupled commands with control operators in Bash.md rename to published/201812/20181121 Coupled commands with control operators in Bash.md diff --git a/published/20181121 DevOps is for everyone.md b/published/201812/20181121 DevOps is for everyone.md similarity index 100% rename from published/20181121 DevOps is for everyone.md rename to published/201812/20181121 DevOps is for everyone.md diff --git a/published/20181121 How to swap Ctrl and Caps Lock keys in Linux.md b/published/201812/20181121 How to swap Ctrl and Caps Lock keys in Linux.md similarity index 100% rename from published/20181121 How to swap Ctrl and Caps Lock keys in Linux.md rename to published/201812/20181121 How to swap Ctrl and Caps Lock keys in Linux.md diff --git a/published/20181123 How to Build a Netboot Server, Part 1.md b/published/201812/20181123 How to Build a Netboot Server, Part 1.md similarity index 100% rename from published/20181123 How to Build a Netboot Server, Part 1.md rename to published/201812/20181123 How to Build a Netboot Server, Part 1.md diff --git a/published/20181124 How To Configure IP Address In Ubuntu 18.04 LTS.md b/published/201812/20181124 How To Configure IP Address In Ubuntu 18.04 LTS.md similarity index 100% rename from published/20181124 How To Configure IP Address In Ubuntu 18.04 LTS.md rename to published/201812/20181124 How To Configure IP Address In Ubuntu 18.04 LTS.md diff --git a/published/20181126 How to use the sudo command to deploy superuser powers on Linux.md b/published/201812/20181126 How to use the sudo command to deploy superuser powers on Linux.md similarity index 100% rename from published/20181126 How to use the sudo command to deploy superuser powers on Linux.md rename to published/201812/20181126 How to use the sudo command to deploy superuser powers on Linux.md diff --git a/published/20181128 OpenSnitch - an Application Firewall for Linux -Review.md b/published/201812/20181128 OpenSnitch - an Application Firewall for Linux -Review.md similarity index 100% rename from published/20181128 OpenSnitch - an Application Firewall for Linux -Review.md rename to published/201812/20181128 OpenSnitch - an Application Firewall for Linux -Review.md diff --git a/published/20181128 Standalone web applications with GNOME Web.md b/published/201812/20181128 Standalone web applications with GNOME Web.md similarity index 100% rename from published/20181128 Standalone web applications with GNOME Web.md rename to published/201812/20181128 Standalone web applications with GNOME Web.md diff --git a/published/20181129 4 open source Markdown editors.md b/published/201812/20181129 4 open source Markdown editors.md similarity index 100% rename from published/20181129 4 open source Markdown editors.md rename to published/201812/20181129 4 open source Markdown editors.md diff --git a/published/20181130 SMPlayer in Linux- Features, Download and Installation.md b/published/201812/20181130 SMPlayer in Linux- Features, Download and Installation.md similarity index 100% rename from published/20181130 SMPlayer in Linux- Features, Download and Installation.md rename to published/201812/20181130 SMPlayer in Linux- Features, Download and Installation.md diff --git a/published/20181130 Some Alternatives To ‘top- Command line Utility You Might Want To Know.md b/published/201812/20181130 Some Alternatives To ‘top- Command line Utility You Might Want To Know.md similarity index 100% rename from published/20181130 Some Alternatives To ‘top- Command line Utility You Might Want To Know.md rename to published/201812/20181130 Some Alternatives To ‘top- Command line Utility You Might Want To Know.md diff --git a/published/20181201 Boxing yourself in on the Linux command line.md b/published/201812/20181201 Boxing yourself in on the Linux command line.md similarity index 100% rename from published/20181201 Boxing yourself in on the Linux command line.md rename to published/201812/20181201 Boxing yourself in on the Linux command line.md diff --git a/published/20181202 Drive a locomotive through your Linux terminal.md b/published/201812/20181202 Drive a locomotive through your Linux terminal.md similarity index 100% rename from published/20181202 Drive a locomotive through your Linux terminal.md rename to published/201812/20181202 Drive a locomotive through your Linux terminal.md diff --git a/published/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md b/published/201812/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md similarity index 100% rename from published/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md rename to published/201812/20181203 Four Easy Ways to Search Or Find Files And Folders in Linux.md diff --git a/published/20181204 3 implications of serverless.md b/published/201812/20181204 3 implications of serverless.md similarity index 100% rename from published/20181204 3 implications of serverless.md rename to published/201812/20181204 3 implications of serverless.md diff --git a/published/20181204 Have a cow at the Linux command line.md b/published/201812/20181204 Have a cow at the Linux command line.md similarity index 100% rename from published/20181204 Have a cow at the Linux command line.md rename to published/201812/20181204 Have a cow at the Linux command line.md diff --git a/published/20181205 Bash Variables- Environmental and Otherwise.md b/published/201812/20181205 Bash Variables- Environmental and Otherwise.md similarity index 100% rename from published/20181205 Bash Variables- Environmental and Otherwise.md rename to published/201812/20181205 Bash Variables- Environmental and Otherwise.md diff --git a/published/20181205 Bring some color to your Linux terminal with lolcat.md b/published/201812/20181205 Bring some color to your Linux terminal with lolcat.md similarity index 100% rename from published/20181205 Bring some color to your Linux terminal with lolcat.md rename to published/201812/20181205 Bring some color to your Linux terminal with lolcat.md diff --git a/published/20181205 Easily Convert Audio File Formats with SoundConverter in Linux.md b/published/201812/20181205 Easily Convert Audio File Formats with SoundConverter in Linux.md similarity index 100% rename from published/20181205 Easily Convert Audio File Formats with SoundConverter in Linux.md rename to published/201812/20181205 Easily Convert Audio File Formats with SoundConverter in Linux.md diff --git a/published/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md b/published/201812/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md similarity index 100% rename from published/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md rename to published/201812/20181205 How To Fix Broken Ubuntu OS Without Reinstalling It.md diff --git a/published/20181206 Take a break at the Linux command line with Nyan Cat.md b/published/201812/20181206 Take a break at the Linux command line with Nyan Cat.md similarity index 100% rename from published/20181206 Take a break at the Linux command line with Nyan Cat.md rename to published/201812/20181206 Take a break at the Linux command line with Nyan Cat.md diff --git a/published/20181208 Play Tetris at your Linux terminal.md b/published/201812/20181208 Play Tetris at your Linux terminal.md similarity index 100% rename from published/20181208 Play Tetris at your Linux terminal.md rename to published/201812/20181208 Play Tetris at your Linux terminal.md diff --git a/published/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md b/published/201812/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md similarity index 100% rename from published/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md rename to published/201812/20181210 5 Ways To Check Laptop Battery Status And Level From Linux Terminal.md diff --git a/published/20181210 How to get started in AI.md b/published/201812/20181210 How to get started in AI.md similarity index 100% rename from published/20181210 How to get started in AI.md rename to published/201812/20181210 How to get started in AI.md diff --git a/published/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md b/published/201812/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md similarity index 100% rename from published/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md rename to published/201812/20181211 How to Install Putty on Ubuntu and Other Linux Distributions.md diff --git a/published/20181212 Aliases- DIY Shell Commands.md b/published/201812/20181212 Aliases- DIY Shell Commands.md similarity index 100% rename from published/20181212 Aliases- DIY Shell Commands.md rename to published/201812/20181212 Aliases- DIY Shell Commands.md diff --git a/published/20181212 How to Build a Netboot Server, Part 2.md b/published/201812/20181212 How to Build a Netboot Server, Part 2.md similarity index 100% rename from published/20181212 How to Build a Netboot Server, Part 2.md rename to published/201812/20181212 How to Build a Netboot Server, Part 2.md diff --git a/published/20181212 Patch into The Matrix at the Linux command line.md b/published/201812/20181212 Patch into The Matrix at the Linux command line.md similarity index 100% rename from published/20181212 Patch into The Matrix at the Linux command line.md rename to published/201812/20181212 Patch into The Matrix at the Linux command line.md diff --git a/published/20181213 Relax by the fire at your Linux terminal.md b/published/201812/20181213 Relax by the fire at your Linux terminal.md similarity index 100% rename from published/20181213 Relax by the fire at your Linux terminal.md rename to published/201812/20181213 Relax by the fire at your Linux terminal.md diff --git a/published/20181214 How To Install Rust Programming Language In Linux.md b/published/201812/20181214 How To Install Rust Programming Language In Linux.md similarity index 100% rename from published/20181214 How To Install Rust Programming Language In Linux.md rename to published/201812/20181214 How To Install Rust Programming Language In Linux.md diff --git a/published/20181217 Take a swim at your Linux terminal with asciiquarium.md b/published/201812/20181217 Take a swim at your Linux terminal with asciiquarium.md similarity index 100% rename from published/20181217 Take a swim at your Linux terminal with asciiquarium.md rename to published/201812/20181217 Take a swim at your Linux terminal with asciiquarium.md diff --git a/published/20181221 Listen to the radio at the Linux terminal.md b/published/201812/20181221 Listen to the radio at the Linux terminal.md similarity index 100% rename from published/20181221 Listen to the radio at the Linux terminal.md rename to published/201812/20181221 Listen to the radio at the Linux terminal.md From 06e26dd6367dbe7674f7a5405c74794d48e03f01 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 1 Jan 2019 00:36:00 +0800 Subject: [PATCH 134/322] PRF:20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md @qhwdw --- ...ving Your Master Key to Offline Storage.md | 105 ++++++++---------- 1 file changed, 46 insertions(+), 59 deletions(-) diff --git a/translated/tech/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md b/translated/tech/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md index 8ca36884d9..666c661806 100644 --- a/translated/tech/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md +++ b/translated/tech/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md @@ -1,129 +1,117 @@ 用 PGP 保护代码完整性(四):将主密钥移到离线存储中 ====== +> 如果开发者的 PGP 密钥被偷了,危害非常大。了解一下如何更安全。 ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/industry-1920.jpg?itok=gI3QraS8) + 在本系列教程中,我们为使用 PGP 提供了一个实用指南。你可以从下面的链接中查看前面的文章: -[第一部分:基本概念和工具][1] +- [第一部分:基本概念和工具][1] +- [第二部分:生成你的主密钥][2] +- [第三部分:生成 PGP 子密钥][3] -[第二部分:生成你的主密钥][2] +这是本系列教程的第四部分,我们继续本教程,我们将谈一谈如何及为什么要将主密钥从你的家目录移到离线存储中。现在开始我们的教程。 -[第三部分:生成 PGP 子密钥][3] - -这是本系列教程的第四部分,我们继续本教程,我们将谈一谈如何及为什么要将主密钥从你的 Home 目录移到离线存储中。现在开始我们的教程。 - -### 清单 +#### 清单 * 准备一个加密的可移除的存储(必要) - * 备份你的 GnuPG 目录(必要) + * 从你的家目录中删除主密钥(推荐) + * 从你的家目录中删除吊销证书(推荐) - * 从你的 Home 目录中删除主密钥(推荐) +#### 考虑事项 - * 从你的 Home 目录中删除吊销证书(推荐) +为什么要从你的家目录中删除你的主 [C] 密钥 ?这样做的主要原因是防止你的主密钥失窃或意外泄露。对于心怀不轨的人来说,私钥对他们具有很大的诱惑力 —— 我们知道有几个恶意软件成功地实现了扫描用户的家目录并将发现的私钥内容上传。 +对于开发者来说,私钥失窃是非常危险的事情 —— 在自由软件的世界中,这无疑是身份证明失窃。从你的家目录中删除私钥将帮你防范这类事件的发生。 - - -#### Considerations - -为什么要从你的 Home 目录中删除你的主密钥 [C] ?这样做的主要原因是防止你的主密钥失窃或意外泄露。对于心怀不轨的人来说,私钥对他们具有很大的诱惑力 —— 我们知道有几个恶意软件成功地实现了扫描用户的 Home 目录并将发现的任何私钥内容上传。 - -对于任何开发者来说,私钥失窃是非常危险的事情 —— 在自由软件的世界中,这无疑是身份证明失窃。从你的 Home 目录中删除私钥将帮你防范这类事件的发生。 - -##### 备份你的 GnuPG 目录 +#### 备份你的 GnuPG 目录 **!!!绝对不要跳过这一步!!!** 备份你的 PGP 密钥将让你在需要的时候很容易地恢复它们,这很重要!(这与我们做的使用 paperkey 的灾难级备份是不一样的)。 -##### 准备可移除的加密存储 +#### 准备可移除的加密存储 我们从取得一个(最好是两个)小型的 USB “拇指“ 驱动器(可加密 U 盘)开始,我们将用它来做备份。你首先需要去加密它们: 加密密码可以使用与主密钥相同的密码。 -##### 备份你的 GnuPG 目录 +#### 备份你的 GnuPG 目录 -加密过程结束之后,重新插入 USB 驱动器并确保它能够正常挂载。你可以通过运行 `mount` 命令去找到设备挂载点的完全路径。(在 Linux 下,外置介质一般挂载在 /media/disk 下,Mac 一般在它的 /Volumes 下) +加密过程结束之后,重新插入 USB 驱动器并确保它能够正常挂载。你可以通过运行 `mount` 命令去找到设备挂载点的完全路径。(在 Linux 下,外置介质一般挂载在 `/media/disk` 下,Mac 一般在它的 `/Volumes` 下) 你知道了挂载点的全路径后,将你的整个 GnuPG 的目录复制进去: + ``` $ cp -rp ~/.gnupg [/media/disk/name]/gnupg-backup - ``` (注意:如果出现任何套接字不支持的错误,没有关系,直接忽略它们。) 现在,用如下的命令去测试一下,确保它们能够正常地工作: + ``` $ gpg --homedir=[/media/disk/name]/gnupg-backup --list-key [fpr] - ``` 如果没有出现任何错误,说明一切正常。弹出这个 USB 驱动器并给它粘上一个明确的标签,以便于你下次需要它时能够很快找到它。接着,将它放到一个安全的 —— 但不要太远 —— 的地方,因为从现在起,你需要偶尔使用它来做一些像编辑身份信息、添加或吊销子证书、或签署其它人的密钥这样的事情。 -##### 删除主密钥 +#### 删除主密钥 -我们 Home 目录中的文件并没有像我们所想像的那样受到保护。它们可能会通过许多不同的方式被泄露或失窃: +我们家目录中的文件并没有像我们所想像的那样受到保护。它们可能会通过许多不同的方式被泄露或失窃: * 通过快速复制来配置一个新工作站时的偶尔事故 - * 通过系统管理员的疏忽或恶意操作 - * 通过安全性欠佳的备份 - * 通过桌面应用中的恶意软件(浏览器、pdf 查看器等等) - * 通过跨境胁迫 +使用一个很好的密码来保护你的密钥是降低上述风险的一个很好方法,但是密码能够通过键盘记录器、背后窥视、或其它方式被发现。基于以上原因,我们建议去配置一个从你的家目录上可移除的主密钥,将它保存在一个离线存储中。 - - -使用一个很好的密码来保护你的密钥是降低上述风险的一个很好方法,但是密码能够通过键盘记录器、背后窥视、或其它方式被发现。基于以上原因,我们建议去配置一个从你的 Home 目录上可移除的主密钥,将它保存在一个离线存储中。 - -###### 删除主密钥 +##### 删除你的主密钥 **请查看前面的节,确保你有完整的你的 GnuPG 目录的一个备份。如果你没有一个可用的备份,下面所做的操作将会使你的主密钥失效!!!** 首先,识别你的主密钥的 keygrip: + ``` $ gpg --with-keygrip --list-key [fpr] - ``` 它的输出应该像下面这样: -``` -pub rsa4096 2017-12-06 [C] [expires: 2019-12-06] - 111122223333444455556666AAAABBBBCCCCDDDD - Keygrip = AAAA999988887777666655554444333322221111 -uid [ultimate] Alice Engineer -uid [ultimate] Alice Engineer -sub rsa2048 2017-12-06 [E] - Keygrip = BBBB999988887777666655554444333322221111 -sub rsa2048 2017-12-06 [S] - Keygrip = CCCC999988887777666655554444333322221111 ``` +pub rsa4096 2017-12-06 [C] [expires: 2019-12-06] + 111122223333444455556666AAAABBBBCCCCDDDD + Keygrip = AAAA999988887777666655554444333322221111 +uid [ultimate] Alice Engineer +uid [ultimate] Alice Engineer +sub rsa2048 2017-12-06 [E] + Keygrip = BBBB999988887777666655554444333322221111 +sub rsa2048 2017-12-06 [S] + Keygrip = CCCC999988887777666655554444333322221111 +``` + +找到 `pub` 行下方的 `Keygrip` 条目(就在主密钥指纹的下方)。它与你的家目录下 `.gnupg` 目录下的一个文件是一致的: -找到 pub 行下方的 keygrip 条目(就在主密钥指纹的下方)。它与你的 Home 目录下 `.gnupg` 目录下的一个文件是一致的: ``` $ cd ~/.gnupg/private-keys-v1.d $ ls AAAA999988887777666655554444333322221111.key BBBB999988887777666655554444333322221111.key CCCC999988887777666655554444333322221111.key - ``` 现在你做的全部操作就是简单地删除与主密钥 keygrip 一致的 `.key` 文件: + ``` $ cd ~/.gnupg/private-keys-v1.d $ rm AAAA999988887777666655554444333322221111.key - ``` -现在,如果运行 --list-secret-keys 命令将出现问题,它将显示主密钥丢失(# 表示不可用): +现在,如果运行 `--list-secret-keys` 命令将出现问题,它将显示主密钥丢失(`#` 表示不可用): + ``` $ gpg --list-secret-keys sec# rsa4096 2017-12-06 [C] [expires: 2019-12-06] @@ -132,23 +120,22 @@ uid [ultimate] Alice Engineer uid [ultimate] Alice Engineer ssb rsa2048 2017-12-06 [E] ssb rsa2048 2017-12-06 [S] - ``` -##### 删除吊销证书 +#### 删除吊销证书 你应该去删除的另一个文件是吊销证书(**删除之前,确保你的备份中有它**),它是使用你的主密钥自动创建的。吊销证书允许一些人去永久标记你的证书为吊销状态,这意味着它无论在任何用途中将不再被使用或信任。一般是使用它来吊销由于某些原因不再受控的一个密钥 —— 比如,你丢失了密钥密码。 -与使用主密钥一样,如果一个吊销证书泄露到恶意者手中,他们能够使用它去破坏你的开发者数字身份,因此,最好是从你的 Home 目录中删除它。 +与使用主密钥一样,如果一个吊销证书泄露到恶意者手中,他们能够使用它去破坏你的开发者数字身份,因此,最好是从你的家目录中删除它。 + ``` cd ~/.gnupg/openpgp-revocs.d rm [fpr].rev - ``` 在下一篇文章中,你将学习如何保护你的子密钥。敬请期待。 -从来自 Linux 基金会和 edX 的免费课程 [“Linux 入门" ][4] 中学习更多 Linux 知识。 +从来自 Linux 基金会和 edX 的免费课程 [“Linux 入门”][4] 中学习更多 Linux 知识。 -------------------------------------------------------------------------------- @@ -156,12 +143,12 @@ via: https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-p 作者:[Konstantin Ryabitsev][a] 译者:[qhwdw](https://github.com/qhwdw) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]:https://www.linux.com/users/mricon -[1]:https://www.linux.com/blog/learn/2018/2/protecting-code-integrity-pgp-part-1-basic-pgp-concepts-and-tools -[2]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-2-generating-and-protecting-your-master-pgp-key -[3]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-3-generating-pgp-subkeys +[1]:https://linux.cn/article-9524-1.html +[2]:https://linux.cn/article-9529-1.html +[3]:https://linux.cn/article-9607-1.html [4]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux From f50536e8c2cdbd176b2b174492336cf847f0253a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 1 Jan 2019 00:39:36 +0800 Subject: [PATCH 135/322] PUB:20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md @qhwdw https://linux.cn/article-10402-1.html --- ...ith PGP - Part 4- Moving Your Master Key to Offline Storage.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md (100%) diff --git a/translated/tech/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md b/published/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md similarity index 100% rename from translated/tech/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md rename to published/20180307 Protecting Code Integrity with PGP - Part 4- Moving Your Master Key to Offline Storage.md From c6f8cc7dfa8279228375489c549ea83d999179d3 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 1 Jan 2019 14:10:04 +0800 Subject: [PATCH 136/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Two=20Years=20Wit?= =?UTF-8?q?h=20Emacs=20as=20a=20CEO=20(and=20now=20CTO)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Years With Emacs as a CEO (and now CTO).md | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 sources/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md diff --git a/sources/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md b/sources/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md new file mode 100644 index 0000000000..3e1f5d1eb2 --- /dev/null +++ b/sources/talk/20180809 Two Years With Emacs as a CEO (and now CTO).md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Two Years With Emacs as a CEO (and now CTO)) +[#]: via: (https://www.fugue.co/blog/2018-08-09-two-years-with-emacs-as-a-cto.html) +[#]: author: (Josh Stella https://www.fugue.co/blog/author/josh-stella) + +Two Years With Emacs as a CEO (and now CTO) +====== + +Two years ago, I wrote [a blog post][1] that got some notice, which surprised me. It was a piece about going back to Emacs as my primary content creation tool, first as a CEO, and now as a CTO. A brief recap is that I spent most of my career as a programmer and a software architect, and preferred Emacs as my code editor for much of that time. Reconsidering Emacs was an experiment that I was excited about, but wasn't sure how it would work out. On the Internet, the post was met with roughly equal parts disdain and appreciation, but tens of thousands of people read it, so it seems that I touched on something interesting. Some of the more challenging and funny posts on [Reddit][2] and [HackerNews][3] predicted that I'd have hands shaped like claws or that I'd have lost my eyesight because I use white backgrounds. I'm pleased to report that no dire consequences resulted, and in fact my wrists are thanking me for the decision. Some folks worried that using Emacs would be a cognitive drain on a CEO. Having taken Fugue from an idea in my backyard to a powerful product with great and enthusiastic customers, I find Emacs to be a solace from things that are actually difficult. I still use white backgrounds. + +Recently, the post was rediscovered and posted to [HackerNews][4]. I got a number of requests to follow up with a post on how things have gone since, so this is that report. In this post, I will also focus on why Emacs and functional programming are highly relevant now; and how Emacs works with our product, Fugue, that uses functional programming to automate cloud computing. I received a lot of feedback that the level of detail and color commentary were useful, so this post is also fairly verbose and I do spend some effort on explaining my thinking. I've recently moved from the CEO to CTO role here at Fugue, but the content of this post reflects the work I have been doing as CEO. I expect to do more work in code with Emacs going forward, so I have some yak shaving ahead. As always, YMMV, caveat emptor, etc. + +### It worked out better than I suspected it would + +My time is filled with nearly constant communication outside of and within the company. Communication is how things get done in the world, and the enemy of reflection and real contemplation of difficult or complex problems. The rarest commodity for me as a startup CEO is time to focus without distraction. Emacs is particularly good for this, once you've invested the time to learn a handful of commands. Other applications call out to be noticed, but a well configured Emacs gets out of the way both visually and mentally. It doesn't change unless you want it to, and there is no cleaner interface than a blank screen and beautiful typography. In my world of constant interruption, this simplicity allows me to focus solely on what I am thinking rather than the computer. The best programs provide access to the computer without demanding attention. + +A few folks pointed out that the original post was as much a criticism of modern computer interfaces as a recommendation of Emacs. I agree and disagree. Modern interfaces, and particularly their application-centric approach (vs. content-centric), are not user focused or task oriented. Emacs avoids this fallacy, which is part of why I like it so much, but it brings other merits to the table as well. Emacs is a portal into the power of the computer itself, and that is a rabbit hole worth descending. Its idioms are paths to discovering and creating your own, and that for me is the definition of creativity. One of the sad things about modern computing is that it is largely made up of black boxes with shiny interfaces that provide momentary gratification rather than real satisfaction. This makes us into consumers rather than creators/makers of technology. I don't care who you are or what your background is; you can understand your computer, and you can make things with it. It's fun, satisfying, and not as hard as you think to get started! + +We often underappreciate the effects of our environments on our psychology. Emacs imparts a feeling of calm and freedom, rather than of urgency, annoyance, or excitement - the latter of which are enemies of thought and contemplation. I like things that last, get out of the way, and provide insight when I do take the time to pay attention to them. Emacs meets all these criteria for me. I use Emacs every day for content creation, and I'm very pleased with how little I think about it. Emacs does have a learning curve, but it's no steeper than a bicycle, and has a similar payoff in that once you are through it, you don't have to think about it anymore, and it imparts a feeling of freedom that other tools don't. It's an elegant tool, from a more civilized age. I'm happy that we seem to be entering another civilized age in computing, and so Emacs is gaining in popularity. + +### I gave up on using Org-mode for schedules and to-do lists + +I spent some words in the original post on using Org-mode for schedules. I gave up on using Org-mode for to dos and the like, as I have to coordinate many meetings and calls every day with dozens of people, and I cannot ask the rest of the world to adapt to my choice of tools, nor do I have the time to transcribe or automate moving things to Org. We are primarily a Mac shop, use Google Calendar etc., and the native Mac OS/iOS tools do a good job for collaboration. I also use a plain old pen for note-taking during meetings, as I find laptop/keyboard use in meetings to be rude and limiting to my ability to listen and think. Therefore I've largely abandoned the idea that Emacs/org can help me with my schedule or organizing my life. Org-mode is great for lots of other things too though, and is my go-to for writing documents, including this one. In other words, I use it largely in ways the author didn't intend, and it's great at them. I hope someone says the same of our work at Fugue someday. + +### Emacs use has spread at Fugue + +I started the original post with an admonition that you may love Emacs, but will probably hate it. I was therefore a little concerned when the documentation team at Fugue picked it as their standard tool, as I thought perhaps they were influenced by my appreciation for it. A couple years later, I'm pretty sure that it was a good call for them. The leader of the team at the time was a very bright programmer, but the two writers we hired to make the Fugue documentation had less technical backgrounds. I figured that if it was a case of a manager imposing the wrong tool, I'd hear about it and it would resolve itself, as Fugue has an anti-authoritarian culture where people are unafraid to call bullshit on anything or anyone, including me. The original manager left Fugue last year, but the docs team now has a slick, integrated CI/CD toolchain for [docs.fugue.co][5], and they've become enthusiastic Emacs users. There is a learning curve for Emacs, but it's not that tall even if it is steep, and climbing it has real benefits in productivity and general happiness. It was also a reminder that liberal arts focused people are every bit as smart and capable with technology as programmers, and perhaps less prone to technology religions and tribalism. + +### My wrists are thanking me + +I've been spending 12 hours a day or so at a computer since the mid-eighties, and it has taken a toll on my wrists (as well as my back, for which I unreservedly recommend the Tag Capisco chair). The combination of Emacs and an ergonomic keyboard has made the RSI wrist issues go away to the point that I haven't thought about it in over a year. Prior to that, I was having daily pain, particularly in my right wrist, and if you've had this issue, you know it can be very distracting and worrying. A few folks asked about keyboards and mice, so if you're interested I'm currently using a [keyboard.io][6] though I've mainly used a Truly Ergonomic keyboard over the last couple years. I'm a few weeks into using the keyboard.io, and I absolutely love it. The shaped key caps are amazing for knowing where you are without looking, and the thumb keys seem obvious in retrospect, particularly for Emacs, where Control and Meta are your constant companions. No more using the pinkie for highly repetitive tasks! + +The amount of mousing I do is much lower than when using Office and IDEs, and that has helped a lot, but I do still need a mouse. I've been using the rather dated looking but highly functional and ergonomic Clearly Superior trackball, which lives up to its name. + +Specific tools aside, the main point is that a great keyboard combined with mouse avoidance has proved very effective at reducing wear and tear on my body. Emacs is central to this because I don't have to mouse around menus to get things done, and the navigation keys are right under my fingers. I'm pretty convinced now that hand movement away from the standard typing position causes a lot of tendon stress for me. YMMV, I'm not a doctor, etc. + +### I haven't done much to my config... + +Some predicted that I'd spend a lot of time yak shaving my configuration. I wondered if they were right, so I paid attention. Not only have I left my config largely alone, paying attention to the issue has made me realize just how much the other tools I use demand my attention and time. Emacs is easily the lowest maintenance piece of software I use. Mac OS and Windows are constantly demanding that I update them, but that's far less intrusive than Adobe Suite and Office's update intrusions in my world. I do occasionally update my Emacs, but it still works the same way, so it's largely a near zero cost operation for me, and one I can choose to do when I please. + +I'm sorry to disappoint, as a number of folks wanted to know what I've done to keep up with a renewed Emacs community and its output, but I've only added a few things to my config over the last two years. I consider this a success, as Emacs is a tool, not a hobby for me. That said, I'd love to hear about new things if you want to share. + +### ...Except for controlling the cloud + +We have a lot of Emacs fans at Fugue, so we've had a [Ludwig-mode][7] for a while now. Ludwig is our declarative, functional DSL for automating cloud infrastructure and services. Recently, Alex Schoof took some flight and evening hours to build fugue-mode, which acts as an Emacs console over the Fugue CLI. If you aren't familiar with Fugue, we make a cloud automation and governance tool that leverages functional programming to give users a great experience of interacting with cloud APIs. Well, it does a lot more than that, but it does that too. Fugue-mode is cool for a number of reasons. It allows me to have a buffer that is constantly reporting on the status of my cloud infrastructure, and since I often modify that infrastructure, I can quickly see the effects of my coding. Fugue organizes cloud workloads into processes, and Fugue-mode is a lot like top for cloud workloads. It also allows me to perform operations like creating new infrastructure or deleting stuff that isn't needed anymore, without much typing. Fugue-mode is a prototype, but it's pretty handy and I now use it regularly. + +![fugue-mode-edited.gif][8] + +### Modes and monitors + +I have added a few modes and integrations, but not really for work/CEO functions. I've been hacking around in Haskell and Scheme on the weekends for fun, so I've added haskell-mode and geiser. Emacs is great for languages that have a REPL, as you can divide up your screen into different "windows" that are running different modes, including REPLs or shells. Geiser is great for Scheme, and if you've not done so, working through SICP is a joy and possibly a revelation in an age that has lots of examples of cargo cult programming. Install MIT Scheme and geiser and you've got something that feels a bit like the Symbolics environments of lore. + +This brings up another topic I didn't cover in the 2015 post: screen management. I like to use a single portrait mode monitor for writing, and I have this configuration at my home and at my primary office. For programming or mixed use, I like the new ultra-wide monitors that we provide to all Fuguers. For these, I prefer to divide my screen into three columns, with the center having my main editing buffer, the left side having a shell and a fugue-mode buffer divided horizontally, and the right having either a documentation buffer or another editing buffer or two. This is easily done by first using 'Ctl-x 3' twice, then 'Ctl-x =' to make the windows equal in width. This will give you three equal columns that you can further subdivide as you like with 'Ctl-x 2' for horizontal divisions. Here's a screenshot of what this looks like. + +![Emacs Screen Shot][9] + +### This will be my last CEO/Emacs post... + +The first reason for this is that I'm now the CTO of Fugue, but also because there are so many topics I'm looking forward to blogging about and now I should have time to do so. I'm planning on doing some deeper dive posts on topics like functional programming, type safety for infrastructure-as-code, and as we roll out some awesome new Fugue capabilities, some posts on what is achievable on the cloud using Fugue. + +-------------------------------------------------------------------------------- + +via: https://www.fugue.co/blog/2018-08-09-two-years-with-emacs-as-a-cto.html + +作者:[Josh Stella][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.fugue.co/blog/author/josh-stella +[b]: https://github.com/lujun9972 +[1]: https://blog.fugue.co/2015-11-11-guide-to-emacs.html +[2]: https://www.reddit.com/r/emacs/comments/7efpkt/a_ceos_guide_to_emacs/ +[3]: https://news.ycombinator.com/item?id=10642088 +[4]: https://news.ycombinator.com/item?id=15753150 +[5]: https://docs.fugue.co/ +[6]: https://shop.keyboard.io/ +[7]: https://github.com/fugue/ludwig-mode +[8]: https://www.fugue.co/hubfs/Imported_Blog_Media/fugue-mode-edited-1.gif +[9]: https://www.fugue.co/hs-fs/hubfs/Emacs%20Screen%20Shot.png?width=929&name=Emacs%20Screen%20Shot.png From 9adb867080e2dfc35d11bc0a136c697b05c3ade5 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 1 Jan 2019 16:57:47 +0800 Subject: [PATCH 137/322] PRF:20181222 A Tale of HTTP-2.md @geekpi --- translated/tech/20181222 A Tale of HTTP-2.md | 26 ++++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/translated/tech/20181222 A Tale of HTTP-2.md b/translated/tech/20181222 A Tale of HTTP-2.md index 9fcaddfad9..1c872981f1 100644 --- a/translated/tech/20181222 A Tale of HTTP-2.md +++ b/translated/tech/20181222 A Tale of HTTP-2.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (A Tale of HTTP/2) @@ -14,7 +14,7 @@ 说实话,我刚刚重写了管理我们备份程序的 Puppet 代码,启用 HTTP/2 似乎是一种转向另一个大型项目之前有效的拖延方式。这有多难? -结果我花了大约 25 个小时来完成。坐下来穿上舒适的拖鞋,因为这是一个 HTTP/2 的故事! +结果我花了大约 25 个小时来完成。坐下来穿上舒适的拖鞋,听听这个 HTTP/2 的故事! [![The Yule Log][2]][3] @@ -25,15 +25,15 @@ ``` Protocols h2 h2c http/1.1 -H2Push on -H2PushPriority core.md Dict.md lctt2014.md lctt2016.md lctt2018.md LICENSE published README.md scripts sources translated after -H2PushPriority text/css before -H2PushPriority image/jpeg after 32 -H2PushPriority image/png after 32 -H2PushPriority application/javascript interleaved +H2Push on +H2PushPriority * after +H2PushPriority text/css before +H2PushPriority image/jpeg after 32 +H2PushPriority image/png after 32 +H2PushPriority application/javascript interleaved ``` -这当然很容易。即使 Apache 中的所有内容都已正确设置,网站仍然可以使用 HTTP/1.1。不过,显然我做得没错,因为我的网站现在发送了一个新的 HTTP 头:`Upgrade: h2, h2c`。 +这当然很容易。即使 Apache 中的所有内容都已正确设置,网站仍然使用的是 HTTP/1.1。不过,显然我做得没错,因为我的网站现在发送了一个新的 HTTP 头:`Upgrade: h2, h2c`。 在浪费了大量时间调试 TLS 密钥(HTTP/2 [与 TLS 1.1 不兼容][4])之后,我终于发现问题是没有使用正确的 Apache 多进程处理模块。 @@ -43,13 +43,13 @@ H2PushPriority application/javascript interleaved ![A clip from Alice in Wonderlands][5] -在很长一段时间里,一位好友一直试图让我相信 [PHP-FPM][6] 的优点。虽然纸上看起来很好, 但我从来没有真正试过。它看起来很复杂。常规的 `mod_php` 做得很好,还有其他事情需要我注意。 +在很长一段时间里,一位好友一直试图让我相信 [PHP-FPM][6] 的优点。虽然表面上看起来很好,但我从来没有真正试过。它看起来很复杂。常规的 `mod_php` 做得很好,还有其他事情需要我注意。 事实上,这次的 HTTP/2 事件是让我钻研它的一个契机。在我理解了 FPM 池的工作原理后,它实际上很容易设置。由于我不得不重写我们用于部署网站的 Puppet 配置文件,我也借此机会巩固了一堆东西。 PHP-FPM 允许你在不同的 Unix 用户下运行网站来增加隔离性。最重要的是,我决定是时候让我们服务器上的 PHP 代码以只读模式运行,并且不得不为我们的 Wordpress、Nextcloud、KanBoard 和 Drupal 实例调整一些东西来减少报错。 -过了很长时间通过 Puppet 的自动任务后,我终于能够在任何地方关闭 `mod_php` 和 `mpm_prefork` 并启用 `mpm_event` 和 `mod_http2`。PHP-FPM 和 HTTP/2 带来的速度提升不错,但更让我感到高兴的是这次磨练增强了我们的 Apache 处理 PHP 的能力。 +过了很长时间通过 Puppet 的自动任务后,我终于能够全部关闭 `mod_php` 和 `mpm_prefork` 并启用 `mpm_event` 和 `mod_http2`。PHP-FPM 和 HTTP/2 带来的速度提升不错,但更让我感到高兴的是这次磨练增强了我们的 Apache 处理 PHP 的能力。 ![Victory!][7] @@ -60,7 +60,7 @@ via: https://veronneau.org/a-tale-of-http2.html 作者:[Louis-Philippe Véronneau][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -72,4 +72,4 @@ via: https://veronneau.org/a-tale-of-http2.html [4]: https://http2.github.io/http2-spec/#TLSUsage [5]: https://veronneau.org/media/blog/2018-12-22/mod_php.gif (A clip from Alice in Wonderlands) [6]: https://wiki.apache.org/httpd/PHP-FPM -[7]: https://veronneau.org/media/blog/2018-12-22/victory.png (Victory!) \ No newline at end of file +[7]: https://veronneau.org/media/blog/2018-12-22/victory.png (Victory!) From d45457e8d38c634c8a096c37813c40f61235c887 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 1 Jan 2019 17:03:49 +0800 Subject: [PATCH 138/322] PUB:20181222 A Tale of HTTP-2.md @geekpi https://linux.cn/article-10404-1.html --- {translated/tech => published}/20181222 A Tale of HTTP-2.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181222 A Tale of HTTP-2.md (98%) diff --git a/translated/tech/20181222 A Tale of HTTP-2.md b/published/20181222 A Tale of HTTP-2.md similarity index 98% rename from translated/tech/20181222 A Tale of HTTP-2.md rename to published/20181222 A Tale of HTTP-2.md index 1c872981f1..1374a98481 100644 --- a/translated/tech/20181222 A Tale of HTTP-2.md +++ b/published/20181222 A Tale of HTTP-2.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10404-1.html) [#]: subject: (A Tale of HTTP/2) [#]: via: (https://veronneau.org/a-tale-of-http2.html) [#]: author: (Louis-Philippe Véronneau https://veronneau.org/) From 582d5ade684ca3009e84f70ce0a601e3c3c8b904 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 1 Jan 2019 17:18:10 +0800 Subject: [PATCH 139/322] PRF:20181221 How to Build a Netboot Server, Part 3.md @qhwdw --- ...1 How to Build a Netboot Server, Part 3.md | 46 +++++++++---------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/translated/tech/20181221 How to Build a Netboot Server, Part 3.md b/translated/tech/20181221 How to Build a Netboot Server, Part 3.md index e174248f62..f36338fd7b 100644 --- a/translated/tech/20181221 How to Build a Netboot Server, Part 3.md +++ b/translated/tech/20181221 How to Build a Netboot Server, Part 3.md @@ -1,22 +1,22 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) -[#]: reviewer: () -[#]: publisher: () -[#]: url: () +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) [#]: subject: (How to Build a Netboot Server, Part 3) [#]: via: (https://fedoramagazine.org/how-to-build-a-netboot-server-part-3/) [#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/) -如何构建一台网络引导服务器(第三部分) +如何构建一台网络引导服务器(三) ====== ![](https://fedoramagazine.org/wp-content/uploads/2018/12/netboot3-816x345.jpg) -在 [如何构建一台网络引导服务器(第一部分)][1] 的文章中,我们提供了一个极简的 [iPXE][2] 引导脚本来引导你的网络引导镜像。许多用户除了使用网络引导镜像外,可能在机器本地也有一个操作系统。但是使用常见的工作站的 BIOS 去切换引导加载器是很笨拙的。在本系列文件的第三部分,我们将向你展示如何设置一个更复杂的 iPXE 配置。它将允许终端用户以更容易的方式去选择引导哪个操作系统。它也可以配置为让系统管理员从一台中央服务器来统一管理引导菜单。 +在 [如何构建一台网络引导服务器(一)][1] 中,我们提供了一个极简的 [iPXE][2] 引导脚本来引导你的网络引导镜像。许多用户除了使用网络引导镜像外,可能在机器本地也有一个操作系统。但是使用常见的工作站的 BIOS 去切换引导加载器是很笨拙的。在本系列文件的第三部分,我们将向你展示如何设置一个更复杂的 iPXE 配置。它将允许终端用户以更容易的方式去选择引导哪个操作系统。它也可以配置为让系统管理员从一台中央服务器来统一管理引导菜单。 ### 一个交互式 iPXE 引导菜单 -下面这些命令重定义了网络引导镜像的 boot.cfg 来作为一个交互式的 iPXE 引导菜单,并使用了一个 5 秒倒计时的定时器: +下面这些命令重定义了网络引导镜像的 `boot.cfg` 来作为一个交互式的 iPXE 引导菜单,并使用了一个 5 秒倒计时的定时器: ``` $ MY_FVER=29 @@ -61,22 +61,20 @@ END 上述菜单有五个节: - * **menu** 定义了显示在屏幕上的实际菜单内容。 - * **failed** 提示用户发生了错误,并将用户带到 shell 以错误错误。 - * **shell** 提供了交互式命令提示符。你可以在引导菜单出现时按下 **Esc** 键进入,或者是 - “boot” 命令失败时也会进入到命令提示符。 - * **lcl** 包含一个提供给 iPXE 退出的简单命令,以及返还控制权给 BIOS。在 iPXE 之后,无论你希望缺省引导的设备(即:工作站的本地硬件)是什么,都必须在你的工作站的 BIOS 中正确地作为下一个引导设备列出来。 - * **f29** 包含前面文章提到同一个网络引导代码,但使用最终的退出代码来替换掉 goto failed。 + * `menu` 定义了显示在屏幕上的实际菜单内容。 + * `failed` 提示用户发生了错误,并将用户带到 shell 以错误错误。 + * `shell` 提供了交互式命令提示符。你可以在引导菜单出现时按下 `Esc` 键进入,或者是 + `boot` 命令失败时也会进入到命令提示符。 + * `lcl` 包含一个提供给 iPXE 退出的简单命令,以及返还控制权给 BIOS。在 iPXE 之后,无论你希望缺省引导的设备(即:工作站的本地硬件)是什么,都必须在你的工作站的 BIOS 中正确地作为下一个引导设备列出来。 + * `f29` 包含前面文章提到同一个网络引导代码,但使用最终的退出代码来替换掉 `goto failed`。 - - -从你的 `$HOME/esp/linux` 目录中复制更新后的 boot.cfg 到所有客户端系统的 ESP 中。如果一切顺利,你应该会看到类似下面图片的结果: +从你的 `$HOME/esp/linux` 目录中复制更新后的 `boot.cfg` 到所有客户端系统的 ESP 中。如果一切顺利,你应该会看到类似下面图片的结果: ![][3] ### 一个服务器托管的引导菜单 -你可以添加到网络引导服务器的另一个特性是,能够从一台中央位置去管理所有客户端的引导菜单。这个特性尤其适用于批量安装(升级)一个新版本的操作系统。在你将新内核和新的 initramfs 复制到所有客户端的 ESP 之后,这个特性可以让你执行一种 [原子事务][4] 去切换所有客户端到新操作系统。 +你可以添加到网络引导服务器的另一个特性是,能够从一台中央位置去管理所有客户端的引导菜单。这个特性尤其适用于批量安装(升级)一个新版本的操作系统。在你将新内核和新的 `initramfs` 复制到所有客户端的 ESP 之后,这个特性可以让你执行一种 [原子事务][4] 去切换所有客户端到新操作系统。 安装 Mojolicious: @@ -116,9 +114,9 @@ END END ``` -这是一个非常简单的 Mojolicious 应用程序,它监听 80 端口,并且只回复到 /menu 的请求。如果你想快速了解 Mojolicious 能做什么,运行 `man Mojolicious::Guides::Growing` 去查看手册。按 **Q** 键退出手册。 +这是一个非常简单的 Mojolicious 应用程序,它监听 80 端口,并且只回应对 `/menu` 的请求。如果你想快速了解 Mojolicious 能做什么,运行 `man Mojolicious::Guides::Growing` 去查看手册。按 `Q` 键退出手册。 -将 boot.cfg 移到我们的网络引导应用程序中作为一个名为 menu.html.ep 的模板: +将 `boot.cfg` 移到我们的网络引导应用程序中作为一个名为 `menu.html.ep` 的模板: ``` # mkdir /opt/bootmenu/templates @@ -157,7 +155,7 @@ END # systemctl start bootmenu.service ``` -用 wget 测试它: +用 `wget` 测试它: ``` $ sudo dnf install -y wget @@ -199,9 +197,9 @@ initrd --name initrd.img ${prefix}/initramfs-4.19.4-300.fc29.x86_64.img boot || goto failed ``` -现在,引导菜单服务器已经正常工作了,重新构建 ipxe.efi 引导加载器,使用一个 init 脚本指向它。 +现在,引导菜单服务器已经正常工作了,重新构建 `ipxe.efi` 引导加载器,使用一个初始化脚本指向它。 -第一步,先更新我们在本系列文章的第一部分中创建的 init.ipxe 脚本: +第一步,先更新我们在本系列文章的第一部分中创建的 `init.ipxe` 脚本: ``` $ MY_BOOTMENU_SERVER=server-01.example.edu @@ -236,7 +234,7 @@ $ sudo systemctl restart bootmenu.service ### 做一步的改变 -如果引导菜单服务器工作正常,在你的客户端系统上的 boot.cfg 文件将更长。 +如果引导菜单服务器工作正常,在你的客户端系统上的 `boot.cfg` 文件将更长。 比如,重新添加 Fedora 28 镜像到引导菜单中: @@ -271,13 +269,13 @@ via: https://fedoramagazine.org/how-to-build-a-netboot-server-part-3/ 作者:[Gregory Bartholomew][a] 选题:[lujun9972][b] 译者:[qhwdw](https://github.com/qhwdw) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://fedoramagazine.org/author/glb/ [b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/how-to-build-a-netboot-server-part-1/ +[1]: https://linux.cn/article-10379-1.html [2]: https://ipxe.org/ [3]: https://fedoramagazine.org/wp-content/uploads/2018/11/netboot-menu-1024x641.png [4]: https://en.wikipedia.org/wiki/Atomicity_(database_systems) From 92bdc0971aa6288b71f4dcbf698fd141bfed7e93 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 1 Jan 2019 17:22:14 +0800 Subject: [PATCH 140/322] PUB:20181221 How to Build a Netboot Server, Part 3.md @qhwdw https://linux.cn/article-10405-1.html --- .../20181221 How to Build a Netboot Server, Part 3.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181221 How to Build a Netboot Server, Part 3.md (99%) diff --git a/translated/tech/20181221 How to Build a Netboot Server, Part 3.md b/published/20181221 How to Build a Netboot Server, Part 3.md similarity index 99% rename from translated/tech/20181221 How to Build a Netboot Server, Part 3.md rename to published/20181221 How to Build a Netboot Server, Part 3.md index f36338fd7b..72a8d2f7f8 100644 --- a/translated/tech/20181221 How to Build a Netboot Server, Part 3.md +++ b/published/20181221 How to Build a Netboot Server, Part 3.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10405-1.html) [#]: subject: (How to Build a Netboot Server, Part 3) [#]: via: (https://fedoramagazine.org/how-to-build-a-netboot-server-part-3/) [#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/) From 36eebe27941005288895e4661ddf65c29c13e469 Mon Sep 17 00:00:00 2001 From: zgj Date: Tue, 1 Jan 2019 18:17:03 +0800 Subject: [PATCH 141/322] =?UTF-8?q?zgj1024=20=E8=AE=A4=E9=A2=86=2020180731?= =?UTF-8?q?=20How=20to=20be=20the=20lazy=20sysadmin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit zgj1024 认领文章 --- sources/talk/20180731 How to be the lazy sysadmin.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/talk/20180731 How to be the lazy sysadmin.md b/sources/talk/20180731 How to be the lazy sysadmin.md index 25024a20bd..52491e397c 100644 --- a/sources/talk/20180731 How to be the lazy sysadmin.md +++ b/sources/talk/20180731 How to be the lazy sysadmin.md @@ -1,3 +1,4 @@ +zgj1024 is translating How to be the lazy sysadmin ====== ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cat-yawn-vm.png?itok=0c_zy6aQ) From c8477f3413db743d7868bbd7e42826dce22b7075 Mon Sep 17 00:00:00 2001 From: wyxplus <32919297+wyxplus@users.noreply.github.com> Date: Tue, 1 Jan 2019 19:23:06 +0800 Subject: [PATCH 142/322] Update 20181222 How to detect automatically generated emails.md --- .../20181222 How to detect automatically generated emails.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181222 How to detect automatically generated emails.md b/sources/tech/20181222 How to detect automatically generated emails.md index 23b509a77b..2ccaeddeee 100644 --- a/sources/tech/20181222 How to detect automatically generated emails.md +++ b/sources/tech/20181222 How to detect automatically generated emails.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wyxplus) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 8f493168a70365d2706690ffa221f6c5e2de2d46 Mon Sep 17 00:00:00 2001 From: Chang Liu Date: Tue, 1 Jan 2019 19:25:06 +0800 Subject: [PATCH 143/322] =?UTF-8?q?Update=2020181210=20McFly=20-=20A=20Rep?= =?UTF-8?q?lacement=20To=20=E2=80=98Ctrl-R-=20Bash=20History=20Search=20Fe?= =?UTF-8?q?ature.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 准备翻译该篇。 --- ...y - A Replacement To ‘Ctrl-R- Bash History Search Feature.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md b/sources/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md index 4c1da08110..cc7155cf03 100644 --- a/sources/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md +++ b/sources/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (FSSlc) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d075751c10c56a1e392f6af5719863f861fe6f3e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 1 Jan 2019 21:29:06 +0800 Subject: [PATCH 144/322] PRF:20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md @LazyWolfLin --- ...untu -Terminal - GUI Methods- It-s FOSS.md | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md b/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md index 9d7a8ebf92..0b1364fe6a 100644 --- a/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md +++ b/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md @@ -1,28 +1,28 @@ [#]: collector: (lujun9972) [#]: translator: (LazyWolfLin) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Update Ubuntu [Terminal & GUI Methods] It's FOSS) [#]: via: (https://itsfoss.com/update-ubuntu/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -如何更新 Ubuntu [终端及GUI方式] It's FOSS +初级:如何在终端及图形界面中更新 Ubuntu ====== -**这篇教程将向你展示如何更新服务器版本或者桌面版本的 Ubuntu。它还解释了更新和升级之间的区别以及你应该了解的有关于 Ubuntu Linux 中的更新的一些其他内容。** +> 这篇教程将向你展示如何更新服务器版本或者桌面版本的 Ubuntu。它还解释了更新和升级之间的区别以及你应该了解的有关于 Ubuntu Linux 中的更新的一些其他内容。 如果你是一个新手并已经体验 Ubuntu 数天或几周,你可能想知道如何更新你的 [Ubuntu][1] 系统以获取安全补丁,错误修复和应用升级。 更新 Ubuntu 非常简单。我并不是瞎说。它简单得只要运行两个命令。让我来告诉你这两个命令的更多细节。 -请注意,本教程适用于 Ubuntu 18.04,16.04 或任何其他版本。命令行方式也适用于基于 Ubuntu 的发行版如 Linux Mint,Linux Lite,elementary OS 等。 +请注意,本教程适用于 Ubuntu 18.04、16.04 或任何其他版本。命令行方式也适用于基于 Ubuntu 的发行版如 Linux Mint、Linux Lite、elementary OS 等。 ### 通过命令行更新 Ubuntu ![如何更新 Ubuntu][2] -在桌面上,打开终端。你可以在菜单里找到它或者使用 Ctrl+Alt+T [快捷键][3]。如果你是登陆到一台 [Ubuntu 服务器][4],那你已经在访问一个终端了。 +在桌面上,打开终端。你可以在菜单里找到它或者使用 `Ctrl+Alt+T` [快捷键][3]。如果你是登录到一台 [Ubuntu 服务器][4],那你已经在访问一个终端了。 在终端里,你只需要使用以下命令: @@ -30,13 +30,13 @@ sudo apt update && sudo apt upgrade -y ``` -它将询问密码,而你可以使用你的账号密码。输入时,你将不会看到任何内容在屏幕上,所以请继续输入你的密码并按回车键。 +它将询问你密码,而你可以使用你的账号密码。输入时,你将不会看到任何内容在屏幕上,所以请继续输入你的密码并按回车键。 现在,我来解释下上面的命令。 事实上,这不是一条命令。它由两条命令组成。符号 `&&` 是合并两条命令的一个方法,第二条命令仅在前一条命令执行成功时执行。 -当命令 `apt upgrade` 要求你在安装更新前确认时,末尾的参数 `-y` 会自动输入 yes。 +当命令 `apt upgrade` 要求你在安装更新前确认时,末尾的参数 `-y` 会自动输入 `yes`。 请注意,你也可以逐条使用这两条命令: @@ -51,7 +51,7 @@ sudo apt upgrade 这条命令更新了可用软件包的本地数据库。如果你没运行这条命令,本地数据库将不会被更新,而你的系统将不会知道是否有可用的新版本。 -这就是为什么当你运行 `sudo apt update`,你会在输出中看到大量的 URLs。这条命令会从对应的储存库(你在输出中看到的 URLs)中获取软件包信息。 +这就是为什么当你运行 `sudo apt update`,你会在输出中看到大量的 URL。这条命令会从对应的储存库(你在输出中看到的 URL)中获取软件包信息。 ![更新 Ubuntu Linux][5] @@ -61,7 +61,7 @@ sudo apt upgrade apt list --upgradable ``` -**补充阅读:** 阅读这篇文章了解[命令 `apt update` 的输出中的 Ign,Hit 和 Get 是什么][6]。 +**补充阅读:** 阅读这篇文章了解[命令 apt update 的输出中的 Ign、Hit 和 Get 是什么][6]。 #### 说明:sudo apt upgrade @@ -69,17 +69,17 @@ apt list --upgradable ![通过命令行更新 Ubuntu Linux][7] -你可以键入 `yes`,`y` 或者只敲回车键去确认安装这些更新。 +你可以键入 `yes`、`y` 或者只敲回车键去确认安装这些更新。 所以总的来说,`sudo apt update` 会检查可用的新版本,而 `sudo apt upgrade` 实际上会执行更新。 命令 `update` 可能会令人困惑,因为你可能期望通过命令 `apt update` 安装更新来更新系统,但这并不会发生。 -### 通过 GUI 更新 Ubuntu[适用于桌面用户] +### 通过 GUI 更新 Ubuntu(适用于桌面用户) 如果你使用桌面版 Ubuntu,你并不需要为了更新系统而打开终端。你可以仍可以使用命令行更新,但这只是一个选择。 -在菜单力,找到 `Software Updater` 并运行它。 +在菜单里,找到 “软件更新” 并运行它。 ![在 Ubuntu 中运行 Software Updater][8] @@ -91,7 +91,7 @@ apt list --upgradable ![在 Ubuntu 中通过更新管理器安装更新][10] -现在,点击 `Install`,它可能会向你询问密码。 +现在,点击 “安装”,它可能会向你询问密码。 ![通过 GUI 在 Ubuntu Linux 中安装更新][11] @@ -107,7 +107,7 @@ apt list --upgradable ![通过 GUI 在 Ubuntu 中安装更新][13] -提示:如果 `software updater` 返回一个错误,你需要在终端是使用命令 `sudo apt update`。输出的最后几行将包含真正的错误信息。你可以在因特网上搜索该错误并解决问题。 +提示:如果“软件更新”返回一个错误,你需要在终端是使用命令 `sudo apt update`。输出的最后几行将包含真正的错误信息。你可以在因特网上搜索该错误并解决问题。 ### 更新 Ubuntu 时要记住几件事 @@ -125,7 +125,7 @@ sudo apt autoremove 如果是 Linux 内核更新,你将需要在系统更新后重启。当你不希望服务器停机时,这将会是一个问题。 -[热修复][15]功能允许Linux内核在持续运行时打补丁。换句话说就是你不需要重启你的系统。 +[热修复][15]功能允许 Linux 内核在持续运行时打补丁。换句话说就是你不需要重启你的系统。 如果你在管理服务器,你可能需要[在 Ubuntu 中启用热修复][16]。 @@ -148,7 +148,7 @@ via: https://itsfoss.com/update-ubuntu/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[LazyWolfLin](https://github.com/LazyWolfLin) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From bccc9b5d8f44b7ef0d93cf3c71ee1d14547875e2 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 1 Jan 2019 21:30:10 +0800 Subject: [PATCH 145/322] PUB:20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md @LazyWolfLin https://linux.cn/article-10406-1.html --- ...How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md (99%) diff --git a/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md b/published/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md similarity index 99% rename from translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md rename to published/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md index 0b1364fe6a..6ab6123cfa 100644 --- a/translated/tech/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md +++ b/published/20181210 How to Update Ubuntu -Terminal - GUI Methods- It-s FOSS.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (LazyWolfLin) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10406-1.html) [#]: subject: (How to Update Ubuntu [Terminal & GUI Methods] It's FOSS) [#]: via: (https://itsfoss.com/update-ubuntu/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From c029acada70516ec43fbba7e4d47c9976b612a92 Mon Sep 17 00:00:00 2001 From: FSSlc Date: Tue, 1 Jan 2019 21:34:52 +0800 Subject: [PATCH 146/322] [Translated] 20181210 McFly - A Replacement To \342\200\230Ctrl-R- Bash History Search Feature.md Signed-off-by: FSSlc --- ...To ‘Ctrl-R- Bash History Search Feature.md | 160 ------------------ ...To ‘Ctrl-R- Bash History Search Feature.md | 155 +++++++++++++++++ 2 files changed, 155 insertions(+), 160 deletions(-) delete mode 100644 sources/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md create mode 100644 translated/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md diff --git a/sources/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md b/sources/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md deleted file mode 100644 index cc7155cf03..0000000000 --- a/sources/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md +++ /dev/null @@ -1,160 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (FSSlc) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (McFly – A Replacement To ‘Ctrl+R’ Bash History Search Feature) -[#]: via: (https://www.ostechnix.com/mcfly-a-replacement-to-ctrlr-bash-history-search-feature/) -[#]: author: (SK https://www.ostechnix.com/author/sk/) - -McFly – A Replacement To ‘Ctrl+R’ Bash History Search Feature -====== -![](https://www.ostechnix.com/wp-content/uploads/2018/12/mcfly-720x340.png) -If you spend a lot of time on CLI mode, you should definitely used or heard about **reverse search** function in BASH. The keyboard shortcut to do reverse search in Bash is **Ctrl+r**. Using bash reverse search, we can bring up all commands which we used previously executed without having to re-type them every time. You can, of course, use UP/DOWN arrows to search your bash history. However, Ctrl+r will make this process much easier and faster. Today, I Stumbled upon a replacement to ‘Ctrl+r’ Bash history search feature. Meet **“McFly”** , a simple tool written in **Rust** programming language that replaces the default Ctrl+r Bash history search with an intelligent search engine. All command suggestions made by McFly are prioritized in real time with a small **neural network**. - -McFly rebinds Ctrl+r functionality to bring up all recently executed commands from your Bash history. It augments your shell history by tracking the following: - - * Command exit status, - * timestamp (When you run the command), - * and execution directory (Where you run the command). - - - -It saves all tracking details in a SQLite database. Since it tracks the command’s historical exit status, you can simply ignore the old failed commands. Cool, yeah? - -When suggesting a command, McFly considers the following facts: - - * On which directory you ran the command. You’re likely to repeat that command in the same directory in future. - * What commands you typed before the command. - * How often you run the command. - * When you last ran the command. - * If you’ve selected the command in McFly before. - * The command’s historical exit status. Because, you probably don’t want to run old failed commands, right? - - - -McFly maintains your default Bash history file, so you can stop using McFly at any time. McFly is not just for BASH, it is also extendable for other shells as well. - -### Installing McFly - -McFly can be installed using Linuxbrew on Linux. If you haven’t installed Linuxbrew yet, refer the following link. - -[Linuxbrew – A Common Package Manager For Linux And Mac OS X][1] - -Once Linuxbrew installed, run the following commands to install McFly: - -``` -$ brew tap cantino/mcfly https://github.com/cantino/mcfly - -$ brew install mcfly -``` - -After the installation is completed, you will see the following output. - -``` -==> Installing mcfly from cantino/mcfly -==> Downloading https://github.com/cantino/mcfly/releases/download/v0.2.5/mcfly-v0 -==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.c -######################################################################## 100.0% -==> ONE MORE STEP! Edit ~/.bashrc and add the following: - -if [ -f $(brew --prefix)/opt/mcfly/mcfly.bash ]; then -. $(brew --prefix)/opt/mcfly/mcfly.bash -fi -🍺 /home/linuxbrew/.linuxbrew/Cellar/mcfly/v0.2.5: 4 files, 3.5MB, built in 33 seconds -``` -![](https://www.ostechnix.com/wp-content/uploads/2018/12/install-mcfly.png) -As you can see, we need to do one more step before start using McFly. - -Add the following lines to your **~/.bashrc** file: - -``` -if [ -f $(brew --prefix)/opt/mcfly/mcfly.bash ]; then -. $(brew --prefix)/opt/mcfly/mcfly.bash -fi -``` - -Finally, run the following command to take effects changes: - -``` -$ source ~/.bashrc -``` - -Your BASH history will be imported to McFly database when you run this command for the first time. It will take a few moments depending upon size of your bash history file. Once the import is done, you will see the following message. - -``` -McFly: Importing Bash history for the first time. This may take a minute or two...done. -``` - -You can now start using McFly. - - -### Usage - -To search through your command history, just type ‘mcfly search’ followed by the part of the command name and hit ENTER key. Mcfly will display the command suggestions based on the search query you just type. - -``` -$ mcfly search -``` - -For instance, I type the following command: - -``` -$ mcfly search mk -``` - -Here is the sample output from my Ubuntu machine: - -![](https://www.ostechnix.com/wp-content/uploads/2018/12/mcfly-command-1.png) - -As you can see, I have used ‘mkdir’ command two times. If you want to run a command from the list of suggestions, just use **UP/DOWN** arrows to select it and hit ENTER to run it immediately. If you want to edit a command, choose it and hit **TAB** key to bring it back to your Terminal and then edit before running it. To delete the selected command from the history, just press **F2**. - -Alternatively, type the following command to open the history search and then type any command or part of the command to view the suggestions from your history. - -``` -$ mcfly search -``` - -McFly will display the command suggestions as you type. - -Here is a short video demonstration of McFly: -![](https://www.ostechnix.com/wp-content/uploads/2018/12/mcfly-demo.gif) -View help: - -``` -$ mcfly --help -``` - - -### Remove McFly - -Don’t like McFly, no problem! Remove it using the following commands: - -``` -$ brew uninstall mcfly - -$ brew untap cantino/mcfly -``` - -Finally, remove the lines which we added earlier from **~/.bashrc** file. - -And, that’s all for now. More good stuffs to come. Stay tuned! - -Cheers! - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/mcfly-a-replacement-to-ctrlr-bash-history-search-feature/ - -作者:[SK][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.ostechnix.com/author/sk/ -[b]: https://github.com/lujun9972 -[1]: https://www.ostechnix.com/linuxbrew-common-package-manager-linux-mac-os-x/ diff --git a/translated/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md b/translated/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md new file mode 100644 index 0000000000..5031edc985 --- /dev/null +++ b/translated/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md @@ -0,0 +1,155 @@ +[#]: collector: (lujun9972) +[#]: translator: (FSSlc) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (McFly – A Replacement To ‘Ctrl+R’ Bash History Search Feature) +[#]: via: (https://www.ostechnix.com/mcfly-a-replacement-to-ctrlr-bash-history-search-feature/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +McFly – Bash 历史命令搜索特性的一个替代品 +====== +![](https://www.ostechnix.com/wp-content/uploads/2018/12/mcfly-720x340.png) + +假如你在命令行模式下花费过很长时间,那么你必定使用过或者听说过 BASH 的 **反向搜索** 功能,在 Bash 中执行反向搜索功能的快捷键是 **Ctrl+r**。通过使用这个特性,我们可以找到我们执行过的命令而无需再次输入它们。当然,你可以使用上下键来搜索你的 bash 命令记录,但使用 Ctrl+r 快捷键可以让这个搜索过程更简单快速。今天我找寻到了 Bash 历史命令搜索特性 ‘Ctrl+r’ 的一个替代品,它就是 **“McFly”**。McFly 是一个使用 **Rust** 编程语言写就的简洁工具,自带一个智能的搜索引擎,用来替换默认的 Ctrl+r 这个 Bash 历史命令搜索特性。 McFly 提供的命令建议都是通过一个小巧的 **神经网络** 来实时排序给出的。 + +McFly 重新绑定了 Ctrl+r 快捷键,可以从你的 Bash 历史命令中找到所有最近执行过的命令。它通过追溯下面的信息来增强你的 shell 历史命令搜索特性: + +* 命令结束状态 +* 当你运行命令时的时间戳 +* 以及你运行命令的执行目录 + +它将所有追溯的信息保存在一个 SQLite 数据库中。由于它追溯了命令的历史结束状态,所以你可以很轻易地忽略掉失败的命令。听起来很酷,对吧? + +在给出一个命令建议时,它将考虑如下因素: + +* 你在哪个目录执行的这个命令,将来你很有可能在相同的目录重复这个命令 +* 在你执行这个命令之前,执行过什么命令 +* 你执行这个命令有多频繁 +* 你最后执行该命令的时间 +* 你是否在 McFly 中选择过这个命令 +* 以及这个命令的历史结束状态。因为你很有可能不会去执行失败过的命令,对吧? + +McFly 维护着你的默认 Bash 历史文件,所以你可以随时停止使用它。McFly 也并不只服务于 BASH, 它也可以扩展到其他 shell 程序。 + +### 安装 McFly + +在 Linux 中,McFly 可以使用 Linuxbrew 来安装。如若你还没有安装过 Linuxbrew,那么你可以参考下面的这个链接。(译者注:从其github 主页了解到也可以下载其二进制来使用。) + +[Linuxbrew —— 一个使用 Linux 和 Mac OS X 的通用包管理][1] + +一旦安装好了 Linuxbrew,运行下面的命令来安装 McFly: + +``` +$ brew tap cantino/mcfly https://github.com/cantino/mcfly + +$ brew install mcfly +``` + +在安装完成后,你将看到下面的输出: + +``` +==> Installing mcfly from cantino/mcfly +==> Downloading https://github.com/cantino/mcfly/releases/download/v0.2.5/mcfly-v0 +==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.c +######################################################################## 100.0% +==> ONE MORE STEP! Edit ~/.bashrc and add the following: + +if [ -f $(brew --prefix)/opt/mcfly/mcfly.bash ]; then +. $(brew --prefix)/opt/mcfly/mcfly.bash +fi +🍺 /home/linuxbrew/.linuxbrew/Cellar/mcfly/v0.2.5: 4 files, 3.5MB, built in 33 seconds +``` + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/install-mcfly.png) +正如你上面看到的那样,在使用 McFly 之前我们需要再做一些配置。 + +将下面几行添加到你的 **~/.bashrc** 文件中: + +``` +if [ -f $(brew --prefix)/opt/mcfly/mcfly.bash ]; then +. $(brew --prefix)/opt/mcfly/mcfly.bash +fi +``` + +最后,再运行下面的命令来让更改生效。 + +``` +$ source ~/.bashrc +``` + +当你第一次执行上面的这个命令时,你的 BASH 历史将会被导入 McFly 的数据库。依据你的 bash 历史文件的大小,这个过程将花费一些时间。一旦导入完成,你讲看到下面的提示信息。 + +``` +McFly: Importing Bash history for the first time. This may take a minute or two...done. +``` + +现在你就可以使用 McFly 了。 + +### 使用方法 + +要在你的命令中执行搜索,只需要键入 ‘mcfly search’ 再加上命令名的一部分,最后敲击 ENTER 键即可。Mcfly 将会基于你刚才键入的搜索查询语句给出命令建议。 + +``` +$ mcfly search +``` + +例如我键入了下面的命令: + +``` +$ mcfly search mk +``` + +下面展示的是我 Ubuntu 机子上的示例输出: + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/mcfly-command-1.png) + +如你所见,我已经使用过 'mkdir' 这个命令两次。假如你想从这些命令建议中执行其中之一,只需使用上下键来选择它,然后敲击 ENTER 键来执行它就可以了。假如你想编辑其中一个命令,则需要先选择它,然后敲 **TAB** 键将这个命令放置到终端中,最后在运行它之前更改它就行了。要从历史中删除已经选择的命令,按 **F2** 即可。 + +或者,输入下面的命令来打开历史搜索,然后输入任意一个命令或者命令的一部分来从你的历史命令中查看它提供的建议。 + +``` +$ mcfly search +``` + +在你输入的同时, McFly 将会展示命令的提示。 + +下面是一个介绍 McFly 的简短演示视频: +![](https://www.ostechnix.com/wp-content/uploads/2018/12/mcfly-demo.gif) + +你还可以使用下面的命令来查看帮助: + +``` +$ mcfly --help +``` + +### 移除 McFly + +不喜欢 McFly,没问题!可以使用下面的命令来移除它: + +``` +$ brew uninstall mcfly + +$ brew untap cantino/mcfly +``` + +最后,移除先前添加到 **~/.bashrc** 文件中的几行命令。 + +好了,这些就是所有了,更多精彩内容敬请期待,请保存关注! + +Cheers! + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/mcfly-a-replacement-to-ctrlr-bash-history-search-feature/ + +作者:[SK][a] +选题:[lujun9972][b] +译者:[FSSlc](https://github.com/FSSlc) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: https://www.ostechnix.com/linuxbrew-common-package-manager-linux-mac-os-x/ From c27b4a1a14f4fbde222042faca3e93cce934f7a1 Mon Sep 17 00:00:00 2001 From: Bestony <13283837+bestony@users.noreply.github.com> Date: Tue, 1 Jan 2019 22:31:28 +0800 Subject: [PATCH 147/322] =?UTF-8?q?=E7=94=B3=E9=A2=86=E6=96=87=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/tech/20180725 Build an interactive CLI with Node.js.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20180725 Build an interactive CLI with Node.js.md b/sources/tech/20180725 Build an interactive CLI with Node.js.md index 6ec13f1cfc..e491993808 100644 --- a/sources/tech/20180725 Build an interactive CLI with Node.js.md +++ b/sources/tech/20180725 Build an interactive CLI with Node.js.md @@ -1,3 +1,5 @@ +bestony translating + Build an interactive CLI with Node.js ====== From a4a2805a06ee91b9f3a66796a41256655338c371 Mon Sep 17 00:00:00 2001 From: Bestony <13283837+bestony@users.noreply.github.com> Date: Wed, 2 Jan 2019 06:52:40 +0800 Subject: [PATCH 148/322] =?UTF-8?q?=E8=AE=A4=E9=A2=86=E6=96=87=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tech/20180703 10 killer tools for the admin in a hurry.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20180703 10 killer tools for the admin in a hurry.md b/sources/tech/20180703 10 killer tools for the admin in a hurry.md index 363f401709..87e3e8b309 100644 --- a/sources/tech/20180703 10 killer tools for the admin in a hurry.md +++ b/sources/tech/20180703 10 killer tools for the admin in a hurry.md @@ -1,3 +1,5 @@ +bestony translating + 10 killer tools for the admin in a hurry ====== From ffeeb9ae4de0f6b541eb8a88e6b7feb47e722211 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 2 Jan 2019 08:53:32 +0800 Subject: [PATCH 149/322] translated --- ...ch YouTube videos at the Linux terminal.md | 80 ------------------- ...ch YouTube videos at the Linux terminal.md | 80 +++++++++++++++++++ 2 files changed, 80 insertions(+), 80 deletions(-) delete mode 100644 sources/tech/20181222 Watch YouTube videos at the Linux terminal.md create mode 100644 translated/tech/20181222 Watch YouTube videos at the Linux terminal.md diff --git a/sources/tech/20181222 Watch YouTube videos at the Linux terminal.md b/sources/tech/20181222 Watch YouTube videos at the Linux terminal.md deleted file mode 100644 index e4db6bc039..0000000000 --- a/sources/tech/20181222 Watch YouTube videos at the Linux terminal.md +++ /dev/null @@ -1,80 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Watch YouTube videos at the Linux terminal) -[#]: via: (https://opensource.com/article/18/12/linux-toy-youtube-dl) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) - -Watch YouTube videos at the Linux terminal -====== -Thought video content was just for your GUI? Think again. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-youtube-dl.png?itok=HYR5vU2a) - -We're almost to the end of our 24-day-long Linux command-line toys advent calendar. Hopefully, you've been following along, but if not, start back at [the beginning][1] and work your way through. You'll find plenty of games, diversions, and oddities for your Linux terminal. - -And while you may have seen some toys from our calendar before, we hope there’s at least one new thing for everyone. - -Today we're going to double-down on yesterday's toy, [MPlayer][2], and add in one more, [**youtube-dl**][3]. - -As its name would imply, **youtube-dl** is a command-line utility for downloading YouTube videos, but it can capture video from a number of other sites as well, and it's a really quite full-featured application with [thorough documentation][4] to make video acquisition easy. A note: please don't use **youtube-dl** in any context that would violate the copyright laws in your jurisdiction. - -**youtube-dl** is licensed under a public domain dedication known as [the][5] [Unlicense][5] that's similar to Creative Common's [CC0][6]. There are some interesting [legal opinions][7] out there about where public domain dedication fits into the open source landscape, but it's generally considered compatible with existing open source licenses even by organizations who don't recommend its use. - -In its simplest form, we're going to use **youtube-dl** to grab a video for playback in our terminal. First, [install][8] it using a method appropriate for your distribution. For me, in Fedora, it was packaged in my repositories, so installation was as simple as: - -``` -$ sudo dnf install youtube-dl -``` - -Then, let's grab a video. YouTube allows you to search by license, so today, we're going to take a look at a fireplace [video][9] from [Gemmy's Videos][10] available under a Creative Commons attribution license. For YouTube videos, you can download with the file ID alone, like this, and we'll specify an output file name as well. I intentionally picked a short video, since long videos can get quite large! - -``` -$ youtube-dl pec8P5K4s8c -o fireplace.mp4 -``` - -If you didn't install [MPlayer][2] yesterday, go ahead and do that, and you may need to install **libcaca** for your system as well if you did not install it previously. If you just use MPlayer to launch the video from the command line as-is ( **$** **mplayer fireplace.webm** ), it will play, but in a window all of its own; not exactly what we were going for. - -First, I set my **libcaca** settings to force it to use **ncurses** **** as the display driver, keeping the output in my terminal, with: - -``` -$ export CACA_DRIVER=ncurses -``` - -Then, I zoomed way out in my terminal (the more "pixels", the better), and played the file with the following (forcing the use of **libcaca** and silencing text output from MPlayer): - -``` -$ mplayer -really-quiet -vo caca fireplace.mp4 -``` - -And, there you go! -![](https://opensource.com/sites/default/files/uploads/linux-toy-youtube-dl.gif) - -Do you have a favorite command-line toy that we should have included? It's a little late to submit a suggestion for this year, but we'd still love to feature some cool command-line toys in the new year. Let me know in the comments below, and I'll check it out. And let me know what you thought of today's amusement. - -Be sure to check out yesterday's toy, [Listen to the radio at the Linux terminal][2], and come back tomorrow for another! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-youtube-dl - -作者:[Jason Baker][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/jason-baker -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/article/18/12/linux-toy-boxes -[2]: https://opensource.com/article/18/12/linux-toy-mplayer -[3]: https://rg3.github.io/youtube-dl/ -[4]: https://github.com/rg3/youtube-dl/blob/master/README.md#readme -[5]: https://unlicense.org/ -[6]: https://creativecommons.org/share-your-work/public-domain/cc0/ -[7]: https://opensource.org/faq#public-domain -[8]: https://github.com/rg3/youtube-dl/blob/master/README.md#installation -[9]: https://www.youtube.com/watch?v=pec8P5K4s8c -[10]: https://www.youtube.com/channel/UCwwaepmpWZVDd605MIRC20A diff --git a/translated/tech/20181222 Watch YouTube videos at the Linux terminal.md b/translated/tech/20181222 Watch YouTube videos at the Linux terminal.md new file mode 100644 index 0000000000..201a911c5b --- /dev/null +++ b/translated/tech/20181222 Watch YouTube videos at the Linux terminal.md @@ -0,0 +1,80 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Watch YouTube videos at the Linux terminal) +[#]: via: (https://opensource.com/article/18/12/linux-toy-youtube-dl) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +在 Linux 终端上观看 YouTube 视频 +====== +认为视频只能在 GUI 下看么?再想想。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-youtube-dl.png?itok=HYR5vU2a) + +我们即将结束为期 24 天的 Linux 命令行玩具日历。希望你一直在看,如果没有,请回到[这里][1]开始,自己试试。你会发现 Linux 终端有很多游戏,消遣和奇怪的东西。 + +虽然你之前可能已经看过我们日历中的一些玩具,但我们希望对每个人至少有一个新事物。 + +今天我们要在昨天的玩具 [MPlayer][2] 上再加上一个 [**youtube-dl**][3]。 + +正如其名称所暗示的那样,**youtube-dl** 是一个用于下载 YouTube 视频的命令行程序,但它也可以从其他许多站点下载视频,而且它是一个有着[丰富文档][4]的功能齐全的程序,从而使视频获取变得容易。注意:请勿在任何违反你所在司法辖区的版权法的情况下使用 **youtube-dl**。 + +**youtube-dl** 使用的是 [Unlicense][5] 这个公共领域许可,类似于 Creative Common 的 [CC0][6]。这里还有哪些公共领域贡献适用于开源领域的[法律意见][7],但它通常被认为与现有的开源许可证兼容,即使是不推荐使用它的组织也是如此。 + +最简单地,我们将使用 **youtube-dl** 来获取视频以便在终端中播放。首先,使用适用于你发行版的方法[安装][8]它。对我来说,在 Fedora 中,它被打包在我的仓库中,因此安装非常简单: + +``` +$ sudo dnf install youtube-dl +``` + +然后,获取一个视频。YouTube 允许你按照许可证进行搜索,所以今天我们将根据知识共享署名许可证查看来自 [Gemmy's Videos][10] 中的壁炉[视频][9]。对于 YouTube 视频,你可以像这样用文件 ID 下载,我们也可以指定输出文件名。我故意选择了一个短片,因为长视频会变得很大! + +``` +$ youtube-dl pec8P5K4s8c -o fireplace.mp4 +``` + +如果你昨天没有安装 [MPlayer][2],请继续安装好,如果你之前没有安装 **libcaca** 则需要安装它。如果你直接用 MPlayer 在命令行中播放视频 ( **$****mplayer fireplace.webm** ),它能够播放,但是会在一个自己的窗口中,这不是我们想要的。 + +首先,我设置将 **libcaca** 强制使用 **ncurses** 作为显示驱动,使输出保持在我的终端: + +``` +$ export CACA_DRIVER=ncurses +``` + +然后,我放大了终端(“像素”越多越好),并使用以下命令播放文件(强制使用 **libcaca**并静默 MPlayer 的文本输出): + +``` +$ mplayer -really-quiet -vo caca fireplace.mp4 +``` + +这就完成了! +![](https://opensource.com/sites/default/files/uploads/linux-toy-youtube-dl.gif) + +你有特别喜欢的命令行小玩具需要我介绍的吗?提交今年的建议有点晚了,但我们仍然希望在新的一年里有一些很酷的命令行玩具。请在下面的评论中告诉我,我会查看的。让我知道你对今天的玩具有何看法。 + +一定要看看昨天的玩具,[在 Linux 终端收听广播][2],明天还要再来! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-youtube-dl + +作者:[Jason Baker][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jason-baker +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/18/12/linux-toy-boxes +[2]: https://opensource.com/article/18/12/linux-toy-mplayer +[3]: https://rg3.github.io/youtube-dl/ +[4]: https://github.com/rg3/youtube-dl/blob/master/README.md#readme +[5]: https://unlicense.org/ +[6]: https://creativecommons.org/share-your-work/public-domain/cc0/ +[7]: https://opensource.org/faq#public-domain +[8]: https://github.com/rg3/youtube-dl/blob/master/README.md#installation +[9]: https://www.youtube.com/watch?v=pec8P5K4s8c +[10]: https://www.youtube.com/channel/UCwwaepmpWZVDd605MIRC20A \ No newline at end of file From 39dfe0833698bada06fe7b331e27ba6bd9b8befd Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 2 Jan 2019 08:57:21 +0800 Subject: [PATCH 150/322] translating --- .../20181223 The Linux command line can fetch fun from afar.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181223 The Linux command line can fetch fun from afar.md b/sources/tech/20181223 The Linux command line can fetch fun from afar.md index 3b5e77fa27..19231007f4 100644 --- a/sources/tech/20181223 The Linux command line can fetch fun from afar.md +++ b/sources/tech/20181223 The Linux command line can fetch fun from afar.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 26bfea2843e86bb63b89063bd38800e4afa50da5 Mon Sep 17 00:00:00 2001 From: LazyWolf Lin Date: Wed, 2 Jan 2019 10:45:47 +0800 Subject: [PATCH 151/322] Translating --- sources/tech/20181224 An Introduction to Go.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181224 An Introduction to Go.md b/sources/tech/20181224 An Introduction to Go.md index b35bc9922e..5989b6c913 100644 --- a/sources/tech/20181224 An Introduction to Go.md +++ b/sources/tech/20181224 An Introduction to Go.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (LazyWolfLin) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d23743a43cf07a7ab627b695257538bf44d00855 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 2 Jan 2019 14:05:09 +0800 Subject: [PATCH 152/322] PRF:20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md @zhs852 --- ...Image Viewer for Ubuntu and other Linux.md | 46 ++++++++++--------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/translated/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md b/translated/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md index 3125ef4db3..e1cf33d5b4 100644 --- a/translated/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md +++ b/translated/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (zhs852) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Top 11 best Image Viewer for Ubuntu and other Linux) @@ -37,17 +37,18 @@ Linux 下最棒的 11 个图片查看器 Nomacs 是一款自由软件。虽然没有什么出众的功能,但是它的兼容性还不错,可以支持许多常见格式。 -它的界面超级简单,但是提供了简单的图片编辑功能(可以调整色彩、亮度、大小)。除此之外,它还支持全屏模式、元数据调整等功能。 +它的界面超级简单,但是提供了简单的图片编辑功能(可以调整色彩、亮度、大小和裁剪)。除此之外,它还支持全屏模式、直方图,以及可以切换显示元数据、编辑历史等信息的许多面板。 **我该如何安装它?** -简单起见,你可以在各种软件中心中安装它。如果你想通过终端安装它,请参见它的 [GitHub 界面][3] 。或者,在使用 APT 包管理的系统中使用如下命令安装: +简单起见,你可以在各种软件中心中安装它。如果你想通过终端安装它,请参见它的 [GitHub 页][3] 。或者,在使用 APT 包管理的系统中使用如下命令安装: ``` sudo apt install nomacs ``` #### 2. Gnome 之眼 + ![Gnome 之眼][4] **它有什么特点?** @@ -68,7 +69,7 @@ sudo apt install nomacs sudo apt install eog ``` -如果你想在其它发行版中安装它,请参见 [项目的 GitHub 页面][5] 。 +如果你想在其它发行版中安装它,请参见 [该项目的 GitHub 页面][5] 。 #### 3. EOM @@ -92,19 +93,20 @@ sudo apt install eog sudo apt install eom ``` -如果你想在其它发行版中安装它,请参见 [项目的 GitHub 页面][7] 。 +如果你想在其它发行版中安装它,请参见 [该项目的 GitHub 页面][7] 。 #### 4. Geeqie + ![Geeqie 图像查看器][8] **它有什么特点?** - * 可扩展 - * 色彩信息显示 + * 可扩展的灵活的图像查看器(其它的图像查看器支持它) + * 可以显示色彩信息 -Geeqie 是一个令用户印象深刻的图片管理/查看器。他支持将其它查看器作为扩展使用,不过它并不提供任何对图像操作的工具。 +Geeqie 是一个令用户印象深刻的图片管理/查看器。它支持将其它查看器作为扩展使用,不过它并不提供任何对图像操作的工具。 -如果你希望获取图像的颜色信息、元数据,或是查看/管理一堆图片,它将会是一个不错的选择。 +如果你希望获取图像的颜色信息、元数据,或是查看/管理一组图片,它将会是一个不错的选择。 **我该如何安装它?** @@ -122,14 +124,14 @@ sudo apt install geeqie **它有什么特点?** - * 多种功能(查看、编辑和管理) + * 全功能(查看、编辑和管理) * 可清除 EXIF 信息 * 图像格式转换 * 查找重复的图像 -gThumb 会让你眼前一亮,因为它有很多功能。它的查看/管理界面和编辑工具(裁剪、颜色编辑等等)将会给你留下很深的印象。 +gThumb 会让你眼前一亮,因为它有很多功能。它的查看/管理界面和编辑工具(裁剪、缩放、颜色编辑等等)将会给你留下很深的印象。 -你甚至可以为图像添加评论或清除它的 EXIF 信息。它使得你可以方便地编辑或转码图像。 +你甚至可以为图像添加评论或清除它的 EXIF 信息。它使得你可以方便地找到重复的图像或转码图像。 **我该如何安装它?** @@ -142,6 +144,7 @@ sudo apt install gthumb 输了没用?请参阅 [项目 GitHub 主页][11] 来获取帮助。 #### 6. Gwenview + ![Gwenview 图像查看器][12] **它有什么特点?** @@ -169,13 +172,13 @@ sudo apt install gwenview **它有什么特点?** - * 可定制的 UI + * 可定制的基本用户界面 * 基本图像编辑工具 * 可在命令行使用 -如果你想要一个可在命令行中访问、支持全屏和幻灯片视图、带有基础编辑工具以及可定制 UI 的查看器,Mirage 是个不二之选。 +如果你想要一个可在命令行中访问、支持全屏和幻灯片视图、带有基础编辑工具以及可定制 UI 的普通查看器,Mirage 是个不二之选。 -它是一个非常快速且兼容性优良的查看器。它支持包括 png、jpg、svg、xpm、gif、bmp 和 tifff 在内的多种图像格式。 +它是一个非常快速且兼容性优良的查看器。它支持包括 png、jpg、svg、xpm、gif、bmp 和 tiff 在内的多种图像格式。 **我该如何安装它?** @@ -185,21 +188,22 @@ sudo apt install gwenview sudo apt install mirage ``` -访问 [项目 GitHub 页面][16] 来获取更多信息。 +访问 [该项目 GitHub 页面][16] 来获取更多信息。 #### 8. KPhotoAlbum + ![KPhotoAlbum][17] **它有什么特点?** * 为图像添加标签 * 数据库支持 - * 图片比较 - * 合并/移除一堆图像 + * 图片压缩 + * 将图像合并到一组图像,或移除 确切地说,KPhotoAlbum 其实不仅仅是一款图像查看器,它还能为图像添加标签并管理图像。 -你可以用它来比较图片以及使用标签搜索你的图片。你还可以使用幻灯片视图来观看图片。 +你可以用它来压缩图片以及使用标签搜索你的图片。你还可以使用幻灯片视图来观看图片。 **我该如何安装它?** @@ -231,7 +235,7 @@ Shotwell 是一个多功能照片管理器。在此,你能查看或管理你 sudo apt install shotwell ``` -若想获取更多信息,请 [前往它的 GitHub 界面][20]。 +若想获取更多信息,请 [前往它的 GitHub 页面][20]。 #### 10. Ristretto @@ -294,7 +298,7 @@ via: https://itsfoss.com/image-viewers-linux/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[zhs852](https://github.com/zhs852) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 48f55d91fa3ca3adafcb2cf438764be14930b4eb Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 2 Jan 2019 14:07:08 +0800 Subject: [PATCH 153/322] PUB:20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md @zhs852 https://linux.cn/article-10407-1.html --- ...222 Top 11 best Image Viewer for Ubuntu and other Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md (99%) diff --git a/translated/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md b/published/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md similarity index 99% rename from translated/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md rename to published/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md index e1cf33d5b4..c0cf2d04c1 100644 --- a/translated/tech/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md +++ b/published/20181222 Top 11 best Image Viewer for Ubuntu and other Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (zhs852) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10407-1.html) [#]: subject: (Top 11 best Image Viewer for Ubuntu and other Linux) [#]: via: (https://itsfoss.com/image-viewers-linux/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From 2d56091df46a1c99609fa9dad139d549f3abeb7e Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 2 Jan 2019 15:35:51 +0800 Subject: [PATCH 154/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Asciinema=20?= =?UTF-8?q?=E2=80=93=20Record=20And=20Share=20Your=20Terminal=20Sessions?= =?UTF-8?q?=20On=20The=20Fly?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Share Your Terminal Sessions On The Fly.md | 312 ++++++++++++++++++ 1 file changed, 312 insertions(+) create mode 100644 sources/tech/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md diff --git a/sources/tech/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md b/sources/tech/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md new file mode 100644 index 0000000000..769780a79f --- /dev/null +++ b/sources/tech/20181227 Asciinema - Record And Share Your Terminal Sessions On The Fly.md @@ -0,0 +1,312 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Asciinema – Record And Share Your Terminal Sessions On The Fly) +[#]: via: (https://www.2daygeek.com/linux-asciinema-record-your-terminal-sessions-share-them-on-web/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +Asciinema – Record And Share Your Terminal Sessions On The Fly +====== + +This is known topic and we had already written so many article about this topic. + +Even today also we are going to discuss about the same topic. + +Other tools are works locally but Asciinema works in both way like local and web. + +I mean we can share the recording on the web. + +By default everyone prefer history command to review/recall the previously entered commands in terminal. + +But unfortunately, that shows only the commands that we ran and doesn’t shows the commands output which was performed previously. + +There are many utilities available in Linux to record the terminal session activity. + +Also, we had written about few utilities in the past and today also we are going to discuss about the same kind of topic. + +If you would like to check other utilities to record your Linux terminal session activity then you can give a try to **[Script Command][1]** , **[Terminalizer Tool][2]** and **[Asciinema Tool][3]**. + +But if you are looking for **[GIF Recorder][4]** then try **[Gifine][5]** , **[Kgif][6]** and **[Peek][7]** utilities. + +### What is Asciinema + +asciinema is a free and open source solution for recording terminal sessions and sharing them on the web. + +When you run asciinema rec in your terminal the recording starts, capturing all output that is being printed to your terminal while you’re issuing the shell commands. + +When the recording finishes (by hitting `Ctrl-D` or typing `exit`) then the captured output is uploaded to asciinema.org website and prepared for playback on the web. + +Asciinema project is built of several complementary pieces such as asciinema command line tool, API at asciinema.org and javascript player. + +Asciinema was inspired by script and scriptreplay commands. + +### How to Install Asciinema In Linux + +It was written in Python and pip installation is a recommended method to install Asciinema on Linux. + +Make sure you should have installed python-pip package on your system. If no, use the following command to install it. + +For Debian/Ubuntu users, use **[Apt Command][8]** or **[Apt-Get Command][9]** to install pip package. + +``` +$ sudo apt install python-pip +``` + +For Archlinux users, use **[Pacman Command][10]** to install pip package. + +``` +$ sudo pacman -S python-pip +``` + +For Fedora users, use **[DNF Command][11]** to install pip package. + +``` +$ sudo dnf install python-pip +``` + +For CentOS/RHEL users, use **[YUM Command][12]** to install pip package. + +``` +$ sudo yum install python-pip +``` + +For openSUSE users, use **[Zypper Command][13]** to install pip package. + +``` +$ sudo zypper install python-pip +``` + +Finally run the following **[pip command][14]** to install Asciinema tool in Linux. + +``` +$ sudo pip3 install asciinema +``` + +### How to Record Your Terminal Session Using Asciinema + +Once you successfully installed Asciinema. Just run the following command to start recording. + +``` +$ asciinema rec 2g-test +asciinema: recording asciicast to 2g-test +asciinema: press "ctrl-d" or type "exit" when you're done +``` + +For testing purpose run few commands and see whether it’s working fine or not. + +``` +$ free + total used free shared buff/cache available +Mem: 15867 2783 10537 1264 2546 11510 +Swap: 17454 0 17454 + +$ hostnamectl + Static hostname: daygeek-Y700 + Icon name: computer-laptop + Chassis: laptop + Machine ID: 31bdeb7b833547368d230a2025d475bc + Boot ID: c84f7e6f39394d1f8fdc4bcaa251aee2 + Operating System: Manjaro Linux + Kernel: Linux 4.19.8-2-MANJARO + Architecture: x86-64 + +$ uname -a +Linux daygeek-Y700 4.19.8-2-MANJARO #1 SMP PREEMPT Sat Dec 8 14:45:36 UTC 2018 x86_64 GNU/Linux + +$ lscpu +Architecture: x86_64 +CPU op-mode(s): 32-bit, 64-bit +Byte Order: Little Endian +Address sizes: 39 bits physical, 48 bits virtual +CPU(s): 8 +On-line CPU(s) list: 0-7 +Thread(s) per core: 2 +Core(s) per socket: 4 +Socket(s): 1 +NUMA node(s): 1 +Vendor ID: GenuineIntel +CPU family: 6 +Model: 94 +Model name: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz +Stepping: 3 +CPU MHz: 800.047 +CPU max MHz: 3500.0000 +CPU min MHz: 800.0000 +BogoMIPS: 5186.00 +Virtualization: VT-x +L1d cache: 32K +L1i cache: 32K +L2 cache: 256K +L3 cache: 6144K +NUMA node0 CPU(s): 0-7 +Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp flush_l1d +``` + +Once you have done, simple press `CTRL+D` or type `exit` to stop the recording. The result will be saved in the same directory. + +``` +$ exit +exit +asciinema: recording finished +asciinema: asciicast saved to 2g-test +``` + +If you would like to save the output in the different directory then mention the path where you want to save the file. + +``` +$ asciinema rec /opt/session-record/2g-test1 +``` + +We can play the recorded session using the following command. + +``` +$ asciinema play 2g-test +``` + +We can play the recorded session with double speed. + +``` +$ asciinema play -s 2 2g-test +``` + +Alternatively we can play the recorded session with normal speed with idle time limited to 2 seconds. + +``` +$ asciinema play -i 2 2g-test +``` + +### How To Share the Recorded Session on The Web + +If you would like to share the recorded session with your friends, just run the following command which upload the recording to asciinema.org and provide you the unique link. + +It will be automatically archived 7 days after upload. + +``` +$ asciinema upload 2g-test +View the recording at: + + https://asciinema.org/a/jdJrxhDLboeyrhzZRHsve0x8i + +This installation of asciinema recorder hasn't been linked to any asciinema.org +account. All unclaimed recordings (from unknown installations like this one) +are automatically archived 7 days after upload. + +If you want to preserve all recordings made on this machine, connect this +installation with asciinema.org account by opening the following link: + + https://asciinema.org/connect/10cd4f24-45b6-4f64-b737-ae0e5d12baf8 +``` + +![][16] + +If you would like to share the recorded session on social media, just click the `Share` button in the bottom of the page. + +If anyone wants to download this recording, just click the `Download` button in the bottom of the page to save on your system. + +### How to Manage Recording on asciinema.org Site + +If you want to preserve all recordings made on this machine, connect this installation with asciinema.org account by opening the following link and follow the instructions. + +``` +https://asciinema.org/connect/10cd4f24-45b6-4f64-b737-ae0e5d12baf8 +``` + +If you have already recorded an asciicast but you don’t see it on your profile on asciinema.org website. Just run the `asciinema auth` command in your terminal to move those. + +``` +$ asciinema auth + +Open the following URL in a web browser to link your install ID with your asciinema.org user account: + +https://asciinema.org/connect/10cd4f24-45b6-4f64-b737-ae0e5d12baf8 + +This will associate all recordings uploaded from this machine (past and future ones) to your account, and allow you to manage them (change title/theme, delete) at asciinema.org. +``` + +![][17] + +Run the following command if you would like to upload the file directly to asciinema.org instead of locally saving. + +``` +$ asciinema rec +asciinema: recording asciicast to /tmp/tmp6kuh4247-ascii.cast +asciinema: press "ctrl-d" or type "exit" when you're done +``` + +Just run the following command to start recording. + +``` +$ asciinema rec 2g-test +asciinema: recording asciicast to 2g-test +asciinema: press "ctrl-d" or type "exit" when you're done +``` + +For testing purpose run few commands and see whether it’s working fine or not. + +``` +$ free + total used free shared buff/cache available +Mem: 15867 2783 10537 1264 2546 11510 +Swap: 17454 0 17454 + +$ hostnamectl + Static hostname: daygeek-Y700 + Icon name: computer-laptop + Chassis: laptop + Machine ID: 31bdeb7b833547368d230a2025d475bc + Boot ID: c84f7e6f39394d1f8fdc4bcaa251aee2 + Operating System: Manjaro Linux + Kernel: Linux 4.19.8-2-MANJARO + Architecture: x86-64 + +$ uname -a +Linux daygeek-Y700 4.19.8-2-MANJARO #1 SMP PREEMPT Sat Dec 8 14:45:36 UTC 2018 x86_64 GNU/Linux +``` + +Once you have done, simple press `CTRL+D` or type `exit` to stop the recording then hit `Enter` button to upload the recording to asciinema.org website. + +It will take few seconds to generate the unique url for your uploaded recording. Once it’s done you will be getting the results same as below. + +``` +$ exit +exit +asciinema: recording finished +asciinema: press "enter" to upload to asciinema.org, "ctrl-c" to save locally + +View the recording at: + + https://asciinema.org/a/b7bu5OhuCy2vUH7M8RRPjsSxg +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-asciinema-record-your-terminal-sessions-share-them-on-web/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/script-command-record-save-your-terminal-session-activity-linux/ +[2]: https://www.2daygeek.com/terminalizer-a-tool-to-record-your-terminal-and-generate-animated-gif-images/ +[3]: https://www.2daygeek.com/Asciinema-record-your-terminal-sessions-as-svg-animations-in-linux/ +[4]: https://www.2daygeek.com/category/gif-recorder/ +[5]: https://www.2daygeek.com/gifine-create-animated-gif-vedio-recorder-linux-mint-debian-ubuntu/ +[6]: https://www.2daygeek.com/kgif-create-animated-gif-file-active-window-screen-recorder-capture-arch-linux-mint-fedora-ubuntu-debian-opensuse-centos/ +[7]: https://www.2daygeek.com/peek-create-animated-gif-screen-recorder-capture-arch-linux-mint-fedora-ubuntu/ +[8]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[9]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[10]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ +[11]: https://www.2daygeek.com/dnf-command-examples-manage-packages-fedora-system/ +[12]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ +[13]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ +[14]: https://www.2daygeek.com/install-pip-manage-python-packages-linux/ +[15]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[16]: https://www.2daygeek.com/wp-content/uploads/2018/12/linux-asciinema-record-your-terminal-sessions-share-web-1.png +[17]: https://www.2daygeek.com/wp-content/uploads/2018/12/linux-asciinema-record-your-terminal-sessions-share-web-3.png From 6326d8405051b83c28b9077e72c056b1a53ae7b7 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 2 Jan 2019 15:44:29 +0800 Subject: [PATCH 155/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Easily=20Upload?= =?UTF-8?q?=20Text=20Snippets=20To=20Pastebin-like=20Services=20From=20Com?= =?UTF-8?q?mandline?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Pastebin-like Services From Commandline.md | 259 ++++++++++++++++++ 1 file changed, 259 insertions(+) create mode 100644 sources/tech/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md diff --git a/sources/tech/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md b/sources/tech/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md new file mode 100644 index 0000000000..58b072f2fc --- /dev/null +++ b/sources/tech/20181231 Easily Upload Text Snippets To Pastebin-like Services From Commandline.md @@ -0,0 +1,259 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Easily Upload Text Snippets To Pastebin-like Services From Commandline) +[#]: via: (https://www.ostechnix.com/how-to-easily-upload-text-snippets-to-pastebin-like-services-from-commandline/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +Easily Upload Text Snippets To Pastebin-like Services From Commandline +====== + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/wgetpaste-720x340.png) + +Whenever there is need to share the code snippets online, the first one probably comes to our mind is Pastebin.com, the online text sharing site launched by **Paul Dixon** in 2002. Now, there are several alternative text sharing services available to upload and share text snippets, error logs, config files, a command’s output or any sort of text files. If you happen to share your code often using various Pastebin-like services, I do have a good news for you. Say hello to **Wgetpaste** , a command line BASH utility to easily upload text snippets to pastebin-like services. Using Wgetpaste script, anyone can quickly share text snippets to their friends, colleagues, or whoever wants to see/use/review the code from command line in Unix-like systems. + +### Installing Wgetpaste + +Wgetpaste is available in Arch Linux [Community] repository. To install it on Arch Linux and its variants like Antergos and Manjaro Linux, just run the following command: + +``` +$ sudo pacman -S wgetpaste +``` + +For other distributions, grab the source code from [**Wgetpaste website**][1] and install it manually as described below. + +First download the latest Wgetpaste tar file: + +``` +$ wget http://wgetpaste.zlin.dk/wgetpaste-2.28.tar.bz2 +``` + +Extract it: + +``` +$ tar -xvjf wgetpaste-2.28.tar.bz2 +``` + +It will extract the contents of the tar file in a folder named “wgetpaste-2.28”. + +Go to that directory: + +``` +$ cd wgetpaste-2.28/ +``` + +Copy the wgetpaste binary to your $PATH, for example **/usr/local/bin/**. + +``` +$ sudo cp wgetpaste /usr/local/bin/ +``` + +Finally, make it executable using command: + +``` +$ sudo chmod +x /usr/local/bin/wgetpaste +``` + +### Upload Text Snippets To Pastebin-like Services + +Uploading text snippets using Wgetpaste is trivial. Let me show you a few examples. + +**1\. Upload text files** + +To upload any text file using Wgetpaste, just run: + +``` +$ wgetpaste mytext.txt +``` + +This command will upload the contents of mytext.txt file. + +Sample output: + +``` +Your paste can be seen here: https://paste.pound-python.org/show/eO0aQjTgExP0wT5uWyX7/ +``` + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/wgetpaste-1.png) + +You can share the pastebin URL via any medium like mail, message, whatsapp or IRC etc. Whoever has this URL can visit it and view the contents of the text file in a web browser of their choice. + +Here is the contents of mytext.txt file in web browser: + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/wgetpaste-2.png) + +You can also use **‘tee’** command to display what is being pasted, instead of uploading them blindly. + +To do so, use **-t** option like below. + +``` +$ wgetpaste -t mytext.txt +``` + +![][3] + +**2. Upload text snippets to different services +** + +By default, Wgetpaste will upload the text snippets to **poundpython** () service. + +To view the list of supported services, run: + +``` +$ wgetpaste -S +``` + +Sample output: + +``` +Services supported: (case sensitive): +Name: | Url: +=============|================= +bpaste | https://bpaste.net/ +codepad | http://codepad.org/ +dpaste | http://dpaste.com/ +gists | https://api.github.com/gists +*poundpython | https://paste.pound-python.org/ +``` + +Here, ***** indicates the default service. + +As you can see, Wgetpaste currently supports five text sharing services. I didn’t try all of them, but I believe all services will work. + +To upload the contents to other services, for example **bpaste.net** , use **-s** option like below. + +``` +$ wgetpaste -s bpaste mytext.txt +Your paste can be seen here: https://bpaste.net/show/5199e127e733 +``` + +**3\. Read input from stdin** + +Wgetpaste can also read the input from stdin. + +``` +$ uname -a | wgetpaste +``` + +This command will upload the output of ‘uname -a’ command. + +**4. Upload the COMMAND and the output of COMMAND together +** + +Sometimes, you may need to paste a COMMAND and its output. To do so, specify the contents of the command within quotes like below. + +``` +$ wgetpaste -c 'ls -l' +``` + +This will upload the command ‘ls -l’ along with its output to the pastebin service. + +This can be useful when you wanted to let others to clearly know what was the exact command you just ran and its output. + +![][4] + +As you can see in the output, I ran ‘ls -l’ command. + +**5. Upload system log files, config files +** + +Like I already said, we can upload any sort of text files, not just an ordinary text file, in your system such as log files, a specific command’s output etc. Say for example, you just updated your Arch Linux box and ended up with a broken system. You ask your colleague how to fix it and s/he wants to read the pacman.log file. Here is the command to upload the contents of the pacman.log file: + +``` +$ wgetpaste /var/log/pacman.log +``` + +Share the pastebin URL with your Colleague, so s/he will review the pacman.log and may help you to fix the problem by reviewing the log file. + +Usually, the contents of log files might be too long and you don’t want to share them all. In such cases, just use **cat** command to read the output and use **tail** command with the **-n** switch to define the number of lines to share and finally pipe the output to Wgetpaste as shown below. + +``` +$ cat /var/log/pacman.log | tail -n 50 | wgetpaste +``` + +The above command will upload only the **last 50 lines** of pacman.log file. + +**6\. Convert input url to tinyurl** + +By default, Wgetpaste will display the full pastebin URL in the output. If you want to convert the input URL to a tinyurl, just use **-u** option. + +``` +$ wgetpaste -u mytext.txt +Your paste can be seen here: http://tinyurl.com/y85d8gtz +``` + +**7. Set language +** + +By default, Wgetpaste will upload text snippets in **plain text**. + +To list languages supported by the specified service, use **-L** option. + +``` +$ wgetpaste -L +``` + +This command will list all languages supported by default service i.e **poundpython** (). + +We can change this using **-l** option. + +``` +$ wgetpaste -l Bash mytext.txt +``` + +**8\. Disable syntax highlighting or html in the output** + +As I mentioned above, the text snippets will be displayed in a specific language format (plaintext, Bash etc.). + +You can, however, change this behaviour to display the raw text snippets using **-r** option. + +``` +$ wgetpaste -r mytext.txt +Your raw paste can be seen here: https://paste.pound-python.org/raw/CUJhQ3jEmr2UvfmD2xCL/ +``` + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/wgetpaste-5.png) + +As you can see in the above output, there is no syntax highlighting, no html formatting. Just a raw output. + +**9\. Change Wgetpaste defaults** + +All Defaults values (DEFAULT_{NICK,LANGUAGE,EXPIRATION}[_${SERVICE}] and DEFAULT_SERVICE) can be changed globally in **/etc/wgetpaste.conf** or per user in **~/.wgetpaste.conf** files. These files, however, are not available by default in my system. I guess we need to manually create them. The developer has given the sample contents for both files [**here**][5] and [**here**][6]. Just create these files manually with given sample contents and modify the parameters accordingly to change Wgetpaste defaults. + +**10\. Getting help** + +To display the help section, run: + +``` +$ wgetpaste -h +``` + +And, that’s all for now. Hope this was useful. We will publish more useful content in the days to come. Stay tuned! + +On behalf of **OSTechNix** , I wish you all a very **Happy New Year 2019**. I am grateful to all our readers, contributors, and mentors for supporting us from the beginning of our journey. We couldn’t come this far without your support and guidance. Thank you everyone! Have a great year ahead!! + +Cheers! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-easily-upload-text-snippets-to-pastebin-like-services-from-commandline/ + +作者:[SK][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: http://wgetpaste.zlin.dk/ +[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[3]: http://www.ostechnix.com/wp-content/uploads/2018/12/wgetpaste-3.png +[4]: http://www.ostechnix.com/wp-content/uploads/2018/12/wgetpaste-4.png +[5]: http://wgetpaste.zlin.dk/zlin.conf +[6]: http://wgetpaste.zlin.dk/wgetpaste.example From 3262d72061b56fef4cdb0bbd96f43f3525e093fe Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 2 Jan 2019 15:48:39 +0800 Subject: [PATCH 156/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Troubleshooting?= =?UTF-8?q?=20hardware=20problems=20in=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ubleshooting hardware problems in Linux.md | 141 ++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 sources/tech/20181231 Troubleshooting hardware problems in Linux.md diff --git a/sources/tech/20181231 Troubleshooting hardware problems in Linux.md b/sources/tech/20181231 Troubleshooting hardware problems in Linux.md new file mode 100644 index 0000000000..dcc89034db --- /dev/null +++ b/sources/tech/20181231 Troubleshooting hardware problems in Linux.md @@ -0,0 +1,141 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Troubleshooting hardware problems in Linux) +[#]: via: (https://opensource.com/article/18/12/troubleshooting-hardware-problems-linux) +[#]: author: (Daniel Oh https://opensource.com/users/daniel-oh) + +Troubleshooting hardware problems in Linux +====== +Learn what's causing your Linux hardware to malfunction so you can get it back up and running quickly. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_other11x_cc.png?itok=I_kCDYj0) + +[Linux servers][1] run mission-critical business applications in many different types of infrastructures including physical machines, virtualization, private cloud, public cloud, and hybrid cloud. It's important for Linux sysadmins to understand how to manage Linux hardware infrastructure—including software-defined functionalities related to [networking][2], storage, Linux containers, and multiple tools on Linux servers. + +It can take some time to troubleshoot and solve hardware-related issues on Linux. Even highly experienced sysadmins sometimes spend hours working to solve mysterious hardware and software discrepancies. + +The following tips should make it quicker and easier to troubleshoot hardware in Linux. Many different things can cause problems with Linux hardware; before you start trying to diagnose them, it's smart to learn about the most common issues and where you're most likely to find them. + +### Quick-diagnosing devices, modules, and drivers + +The first step in troubleshooting usually is to display a list of the hardware installed on your Linux server. You can obtain detailed information on the hardware using **ls** commands such as **[lspci][3]** , **[lsblk][4]** , **[lscpu][5]** , and **[lsscsi][6]**. For example, here is output of the **lsblk** command: + +``` +# lsblk +NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT +xvda    202:0    0  50G  0 disk +├─xvda1 202:1    0   1M  0 part +└─xvda2 202:2    0  50G  0 part / +xvdb    202:16   0  20G  0 disk +└─xvdb1 202:17   0  20G  0 part +``` + +If the **ls** commands don't reveal any errors, use init processes (e.g., **systemd** ) to see how the Linux server is working. **systemd** is the most popular init process for bootstrapping user spaces and controlling multiple system processes. For example, here is output of the **systemctl status** command: + +``` +# systemctl status +● bastion.f347.internal +    State: running +     Jobs: 0 queued +   Failed: 0 units +    Since: Wed 2018-11-28 01:29:05 UTC; 2 days ago +   CGroup: / +           ├─1 /usr/lib/systemd/systemd --switched-root --system --deserialize 21 +           ├─kubepods.slice +           │ ├─kubepods-pod3881728a_f2af_11e8_af77_06af52f87498.slice +           │ │ ├─docker-88b27385f4bae77bba834fbd60a61d19026bae13d18eb147783ae27819c34967.scope +           │ │ │ └─23860 /opt/bridge/bin/bridge --public-dir=/opt/bridge/static --config=/var/console-config/console-c +           │ │ └─docker-a4433f0d523c7e5bc772ee4db1861e4fa56c4e63a2d48f6bc831458c2ce9fd2d.scope +           │ │   └─23639 /usr/bin/pod +.... +``` + +### Digging into multiple loggings + +**Dmesg** allows you to figure out errors and warnings in the kernel's latest messages. For example, here is output of the **dmesg | more** command: + +``` +# dmesg | more +.... +[ 1539.027419] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready +[ 1539.042726] IPv6: ADDRCONF(NETDEV_UP): veth61f37018: link is not ready +[ 1539.048706] IPv6: ADDRCONF(NETDEV_CHANGE): veth61f37018: link becomes ready +[ 1539.055034] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready +[ 1539.098550] device veth61f37018 entered promiscuous mode +[ 1541.450207] device veth61f37018 left promiscuous mode +[ 1542.493266] SELinux: mount invalid.  Same superblock, different security settings for (dev mqueue, type mqueue) +[ 9965.292788] SELinux: mount invalid.  Same superblock, different security settings for (dev mqueue, type mqueue) +[ 9965.449401] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready +[ 9965.462738] IPv6: ADDRCONF(NETDEV_UP): vetheacc333c: link is not ready +[ 9965.468942] IPv6: ADDRCONF(NETDEV_CHANGE): vetheacc333c: link becomes ready +.... +``` + +You can also look at all Linux system logs in the **/var/log/messages** file, which is where you'll find errors related to specific issues. It's worthwhile to monitor the messages via the **tail** command in real time when you make modifications to your hardware, such as mounting an extra disk or adding an Ethernet network interface. For example, here is output of the **tail -f /var/log/messages** command: + +``` +# tail -f /var/log/messages +Dec  1 13:20:33 bastion dnsmasq[30201]: using nameserver 127.0.0.1#53 for domain in-addr.arpa +Dec  1 13:20:33 bastion dnsmasq[30201]: using nameserver 127.0.0.1#53 for domain cluster.local +Dec  1 13:21:03 bastion dnsmasq[30201]: setting upstream servers from DBus +Dec  1 13:21:03 bastion dnsmasq[30201]: using nameserver 192.199.0.2#53 +Dec  1 13:21:03 bastion dnsmasq[30201]: using nameserver 127.0.0.1#53 for domain in-addr.arpa +Dec  1 13:21:03 bastion dnsmasq[30201]: using nameserver 127.0.0.1#53 for domain cluster.local +Dec  1 13:21:33 bastion dnsmasq[30201]: setting upstream servers from DBus +Dec  1 13:21:33 bastion dnsmasq[30201]: using nameserver 192.199.0.2#53 +Dec  1 13:21:33 bastion dnsmasq[30201]: using nameserver 127.0.0.1#53 for domain in-addr.arpa +Dec  1 13:21:33 bastion dnsmasq[30201]: using nameserver 127.0.0.1#53 for domain cluster.local +``` + +### Analyzing networking functions + +You may have hundreds of thousands of cloud-native applications to serve business services in a complex networking environment; these may include virtualization, multiple cloud, and hybrid cloud. This means you should analyze whether networking connectivity is working correctly as part of your troubleshooting. Useful commands to figure out networking functions in the Linux server include **ip addr** , **traceroute** , **nslookup** , **dig** , and **ping** , among others. For example, here is output of the **ip addr show** command: + +``` +# ip addr show +1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 +    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 +    inet 127.0.0.1/8 scope host lo +       valid_lft forever preferred_lft forever +    inet6 ::1/128 scope host +       valid_lft forever preferred_lft forever +2: eth0: mtu 9001 qdisc mq state UP group default qlen 1000 +    link/ether 06:af:52:f8:74:98 brd ff:ff:ff:ff:ff:ff +    inet 192.199.0.169/24 brd 192.199.0.255 scope global noprefixroute dynamic eth0 +       valid_lft 3096sec preferred_lft 3096sec +    inet6 fe80::4af:52ff:fef8:7498/64 scope link +       valid_lft forever preferred_lft forever +3: docker0: mtu 1500 qdisc noqueue state DOWN group default +    link/ether 02:42:67:fb:1a:a2 brd ff:ff:ff:ff:ff:ff +    inet 172.17.0.1/16 scope global docker0 +       valid_lft forever preferred_lft forever +    inet6 fe80::42:67ff:fefb:1aa2/64 scope link +       valid_lft forever preferred_lft forever +.... +``` + +### In conclusion + +Troubleshooting Linux hardware requires considerable knowledge, including how to use powerful command-line tools and figure out system loggings. You should also know how to diagnose the kernel space, which is where you can find the root cause of many hardware problems. Keep in mind that hardware issues in Linux may come from many different sources, including devices, modules, drivers, BIOS, networking, and even plain old hardware malfunctions. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/troubleshooting-hardware-problems-linux + +作者:[Daniel Oh][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/daniel-oh +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/18/5/what-linux-server +[2]: https://opensource.com/article/18/11/intro-software-defined-networking +[3]: https://linux.die.net/man/8/lspci +[4]: https://linux.die.net/man/8/lsblk +[5]: https://linux.die.net/man/1/lscpu +[6]: https://linux.die.net/man/8/lsscsi From 22c0afa939413a3215130ae7473ab032742253ea Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 2 Jan 2019 15:53:51 +0800 Subject: [PATCH 157/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Plans=20to=20lear?= =?UTF-8?q?n=20a=20new=20tech=20skill=20in=202019=3F=20What=20you=20need?= =?UTF-8?q?=20to=20know?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ch skill in 2019- What you need to know.md | 145 ++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 sources/talk/20181231 Plans to learn a new tech skill in 2019- What you need to know.md diff --git a/sources/talk/20181231 Plans to learn a new tech skill in 2019- What you need to know.md b/sources/talk/20181231 Plans to learn a new tech skill in 2019- What you need to know.md new file mode 100644 index 0000000000..6ef539df9c --- /dev/null +++ b/sources/talk/20181231 Plans to learn a new tech skill in 2019- What you need to know.md @@ -0,0 +1,145 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Plans to learn a new tech skill in 2019? What you need to know) +[#]: via: (https://opensource.com/article/18/12/tech-skills-online-learning) +[#]: author: (David Clinton https://opensource.com/users/remyd) + +Plans to learn a new tech skill in 2019? What you need to know +====== +Go on a tour of the current state of online technology education. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/learn-programming-code-keyboard.png?itok=xaLyptT4) + +Open source software is, by definition, free. But it can sometimes cost you a king's ransom to learn how to master it. The good news? The open source ethos is alive and well in the education sector, and there are plenty of high-quality learning resources available. You just need to know where to find them. + +This article—adapted from my book, [Solving for Technology: How to quickly learn valuable new skills in a madly changing technology world][1]—offers some thoughts on what's out there and how to get the most out of it. + +How do you learn best—video courses? Hands-on interactive classes? And what are you usually looking for when you go hunting for knowledge—fast fixes to immediate problems? Deep understanding of an entire technology? Quick and dirty getting-starting guides? + +Whatever you're after, you're more likely to find it if you know what's out there. So keep your mind open to the many categories of teaching tools that exist, and join me for a tour of the current state of online technology education. + +### freeCodeCamp + +Most of the heavily edited, peer-reviewed courses available online live behind paywalls—but not all. [freeCodeCamp][2], as its name suggests, is free. And by free, I don't mean the site exists to drive traffic to some revenue-generating web page—it's completely free, simply because its creators believe such opportunities should exist. + +The idea behind freeCodeCamp is that "campers" work their way through realistic projects centered around coding challenges. But this site is different in a few important ways. First, campers are encouraged to join other local campers so they can code in mutually supportive groups. Once they've worked through the Front End, Data Visualization, Back End, or Full Stack certifications, campers are also encouraged to gain real-world experience by coding for non-profits. Finally, freeCodeCamp guides graduates through the job search and interviewing stages of their young careers. + +### YouTube + +Wondering how to change the bulb on the passenger-side brake light on your 2010 Dodge Caravan (3.8L)? There's a YouTube video that'll show you. Need to replace the pressure sensor on your ten-year-old Carrier forced-air natural gas furnace? There's another YouTube video that'll show you how to do that. In fact, there's a selection of YouTube videos that can show you how to do just about anything you can imagine—and a great many things you can't (and perhaps shouldn't). + +Got a specific problem that's blocking your progress? Looking for a bird's eye overview of your next language? Someone out there has probably already been there and recorded the solution in a video. Also, keep an eye out for video authors you like and subscribe to their YouTube channels. That makes it easier to find more useful content. + +Perhaps the most famous and successful YouTube channel of all is Salman Khan's [Khan Academy][3]. Although it's primarily aimed at K-12 students, there's plenty of useful content for people taking their first steps in programming (or physics or electrical engineering, for that matter). + +### Top 4 MOOCs + +The cost of traditional higher education programs has ballooned in recent decades. Currently, a four-year degree in the US can cost about five times the median annual household income in 2016 (around $59,000). Even if your degree ends up earning you an extra $20,000 per year beyond what you would have earned without it, it would still take you more than ten years just to break even (and perhaps many additional years to pay off the actual interest-carrying debt). + +Investments like that might not make a lot of sense. But what if you could get the same knowledge at no cost at all? + +Welcome to the world of the massive open online course (MOOC). A MOOC is a platform through which existing educational institutions deliver course content to anyone on the internet who's interested. + +By joining a MOOC, you can view video recordings of lectures from some of the best professors at elite universities and engage in simulated interactive labs, all at no cost and from the comfort of your own home. In many cases, you can also receive credit or certification for successfully completing a course. Certification often does carry some charges, but they are much lower than what you'd pay for a traditional degree. + +The downside—although not everyone will consider this a downside—is that many university-based MOOCs are less job- and industry-focused and spend more time on general theory. They sometimes also expect you to have already mastered some prerequisite STEM skills. + +Here are four major MOOC portals: + + * [**Coursera**][4]: Taking the 4- to 10-week Coursera courses is free, including quizzes and exercises. But they also offer fee-based add-ons such as assessments, grades, and certification. Specializations are multiple Coursera courses organized into a larger program like Data Science or Deep Learning. To earn a specialization certificate, students must complete a capstone project at the end. Coursera categories include Computer Science, Data Science, and Information Technology. + + * [**edX**][5]: Originally created by MIT and Harvard University, edX is a non-profit organization that delivers courseware created by more than 100 universities and colleges. Students may audit a course for free, or for a reasonable fee, gain verified certificates of completion. + + * [**MIT OpenCourseWare**][6]: OpenCourseWare isn't really a learning platform, and it won't help you much if you're looking for an organized guide through a particular topic. Rather, it's an online repository containing notes, quizzes, and some videos from thousands of MIT courses. The content can give you insights into specific questions, and if you're ambitious and determined enough, you could mine entire topics from the rich resources you'll find. + + * [**Udacity**][7]: I included Udacity in this higher education section because that's where its roots lie. But while the project's founders came from the Stanford University faculty, it was originally something of a rebellion against the high costs and distracting bloat of many university degree programs. Rather than spending four (or more) years studying material that's largely out of sync with the demands of the real job market, it proposes, why not focus on the skills the industry is looking for and get it done in much less time and for a tiny fraction of the cost? + +Udacity currently offers a couple dozen or so nano-degrees that can get to you beyond entry-level competence in some high-demand fields in just a few months. Because the nano-degrees are created with the direct involvement of major industry employers like Amazon, Nvidia, and Google, hard-working graduates have a decent chance of quickly landing a great job. + + + + +### Tips for using the internet + +There's a world of help waiting for you out there. Don't miss it. A few tips: + +#### Learn to compose smart search strings + +Internet search is much more than simply typing a few related words into the search field and hitting Enter. Here are some powerful tips that will work on any major search engine (my personal favorite is [DuckDuckGo][8]): + +#### Use your problem to find a solution + +Thousands of people have worked with the same technology you’re learning, and odds are at least some of them have encountered the same problems you have. And at least a few of those folks will likely have posted their questions to an online user forum like Stack Overflow. The quickest way to find the answers they found is to search using the same language that you encountered. + +Did your problem generate an error message? Paste that exact text into your search engine. Were there any log messages? Post those, too. + +#### Be precise + +The internet has billions of pages, and vague search results are bound to include a lot of false positives, so be as precise as possible. One powerful trick: Enclose your error message in quotation marks, which tells the search engine that you’re looking for an exact phrase rather than a single result containing all or most of the words somewhere on the page. Just don’t be so specific that you end up narrowing your results down to zero. + +As an example, for an entry from the Apache error log like this: + +`[Fri Dec 16 02:15:44 2017] [error] [client 54.211.9.96] Client sent malformed Host header` + +Leave out the date and client IP address because there’s no way anyone else got those exact details. Instead, include only the `"Client sent..."` part (in quotations): + +`"Client sent malformed Host header"` + +If that’s still too broad, consider adding the strings `Apache` and `[error]` outside the quotation marks: + +`"Client sent malformed Host header" apache [error]` + +#### Be timely + +Search engines let you narrow down your search by time. If your problem is specific to a relatively recent release version, restrict your search to only the last week or month. + +#### Search in all the right places + +Sometimes an outside search engine will do a better job searching through a large website than the site’s own internal tool (I’m looking at you, Government of Canada). If you feel the solution to your problem is likely to be somewhere on a particular site—like Stack Overflow’s admin cousin, Server Fault—but you can’t find it, restrict results to only that one site: + +`"gssacceptsec_context(2) failed:" site:serverfault.com` + +#### Leverage public code samples + +Are you stuck in a way that only a developer can be stuck? You've read your code through over and over again and you just can't find the error. You've tried at least a half a dozen different design approaches and even—briefly, mind you—an entirely different language. Nothing. The application isn't working. + +Haunt GitHub and other places where public repositories of code live. They're all searchable and filled with examples of great code. Of course, there will also be plenty of examples of really bad and even malicious code, so keep your guard up. + +Browsing through other people's code is a great way to get new ideas and learn about best practices and coding patterns. If your search engine skills are as good as I'm guessing, then you'll probably uncover working solutions to whatever it is that ails you. + +### More free stuff + +You don't have to do this all by yourself. Before embarking on a significant new learning project, take a good look at your community and government to see what services are available. + +Many governments offer support—both financial and practical—for people looking to upgrade their professional skills. There are also more and more state/provincial governments joining the open textbook movement, where well-written, up-to-date technical textbooks are made freely available on the internet. At this point, the quality of most collections looks a bit spotty, but the long-term goal is to cut the cost of an education by many hundreds of dollars. + +Your company might be willing to sponsor your learning. Many companies provide their employees with accounts to online learning sites; sometimes it's just a matter of asking your boss or HR rep what is available. + +And what about your community? You might be surprised at how many older, experienced professionals are eager to engage in mentoring. It might take a bit of courage, but go ahead and approach someone you admire to see what wisdom and practical guidance they might offer. + +This article was adapted from the book [Solving for Technology: How to quickly learn valuable new skills in a madly changing technology world][1]. As an exclusive offer to the opensource.com community, feel free to [download a PDF version of the full book][9]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/tech-skills-online-learning + +作者:[David Clinton][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/remyd +[b]: https://github.com/lujun9972 +[1]: https://learntech.bootstrap-it.com/ +[2]: https://www.freecodecamp.org/ +[3]: https://www.khanacademy.org/ +[4]: https://www.coursera.org/ +[5]: https://www.edx.org/ +[6]: http://ocw.mit.edu/index.htm +[7]: https://www.udacity.com/ +[8]: https://duckduckgo.com/ +[9]: https://learntech.bootstrap-it.com/download.html From f7d81afde86659949cb61d3c0ada87ef46a475df Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 2 Jan 2019 16:24:29 +0800 Subject: [PATCH 158/322] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E7=BF=BB=E8=AF=91=E7=9A=84=E6=AD=A3=E5=88=99?= =?UTF-8?q?=E8=A1=A8=E8=BE=BE=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/status/status.sh | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/scripts/status/status.sh b/scripts/status/status.sh index 9705c3cbc0..02c46cfc7e 100755 --- a/scripts/status/status.sh +++ b/scripts/status/status.sh @@ -5,13 +5,7 @@ cd "$(dirname "$0")/../.." # 进入TP root function file-translating-p () { local file="$*" - if head -n 1 "${file}" |grep '\[^#\]:'>/dev/null 2>&1 ;then - # 新模板 - head -n 12 "$file" |grep -v '\[^#\]:' |grep -E -i "translat|fanyi|翻译" >/dev/null 2>&1 - else - # 旧模板 - head -n 3 "$file" |grep -E -i "translat|fanyi|翻译" >/dev/null 2>&1 - fi + head -n 3 "$file" | grep -iE "^[^[].*translat|^\[#\]: translator: \([^[:space:]]+\)|fanyi|翻译" >/dev/null 2>&1 } function get_status_of() { From af614d9555cb3f5f8b36e010036ae62fe05494e1 Mon Sep 17 00:00:00 2001 From: Moelf Date: Wed, 2 Jan 2019 18:31:03 +0800 Subject: [PATCH 159/322] Start translating 'managing digital files' --- ...ing Digital Files (e.g., Photographs) in Files and Folders.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20140510 Managing Digital Files (e.g., Photographs) in Files and Folders.md b/sources/tech/20140510 Managing Digital Files (e.g., Photographs) in Files and Folders.md index d1fd01ef0c..9a5c691e42 100644 --- a/sources/tech/20140510 Managing Digital Files (e.g., Photographs) in Files and Folders.md +++ b/sources/tech/20140510 Managing Digital Files (e.g., Photographs) in Files and Folders.md @@ -1,3 +1,4 @@ +Moelf translating Managing Digital Files (e.g., Photographs) in Files and Folders ====== Update 2014-05-14: added real world example From ed00d6951e5f73290c493129d587f45a21d45d64 Mon Sep 17 00:00:00 2001 From: WangYue <815420852@qq.com> Date: Wed, 2 Jan 2019 19:53:17 +0800 Subject: [PATCH 160/322] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90=20?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=8E=9F=E6=96=87=2020180625=208=20reasons?= =?UTF-8?q?=20to=20use=20the=20Xfce=20Linux=20desktop=20environment.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 翻译完成 删除原文 20180625 8 reasons to use the Xfce Linux desktop environment.md --- ... use the Xfce Linux desktop environment.md | 87 ------------------- 1 file changed, 87 deletions(-) delete mode 100644 sources/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md diff --git a/sources/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md b/sources/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md deleted file mode 100644 index 974faa1f75..0000000000 --- a/sources/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md +++ /dev/null @@ -1,87 +0,0 @@ -translating by WangYueScream -=========================== -8 reasons to use the Xfce Linux desktop environment -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_penguin_green.png?itok=ENdVzW22) - -For several reasons (including curiosity), a few weeks ago I started using [Xfce][1] as my Linux desktop. One reason was trouble with background daemons eating up all the CPU and I/O bandwidth on my very powerful main workstation. Of course, some of the instability may be due to my removal of some of the RPM packages that provide those background daemons. However, even before I removed the RPMs, the fact is KDE was unstable and causing performance and stability issues. I needed to use a different desktop to avoid these problems. - -I realized in looking back over my series of articles on Linux desktops that I had neglected Xfce. This article is intended to rectify that oversight. I like Xfce a lot and am enjoying the speed and lightness of it more than I thought I would. - -As part of my research, I googled to try to learn what Xfce means. There is a historical reference to XForms Common Environment, but Xfce no longer uses the XForms tools. Some years ago, I found a reference to "Xtra fine computing environment," and I like that a lot. I will use that (despite not being able to find the page reference again). - -### Eight reasons for recommending Xfce - -#### 1\. Lightweight construction - -Xfce has a very small memory footprint and CPU usage compared to some other desktops, such as KDE and GNOME. On my system, the programs that make up the Xfce desktop take a tiny amount of memory for such a powerful desktop. Very low CPU usage is also a hallmark of the Xfce desktop. With such a small memory footprint, I am not especially surprised that Xfce is also very sparing of CPU cycles. - -#### 2\. Simplicity - -The Xfce desktop is simple and uncluttered with fluff. The basic desktop has two panels and a vertical line of icons on the left side. Panel 0 is at the bottom and consists of some basic application launchers, as well as the Applications icon, which provides access to all the applications on the system. Panel 1 is at the top and has an Applications launcher as well as a Workspace Switcher that allows the user to switch between multiple workspaces. The panels can be modified with additional items, such as new launchers, or by altering their height and width. - -The icons down the left side of the desktop consist of the Home directory and Trash icons. It can also display icons for the complete filesystem directory tree and any connected pluggable USB storage devices. These icons can be used to mount and unmount the device, as well as to open the default file manager. They can also be hidden if you prefer, and the Filesystem, Trash, and Home directory icons are separately controllable. The removable drives can be hidden or displayed as a group. - -#### 3\. File management - -Thunar, Xfce's default file manager, is simple, easy to use and configure, and very easy to learn. While not as fancy as file managers like Konqueror or Dolphin, it is quite capable and very fast. Thunar can't create multiple panes in its window, but it does provide tabs so multiple directories can be open at the same time. Thunar also has a very nice sidebar that, like the desktop, shows the same icons for the complete filesystem directory tree and any connected USB storage devices. Devices can be mounted and unmounted, and removable media such as CDs can be ejected. Thunar can also use helper applications such as Ark to open archive files when they are clicked. Archives, such as ZIP, TAR, and RPM files, can be viewed, and individual files can be copied out of them. - - -![Xfce desktop][3] - -The Xfce desktop with Thunar and the Xfce terminal emulator. - -Having used many different applications for my [series on file managers][4], I must say that I like Thunar for its simplicity and ease of use. It is easy to navigate the filesystem using the sidebar. - -#### 4\. Stability - -The Xfce desktop is very stable. New releases seem to be on a three-year cycle, although updates are provided as necessary. The current version is 4.12, which was released in February 2015. The rock-solid nature of the Xfce desktop is very reassuring after having issues with KDE. The Xfce desktop has never crashed for me, and it has never spawned daemons that gobbled up system resources. It just sits there and works—which is what I want. - -#### 5\. Elegance - -Xfce is simply elegant. In my new book, The Linux Philosophy for SysAdmins, which will be available this fall, I talk about the many advantages of simplicity, including the fact that simplicity is one of the hallmarks of elegance. Clearly, the programmers who write and maintain Xfce and its component applications are great fans of simplicity. This simplicity is very likely the reason that Xfce is so stable, but it also results in a clean look, a responsive interface, an easily navigable structure that feels natural, and an overall elegance that makes it a pleasure to use. - -#### 6\. Terminal emulation - -The Xfce4 terminal emulator is a powerful emulator that uses tabs to allow multiple terminals in a single window, like many other terminal emulators. This terminal emulator is simple compared to emulators like Tilix, Terminator, and Konsole, but it gets the job done. The tab names can be changed, and the tabs can be rearranged by drag and drop, using the arrow icons on the toolbar, or selecting the options on the menu bar. One thing I especially like about the tabs on the Xfce terminal emulator is that they display the name of the host to which they are connected regardless of how many other hosts are connected through to make that connection, e.g., `host1==>host2==>host3==>host4` properly shows `host4` in the tab. Other emulators show `host2` at best. - -Other aspects of its function and appearance can be easily configured to suit your needs. Like other Xfce components, this terminal emulator uses very little in the way of system resources. - -#### 7\. Configurability - -Within its limits, Xfce is very configurable. While not offering as much configurability as a desktop like KDE, it is far more configurable (and more easily so) than GNOME, for example. I found that the Settings Manager is the doorway to everything needed to configure Xfce. The individual configuration apps are separately available, but the Settings Manager collects them all into one window for ease of access. All the important aspects of the desktop can be configured to meet my needs and preferences. - -#### 8\. Modularity - -Xfce has a number of individual projects that make up the whole, and not all parts of Xfce are necessarily installed by your distro. [Xfce's projects][5] page lists the main projects, so you can find additional parts you might want to install. The items that weren't installed on my Fedora 28 workstation when I installed the Xfce group were mostly the applications at the bottom of that page. - -There is also a [documentation page][6], and a wiki called [Xfce Goodies Project][7] lists other Xfce-related projects that provide applications, artwork, and plugins for Thunar and the Xfce panels. - -### Conclusions - -The Xfce desktop is thin and fast with an overall elegance that makes it easy to figure out how to do things. Its lightweight construction conserves both memory and CPU cycles. This makes it ideal for older hosts with few resources to spare for a desktop. However, Xfce is flexible and powerful enough to satisfy my needs as a power user. - -I've learned that changing to a new Linux desktop can take some work to configure it as I want—with all of my favorite application launchers on the panel, my preferred wallpaper, and much more. I have changed to new desktops or updates of old ones many times over the years. It takes some time and a bit of patience. - -I think of it like when I've moved cubicles or offices at work. Someone carries my stuff from the old office to the new one, and I connect my computer, unpack the boxes, and place their contents in appropriate locations in my new office. Moving into the Xfce desktop was the easiest move I have ever made. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/6/xfce-desktop - -作者:[David Both][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://opensource.com/users/dboth -[1]:https://xfce.org/ -[2]:/file/401856 -[3]:https://opensource.com/sites/default/files/uploads/xfce-desktop-01.png (Xfce desktop) -[4]:https://opensource.com/sitewide-search?search_api_views_fulltext=David%20Both%20File%20managers -[5]:https://xfce.org/projects -[6]:https://docs.xfce.org/ -[7]:https://goodies.xfce.org/ From bbf8e7753377199da8fdb580cee809ab4638cfa1 Mon Sep 17 00:00:00 2001 From: WangYue <815420852@qq.com> Date: Wed, 2 Jan 2019 19:54:36 +0800 Subject: [PATCH 161/322] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AF=91=E6=96=87=2020180625=208=20reasons?= =?UTF-8?q?=20to=20use=20the=20Xfce=20Linux=20desktop=20environment.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 翻译完成 添加译文 20180625 8 reasons to use the Xfce Linux desktop environment.md --- ... use the Xfce Linux desktop environment.md | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 translated/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md diff --git a/translated/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md b/translated/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md new file mode 100644 index 0000000000..e625f12f5c --- /dev/null +++ b/translated/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md @@ -0,0 +1,98 @@ + + +使用 Xfce Linux 桌面环境的 8 个理由 +============================ + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_penguin_green.png?itok=ENdVzW22) + + +由于某些原因(也包括好奇),几周前我开始使用 [Xfce][1] 作为我的 Linux 桌面。促使我更换 Linux 桌面环境的原因之一是桌面相关的守护进程占据了我的性能非常强大的主工作站的绝大部分 CPU 资源和 I/O 带宽。当然,有些不稳定性可能是因为我删除了提供这些守护进程的 RPM 包。然而,事实是在我删除这些 RPM 包之前,KDE 就已经很不稳定了而且还导致了一系列其他方面的性能和稳定性问题。所以我需要换一个桌面来避免这些问题。 + + +在回顾了我为 Linux 桌面所写的一系列文章后我才意识到我忽略了 Xfce。这篇文章也是力图能够纠正弥补这个疏忽。我非常喜欢 Xfce 也很享受它所带给我超乎预期的快速、轻量的体验。 + + +作为研究的一部分,我有尝试过在 Google 上查询 Xfce 对应什么意思。有个历史参考是它对应着 XForms Common Environment,但 Xfce 早已不在使用 XForms 工具。几年前,我找到另一个参考是 "Xtra fine computing environment" 而且我也很喜欢这个解释。我将会用它作为 Xfce 的全称(尽管再也找不到这个参考页面)。 + + +### 推荐 Xfce 的 8 个理由 + + +#### 1\. 轻量级架构 + +Xfce 相对于其他的桌面如 KDE 和 GNOME,不管是内存还是 CPU 的占用率都非常小。在我的系统中,组成 Xfce 桌面的程序仅占用了少量内存就构成一个如此强大的桌面。超低的 CPU 占用率也是 Xfce 桌面的一个特点。了解到 Xfce 内存占用特别低后,我对它的 CPU 占用率也非常低这个特性自然而言也就不感到奇怪了。 + +#### 2\. 简洁 + +Xfce 桌面很简单就像绒毛整洁的动物让人一目了然赏心悦目。基础的桌面有两个面板和一条在左边垂直的图标行。面板 0 是在底部并由一些基础的应用启动程序和能访问到系统里对应程序的图标组成。面板 1 是在顶部由一个应用程序启动器和一个能够允许用户在多个工作区之间来回切换的工作区切换器组成。面板可以通过补充项自定义修改比如增加个新的应用启动器或者更改它们的宽高。 + +桌面左侧的图标对应是家目录和垃圾桶。它也可以显示其他的图标如完整的文件系统目录树和任意已连接上系统的可插拔的 USB 存储设备。这些图标可以用来挂载和卸载设备也可以用来打开默认的文件管理器。如果你愿意,它们都可以被隐藏同时文件系统,垃圾箱,家目录对应的图标都可以逐个控制管理。所有的可移动设备也可以被隐藏或作为一个组显示。 + +#### 3\. 文件管理 + +作为 Xfce 的默认文件管理器 Thunar,它很简单,既易于使用和配置也非常容易学习。尽管它并不像其他的文件管理器比如 Konqueror 或者 Dolphin 那样效果华丽,但它很强大也很快。Thunar 并不能在一个窗口里面打开并产生多个窗口但它提供了选项卡来支持多个目录的同时打开。Thunar 也有一个非常漂亮的侧边栏就像桌面那样能够显示完整的文件系统目录树和所有已连接的 USB 存储设备。设备能够被挂载和卸载,可移动媒介如 CD 也能够被弹出。Thunar 也可以使用类似 Ark 这种帮助软件来在你点击归档文件的时候打开它们。比如 ZIP,TAR,RPM 这种归档文件都可以被浏览也可以从中复制单个文件。 + +![Xfce desktop][3] + +Xfce 桌面及 Thunar 和 Xfce 下的终端模拟器。 + +在我的[文件管理器系列][4]一文中,我已经使用体验过很多不同的文件管理器软件,我不得不说 Thunar 的简单易用让你无法不喜欢上它。它很容易帮助你通过使用侧边栏来浏览文件系统。 + + +#### 4\. 稳定 + +Xfce 桌面非常稳定。新版本的发布周期似乎是三年,但也会根据需要发布相关更新。最新的版本是于 2015 年 2 月发布的 4.12。在使用 KDE 遇到一系列问题后稳如磐石的 Xfce 桌面环境显得让人格外放心。在我使用 Xfce 的过程中,它从来没有崩溃过,也不会产生额外的守护进程占据过多的系统资源。这正是我想要的—它安安静静地工作,不会给你带来额外的困扰。 + + +#### 5\. 优雅 + +Xfce 简单优雅。在我的新书,The Linux Philosophy for SysAdmins 中我谈到了关于简单的一系列好处包括事实上简单也是优雅的诸多标志之一。很明确能够确定的就是 Xfce 及相关组件程序的开发者和维护者也是极力推崇简单至上。这种简单特性很可能也是 Xfce 如此稳定的主要原因,但它也用户带来了一个整洁的桌面外观,一个反应灵敏的操作界面,一个会让人感觉很自然也很易用的导航结构,而且 Xfce 整体上的优雅特性也会让用户的使用过程中充满愉悦感。 + + +#### 6\. 终端仿真程序 + +Xfce4 的终端仿真程序非常强大而且和其他很多终端仿真程序一样可以允许你使用多个选项卡来让多个终端在一个单独窗口里共存。尽管它与 Tilix,Terminator,Konsole 这种终端仿真程序比起来相对简陋,但它也能很好的完成工作。选项卡的名字可以更改,而且选项卡也可以通过拖放或者工具栏的箭头图标或者菜单栏的选项重新排列。我特别喜欢 Xfce 的终端仿真程序的一点就是不管你连接了多少主机,相对应的选项卡都会显示对应的主机名,比如 `host1==>host2==>host3==>host4` 准确地在选项卡显示了 `host4`。但其他的终端仿真程序最多也就显示 `host2`。 + +至于这个终端仿真程序功能和外观的其他方面都可以根据你的需要很容易配置成你想要的。当然同 Xfce 的其他组件一样,这款终端仿真程序占用了系统资源的很少一部分。 + + +#### 7\. 可配置性 + +Xfce 能够配置的范围极大。虽然 Xfce 桌面的可配置性比不上 KDE,但依旧远超 GNOME 了而且比它更容易配置。比如,我发现设置管理器是 Xfce 配置一切的入口。虽然每个配置程序都可以单独使用,但是设置管理器把他们都放在一个窗口里以便快速访问。关于 Xfce 桌面很多重要的部分都可以通过配置来满足我的需求。 + + +#### 8\. 模块化 + +Xfce 是由一系列单个的项目组成的整体,而且在你的 Linux 桌面发行版中也未必安装了 Xfce 的所有组件。[Xfce's projects][5] 的主页列出了主要的项目,所以你可以根据需要安装你想安装的额外组件。比如在我的 Fedora 28 workstation 版本上我安装的 Xfce 桌面就没有 [Xfce's projects][5] 页最下面的说明的一些程序。 + +这里还有个关于 Xfce 的 [documentation page][6] 和 一个被称为 [Xfce Goodies Project][7] 的 wiki 列举了其他的 Xfce 相关的项目,它们为 Xfce 的面板 及 Thunar 提供了很多不错的应用程序,精美的插图,好用的插件。 + + +### 总结 + +整体上很优雅的 Xfce 桌面所具备的足够轻巧和快速的特性能够让它很容易清楚如何做好一件事。它的轻量级的结构也节省了大量的 CPU 和 内存资源。这也使得 Xfce 非常适合那种由于硬件有限无法分配给桌面太多资源的旧主机。然而,Xfce 又是足够的灵活和强大能够满足高级用户的需要。 + +我已经了解到更换到一个新的 Linux 桌面环境需要你自己按照你想要的做些对应的自定义设置—比如面板上显示你最爱用的程序对应的启动器,设置下你最喜欢的桌面背景壁纸等一系列工作。这些年来我已经在切换到新桌面环境或更新旧桌面环境折腾很多次了。这需要时间也需要耐心。 + +我觉得切换 Linux 的桌面环境就像我在工作中换个办公工位或者办公室一样。别人把我的东西装箱从旧办公室搬到新办公室,然后我在我的新办公室里组装连接好我的电脑,打开箱子再把里面的东西放在合适的位置。而切换到 Xfce 桌面大概就是我做过的最简单省事容易的桌面环境更换了。 + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/6/xfce-desktop + +作者:[David Both][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[WangYueScream](https://github.com/WangYueScream) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/dboth +[1]:https://xfce.org/ +[2]:/file/401856 +[3]:https://opensource.com/sites/default/files/uploads/xfce-desktop-01.png (Xfce desktop) +[4]:https://opensource.com/sitewide-search?search_api_views_fulltext=David%20Both%20File%20managers +[5]:https://xfce.org/projects +[6]:https://docs.xfce.org/ +[7]:https://goodies.xfce.org/ From 7ea9c4c23734b343f5ad5533863989373cefe7c0 Mon Sep 17 00:00:00 2001 From: fuowang <19955913+fuowang@users.noreply.github.com> Date: Wed, 2 Jan 2019 21:30:54 +0800 Subject: [PATCH 162/322] =?UTF-8?q?fuowang=20=E7=BF=BB=E8=AF=91=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...402 An introduction to the Flask Python web app framework.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20180402 An introduction to the Flask Python web app framework.md b/sources/tech/20180402 An introduction to the Flask Python web app framework.md index 4b07338bc5..ffb6e9c441 100644 --- a/sources/tech/20180402 An introduction to the Flask Python web app framework.md +++ b/sources/tech/20180402 An introduction to the Flask Python web app framework.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (fuowang) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: subject: (An introduction to the Flask Python web app framework) From 8f234919669be32bb303fba9a6e164482b94a462 Mon Sep 17 00:00:00 2001 From: Bestony Date: Wed, 2 Jan 2019 21:59:13 +0800 Subject: [PATCH 163/322] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...5 Build an interactive CLI with Node.js.md | 533 ----------------- ...5 Build an interactive CLI with Node.js.md | 542 ++++++++++++++++++ 2 files changed, 542 insertions(+), 533 deletions(-) delete mode 100644 sources/tech/20180725 Build an interactive CLI with Node.js.md create mode 100644 translated/tech/20180725 Build an interactive CLI with Node.js.md diff --git a/sources/tech/20180725 Build an interactive CLI with Node.js.md b/sources/tech/20180725 Build an interactive CLI with Node.js.md deleted file mode 100644 index e491993808..0000000000 --- a/sources/tech/20180725 Build an interactive CLI with Node.js.md +++ /dev/null @@ -1,533 +0,0 @@ -bestony translating - -Build an interactive CLI with Node.js -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_keyboard_coding.png?itok=E0Vvam7A) - -Node.js can be very useful when it comes to building command-line interfaces (CLIs). In this post, I'll teach you how to use [Node.js][1] to build a CLI that asks some questions and creates a file based on the answers. - -### Get started - -Let's start by creating a brand new [npm][2] package. (Npm is the JavaScript package manager.) -``` -mkdir my-script - -cd my-script - -npm init - -``` - -Npm will ask some questions. After that, we need to install some packages. -``` -npm install --save chalk figlet inquirer shelljs - -``` - -Here's what these packages do: - - * **Chalk:** Terminal string styling done right - * **Figlet:** A program for making large letters out of ordinary text - * **Inquirer:** A collection of common interactive command-line user interfaces - * **ShellJS:** Portable Unix shell commands for Node.js - - - -### Make an index.js file - -Now we'll create an `index.js` file with the following content: -``` -#!/usr/bin/env node - - - -const inquirer = require("inquirer"); - -const chalk = require("chalk"); - -const figlet = require("figlet"); - -const shell = require("shelljs"); - -``` - -### Plan the CLI - -It's always good to plan what a CLI needs to do before writing any code. This CLI will do just one thing: **create a file**. - -The CLI will ask two questions—what is the filename and what is the extension?—then create the file, and show a success message with the created file path. -``` -// index.js - - - -const run = async () => { - -  // show script introduction - -  // ask questions - -  // create the file - -  // show success message - -}; - - - -run(); - -``` - -The first function is the script introduction. Let's use `chalk` and `figlet` to get the job done. -``` -const init = () => { - -  console.log( - -    chalk.green( - -      figlet.textSync("Node JS CLI", { - -        font: "Ghost", - -        horizontalLayout: "default", - -        verticalLayout: "default" - -      }) - -    ) - -  ); - -} - - - -const run = async () => { - -  // show script introduction - -  init(); - - - -  // ask questions - -  // create the file - -  // show success message - -}; - - - -run(); - -``` - -Second, we'll write a function that asks the questions. -``` -const askQuestions = () => { - -  const questions = [ - -    { - -      name: "FILENAME", - -      type: "input", - -      message: "What is the name of the file without extension?" - -    }, - -    { - -      type: "list", - -      name: "EXTENSION", - -      message: "What is the file extension?", - -      choices: [".rb", ".js", ".php", ".css"], - -      filter: function(val) { - -        return val.split(".")[1]; - -      } - -    } - -  ]; - -  return inquirer.prompt(questions); - -}; - - - -// ... - - - -const run = async () => { - -  // show script introduction - -  init(); - - - -  // ask questions - -  const answers = await askQuestions(); - -  const { FILENAME, EXTENSION } = answers; - - - -  // create the file - -  // show success message - -}; - -``` - -Notice the constants FILENAME and EXTENSIONS that came from `inquirer`. - -The next step will create the file. -``` -const createFile = (filename, extension) => { - -  const filePath = `${process.cwd()}/${filename}.${extension}` - -  shell.touch(filePath); - -  return filePath; - -}; - - - -// ... - - - -const run = async () => { - -  // show script introduction - -  init(); - - - -  // ask questions - -  const answers = await askQuestions(); - -  const { FILENAME, EXTENSION } = answers; - - - -  // create the file - -  const filePath = createFile(FILENAME, EXTENSION); - - - -  // show success message - -}; - -``` - -And last but not least, we'll show the success message along with the file path. -``` -const success = (filepath) => { - -  console.log( - -    chalk.white.bgGreen.bold(`Done! File created at ${filepath}`) - -  ); - -}; - - - -// ... - - - -const run = async () => { - -  // show script introduction - -  init(); - - - -  // ask questions - -  const answers = await askQuestions(); - -  const { FILENAME, EXTENSION } = answers; - - - -  // create the file - -  const filePath = createFile(FILENAME, EXTENSION); - - - -  // show success message - -  success(filePath); - -}; - -``` - -Let's test the script by running `node index.js`. Here's what we get: - -### The full code - -Here is the final code: -``` -#!/usr/bin/env node - - - -const inquirer = require("inquirer"); - -const chalk = require("chalk"); - -const figlet = require("figlet"); - -const shell = require("shelljs"); - - - -const init = () => { - -  console.log( - -    chalk.green( - -      figlet.textSync("Node JS CLI", { - -        font: "Ghost", - -        horizontalLayout: "default", - -        verticalLayout: "default" - -      }) - -    ) - -  ); - -}; - - - -const askQuestions = () => { - -  const questions = [ - -    { - -      name: "FILENAME", - -      type: "input", - -      message: "What is the name of the file without extension?" - -    }, - -    { - -      type: "list", - -      name: "EXTENSION", - -      message: "What is the file extension?", - -      choices: [".rb", ".js", ".php", ".css"], - -      filter: function(val) { - -        return val.split(".")[1]; - -      } - -    } - -  ]; - -  return inquirer.prompt(questions); - -}; - - - -const createFile = (filename, extension) => { - -  const filePath = `${process.cwd()}/${filename}.${extension}` - -  shell.touch(filePath); - -  return filePath; - -}; - - - -const success = filepath => { - -  console.log( - -    chalk.white.bgGreen.bold(`Done! File created at ${filepath}`) - -  ); - -}; - - - -const run = async () => { - -  // show script introduction - -  init(); - - - -  // ask questions - -  const answers = await askQuestions(); - -  const { FILENAME, EXTENSION } = answers; - - - -  // create the file - -  const filePath = createFile(FILENAME, EXTENSION); - - - -  // show success message - -  success(filePath); - -}; - - - -run(); - -``` - -### Use the script anywhere - -To execute this script anywhere, add a `bin` section in your `package.json` file and run `npm link`. -``` -{ - -  "name": "creator", - -  "version": "1.0.0", - -  "description": "", - -  "main": "index.js", - -  "scripts": { - -    "test": "echo \"Error: no test specified\" && exit 1", - -    "start": "node index.js" - -  }, - -  "author": "", - -  "license": "ISC", - -  "dependencies": { - -    "chalk": "^2.4.1", - -    "figlet": "^1.2.0", - -    "inquirer": "^6.0.0", - -    "shelljs": "^0.8.2" - -  }, - -  "bin": { - -    "creator": "./index.js" - -  } - -} - -``` - -Running `npm link` makes this script available anywhere. - -That's what happens when you run this command: -``` -/usr/bin/creator -> /usr/lib/node_modules/creator/index.js - -/usr/lib/node_modules/creator -> /home/hugo/code/creator - -``` - -It links the `index.js` file as an executable. This is only possible because of the first line of the CLI script: `#!/usr/bin/env node`. - -Now we can run this script by calling: -``` -$ creator - -``` - -### Wrapping up - -As you can see, Node.js makes it very easy to build nice command-line tools! If you want to go even further, check this other packages: - - * [meow][3] – a simple command-line helper - * [yargs][4] – a command-line opt-string parser - * [pkg][5] – package your Node.js project into an executable - - - -Tell us about your experience building a CLI in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/7/node-js-interactive-cli - -作者:[Hugo Dias][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://opensource.com/users/hugodias -[1]:https://nodejs.org/en/ -[2]:https://www.npmjs.com/ -[3]:https://github.com/sindresorhus/meow -[4]:https://github.com/yargs/yargs -[5]:https://github.com/zeit/pkg diff --git a/translated/tech/20180725 Build an interactive CLI with Node.js.md b/translated/tech/20180725 Build an interactive CLI with Node.js.md new file mode 100644 index 0000000000..8a7ff8f77f --- /dev/null +++ b/translated/tech/20180725 Build an interactive CLI with Node.js.md @@ -0,0 +1,542 @@ +使用 Node.js 构建交互式 CLI +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_keyboard_coding.png?itok=E0Vvam7A) + + +当用于构建命令行界面(CLIs)时,Node.js变得十分的有用。在这篇文章中,我将会教你如何使用 [Node.js][1] 来构建一个问一些问题并基于回答创建一个文件 CLI。 + +### 开始 + +首先,创建一个新的 [npm][2] 包(NPM 是 JavaScript 包管理器)。 +``` +mkdir my-script + +cd my-script + +npm init + +``` + + +NPM 将会问一些问题。随后,我们需要安装一些 Packages。 + +``` +npm install --save chalk figlet inquirer shelljs + +``` + + +这是我们需要的 packages: + + * **Chalk:** 正确的设定终端的字符样式 + * **Figlet:** 使用普通字符制作大字母的程序(译者注:使用标准字符,拼凑出图片) + * **Inquirer:** 通用交互式命令行用户界面的集合 + * **ShellJS:** Node.js 版本的可移植 Unix Shell 命令行工具 + + + +### 创建一个 index.js 文件 + +现在我们要使用下述内容创建一个 `index.js` 文件。 +``` +#!/usr/bin/env node + + + +const inquirer = require("inquirer"); + +const chalk = require("chalk"); + +const figlet = require("figlet"); + +const shell = require("shelljs"); + +``` + +### 规划 CLI + +在我们写 CLI 所需的任何代码之前,做计划总是很棒的。这个 Cli 只做一件事:**创建一个文件** + +这个 CLI 将会问两个问题:文件名是什么以及文件后缀名是什么?然后创建文件,并展示一个包含了所创建文件路径的成功信息。 + +``` +// index.js + + + +const run = async () => { + + // show script introduction + + // ask questions + + // create the file + + // show success message + +}; + + + +run(); + +``` + +第一个函数是脚本的介绍。让我们使用 `chalk` 和 `figlet` 来完成这项工作。 +``` +const init = () => { + + console.log( + + chalk.green( + + figlet.textSync("Node JS CLI", { + + font: "Ghost", + + horizontalLayout: "default", + + verticalLayout: "default" + + }) + + ) + + ); + +} + + + +const run = async () => { + + // show script introduction + + init(); + + + + // ask questions + + // create the file + + // show success message + +}; + + + +run(); + +``` + +然后,我们来写一个函数来问问题。 +``` +const askQuestions = () => { + + const questions = [ + + { + + name: "FILENAME", + + type: "input", + + message: "What is the name of the file without extension?" + + }, + + { + + type: "list", + + name: "EXTENSION", + + message: "What is the file extension?", + + choices: [".rb", ".js", ".php", ".css"], + + filter: function(val) { + + return val.split(".")[1]; + + } + + } + + ]; + + return inquirer.prompt(questions); + +}; + + + +// ... + + + +const run = async () => { + + // show script introduction + + init(); + + + + // ask questions + + const answers = await askQuestions(); + + const { FILENAME, EXTENSION } = answers; + + + + // create the file + + // show success message + +}; + +``` + +注意,常量 FILENAME 和 EXTENSIONS 来自 `inquirer` 包。 + +下一步将会创建文件。 +``` +const createFile = (filename, extension) => { + + const filePath = `${process.cwd()}/${filename}.${extension}` + + shell.touch(filePath); + + return filePath; + +}; + + + +// ... + + + +const run = async () => { + + // show script introduction + + init(); + + + + // ask questions + + const answers = await askQuestions(); + + const { FILENAME, EXTENSION } = answers; + + + + // create the file + + const filePath = createFile(FILENAME, EXTENSION); + + + + // show success message + +}; + +``` + +最后,重要的是,我们将展示成功信息以及文件路径。 + +``` +const success = (filepath) => { + + console.log( + + chalk.white.bgGreen.bold(`Done! File created at ${filepath}`) + + ); + +}; + + + +// ... + + + +const run = async () => { + + // show script introduction + + init(); + + + + // ask questions + + const answers = await askQuestions(); + + const { FILENAME, EXTENSION } = answers; + + + + // create the file + + const filePath = createFile(FILENAME, EXTENSION); + + + + // show success message + + success(filePath); + +}; + +``` + + +来让我们通过运行 `node index.js` 来测试这个脚本,这是我们得到的: + +### 完整代码 + +下述代码为完整代码: +``` +#!/usr/bin/env node + + + +const inquirer = require("inquirer"); + +const chalk = require("chalk"); + +const figlet = require("figlet"); + +const shell = require("shelljs"); + + + +const init = () => { + + console.log( + + chalk.green( + + figlet.textSync("Node JS CLI", { + + font: "Ghost", + + horizontalLayout: "default", + + verticalLayout: "default" + + }) + + ) + + ); + +}; + + + +const askQuestions = () => { + + const questions = [ + + { + + name: "FILENAME", + + type: "input", + + message: "What is the name of the file without extension?" + + }, + + { + + type: "list", + + name: "EXTENSION", + + message: "What is the file extension?", + + choices: [".rb", ".js", ".php", ".css"], + + filter: function(val) { + + return val.split(".")[1]; + + } + + } + + ]; + + return inquirer.prompt(questions); + +}; + + + +const createFile = (filename, extension) => { + + const filePath = `${process.cwd()}/${filename}.${extension}` + + shell.touch(filePath); + + return filePath; + +}; + + + +const success = filepath => { + + console.log( + + chalk.white.bgGreen.bold(`Done! File created at ${filepath}`) + + ); + +}; + + + +const run = async () => { + + // show script introduction + + init(); + + + + // ask questions + + const answers = await askQuestions(); + + const { FILENAME, EXTENSION } = answers; + + + + // create the file + + const filePath = createFile(FILENAME, EXTENSION); + + + + // show success message + + success(filePath); + +}; + + + +run(); + +``` + +### 在任何地方使用这个脚本 + +To execute this script anywhere, add a `bin` section in your `package.json` file and run `npm link`. +想要在任何地方执行这个脚本,在你的 `package.json` 文件中添加一个 `bin` 部分,并执行 `npm link` +``` +{ + + "name": "creator", + + "version": "1.0.0", + + "description": "", + + "main": "index.js", + + "scripts": { + + "test": "echo \"Error: no test specified\" && exit 1", + + "start": "node index.js" + + }, + + "author": "", + + "license": "ISC", + + "dependencies": { + + "chalk": "^2.4.1", + + "figlet": "^1.2.0", + + "inquirer": "^6.0.0", + + "shelljs": "^0.8.2" + + }, + + "bin": { + + "creator": "./index.js" + + } + +} + +``` + + +执行 `npm link` 使得这个脚本可以在任何地方调用。 + +这就是是当你运行这个命令时会发生的事情。 + +``` +/usr/bin/creator -> /usr/lib/node_modules/creator/index.js + +/usr/lib/node_modules/creator -> /home/hugo/code/creator + +``` + + +这会连接 `index.js` 作为一个可执行文件。这是完全可能的,因为这个 CLI 脚本的第一行是 `#!/usr/bin/env node`。 + + +现在我们可以通过执行如下命令来调用。 +``` +$ creator + +``` + +### 总结 + +正如你所看到的,Node.js 使得构建一个好的命令行工具变得非常简单。如果你希望了解更多内容,查看下列包。 + + * [meow][3] – 一个简单的命令行助手工具 + * [yargs][4] – 一个命令行参数 opts 解析工具 + * [pkg][5] – 将你的 Node.js 程序包装在一个可执行文件中。 + + +在评论中留下你关于构建 CLI 的经验吧! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/7/node-js-interactive-cli + +作者:[Hugo Dias][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[bestony](https://github.com/bestony) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/hugodias +[1]:https://nodejs.org/en/ +[2]:https://www.npmjs.com/ +[3]:https://github.com/sindresorhus/meow +[4]:https://github.com/yargs/yargs +[5]:https://github.com/zeit/pkg From 09cb0fcfed852713c839983726cba29d2716ae3a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 2 Jan 2019 23:23:13 +0800 Subject: [PATCH 164/322] PRF:20180725 Build an interactive CLI with Node.js.md @bestony --- ...5 Build an interactive CLI with Node.js.md | 273 +++--------------- 1 file changed, 33 insertions(+), 240 deletions(-) diff --git a/translated/tech/20180725 Build an interactive CLI with Node.js.md b/translated/tech/20180725 Build an interactive CLI with Node.js.md index 8a7ff8f77f..d2e6d1d52b 100644 --- a/translated/tech/20180725 Build an interactive CLI with Node.js.md +++ b/translated/tech/20180725 Build an interactive CLI with Node.js.md @@ -1,527 +1,320 @@ -使用 Node.js 构建交互式 CLI +使用 Node.js 构建交互式命令行工具 ====== +> 使用 Node.js 构建一个根据询问创建文件的命令行工具。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_keyboard_coding.png?itok=E0Vvam7A) - -当用于构建命令行界面(CLIs)时,Node.js变得十分的有用。在这篇文章中,我将会教你如何使用 [Node.js][1] 来构建一个问一些问题并基于回答创建一个文件 CLI。 +当用于构建命令行界面(CLI)时,Node.js 十分有用。在这篇文章中,我将会教你如何使用 [Node.js][1] 来构建一个问一些问题并基于回答创建一个文件的命令行工具。 ### 开始 首先,创建一个新的 [npm][2] 包(NPM 是 JavaScript 包管理器)。 + ``` mkdir my-script - cd my-script - npm init - ``` - -NPM 将会问一些问题。随后,我们需要安装一些 Packages。 +NPM 将会问一些问题。随后,我们需要安装一些包。 ``` npm install --save chalk figlet inquirer shelljs - ``` +这是我们需要的包: -这是我们需要的 packages: - - * **Chalk:** 正确的设定终端的字符样式 - * **Figlet:** 使用普通字符制作大字母的程序(译者注:使用标准字符,拼凑出图片) - * **Inquirer:** 通用交互式命令行用户界面的集合 - * **ShellJS:** Node.js 版本的可移植 Unix Shell 命令行工具 - - + * Chalk:正确设定终端的字符样式 + * Figlet:使用普通字符制作大字母的程序(LCTT 译注:使用标准字符,拼凑出图片) + * Inquirer:通用交互式命令行用户界面的集合 + * ShellJS:Node.js 版本的可移植 Unix Shell 命令行工具 ### 创建一个 index.js 文件 现在我们要使用下述内容创建一个 `index.js` 文件。 + ``` #!/usr/bin/env node - - const inquirer = require("inquirer"); - const chalk = require("chalk"); - const figlet = require("figlet"); - const shell = require("shelljs"); - ``` -### 规划 CLI +### 规划命令行工具 -在我们写 CLI 所需的任何代码之前,做计划总是很棒的。这个 Cli 只做一件事:**创建一个文件** +在我们写命令行工具所需的任何代码之前,做计划总是很棒的。这个命令行工具只做一件事:**创建一个文件**。 -这个 CLI 将会问两个问题:文件名是什么以及文件后缀名是什么?然后创建文件,并展示一个包含了所创建文件路径的成功信息。 +它将会问两个问题:文件名是什么以及文件后缀名是什么?然后创建文件,并展示一个包含了所创建文件路径的成功信息。 ``` // index.js - - const run = async () => { - // show script introduction - // ask questions - // create the file - // show success message - }; - - run(); - ``` -第一个函数是脚本的介绍。让我们使用 `chalk` 和 `figlet` 来完成这项工作。 +第一个函数只是该脚本的介绍。让我们使用 `chalk` 和 `figlet` 来把它完成。 + ``` const init = () => { - console.log( - chalk.green( - figlet.textSync("Node JS CLI", { - font: "Ghost", - horizontalLayout: "default", - verticalLayout: "default" - }) - ) - ); - } - - const run = async () => { - // show script introduction - init(); - - // ask questions - // create the file - // show success message - }; - - run(); - ``` 然后,我们来写一个函数来问问题。 + ``` const askQuestions = () => { - const questions = [ - { - name: "FILENAME", - type: "input", - message: "What is the name of the file without extension?" - }, - { - type: "list", - name: "EXTENSION", - message: "What is the file extension?", - choices: [".rb", ".js", ".php", ".css"], - filter: function(val) { - return val.split(".")[1]; - } - } - ]; - return inquirer.prompt(questions); - }; - - // ... - - const run = async () => { - // show script introduction - init(); - - // ask questions - const answers = await askQuestions(); - const { FILENAME, EXTENSION } = answers; - - // create the file - // show success message - }; - ``` -注意,常量 FILENAME 和 EXTENSIONS 来自 `inquirer` 包。 +注意,常量 `FILENAME` 和 `EXTENSIONS` 来自 `inquirer` 包。 下一步将会创建文件。 + ``` const createFile = (filename, extension) => { - const filePath = `${process.cwd()}/${filename}.${extension}` - shell.touch(filePath); - return filePath; - }; - - // ... - - const run = async () => { - // show script introduction - init(); - - // ask questions - const answers = await askQuestions(); - const { FILENAME, EXTENSION } = answers; - - // create the file - const filePath = createFile(FILENAME, EXTENSION); - - // show success message - }; - ``` 最后,重要的是,我们将展示成功信息以及文件路径。 ``` const success = (filepath) => { - console.log( - chalk.white.bgGreen.bold(`Done! File created at ${filepath}`) - ); - }; - - // ... - - const run = async () => { - // show script introduction - init(); - - // ask questions - const answers = await askQuestions(); - const { FILENAME, EXTENSION } = answers; - - // create the file - const filePath = createFile(FILENAME, EXTENSION); - - // show success message - success(filePath); - }; - ``` 来让我们通过运行 `node index.js` 来测试这个脚本,这是我们得到的: +![](https://opensource.com/sites/default/files/uploads/nodejs_output.png) + ### 完整代码 下述代码为完整代码: + ``` #!/usr/bin/env node - - const inquirer = require("inquirer"); - const chalk = require("chalk"); - const figlet = require("figlet"); - const shell = require("shelljs"); - - const init = () => { - console.log( - chalk.green( - figlet.textSync("Node JS CLI", { - font: "Ghost", - horizontalLayout: "default", - verticalLayout: "default" - }) - ) - ); - }; - - const askQuestions = () => { - const questions = [ - { - name: "FILENAME", - type: "input", - message: "What is the name of the file without extension?" - }, - { - type: "list", - name: "EXTENSION", - message: "What is the file extension?", - choices: [".rb", ".js", ".php", ".css"], - filter: function(val) { - return val.split(".")[1]; - } - } - ]; - return inquirer.prompt(questions); - }; - - const createFile = (filename, extension) => { - const filePath = `${process.cwd()}/${filename}.${extension}` - shell.touch(filePath); - return filePath; - }; - - const success = filepath => { - console.log( - chalk.white.bgGreen.bold(`Done! File created at ${filepath}`) - ); - }; - - const run = async () => { - // show script introduction - init(); - - // ask questions - const answers = await askQuestions(); - const { FILENAME, EXTENSION } = answers; - - // create the file - const filePath = createFile(FILENAME, EXTENSION); - - // show success message - success(filePath); - }; - - run(); - ``` -### 在任何地方使用这个脚本 +### 使用这个脚本 + +想要在其它地方执行这个脚本,在你的 `package.json` 文件中添加一个 `bin` 部分,并执行 `npm link`: -To execute this script anywhere, add a `bin` section in your `package.json` file and run `npm link`. -想要在任何地方执行这个脚本,在你的 `package.json` 文件中添加一个 `bin` 部分,并执行 `npm link` ``` { - "name": "creator", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "start": "node index.js" - }, - "author": "", - "license": "ISC", - "dependencies": { - "chalk": "^2.4.1", - "figlet": "^1.2.0", - "inquirer": "^6.0.0", - "shelljs": "^0.8.2" - }, - "bin": { - "creator": "./index.js" - } - } - ``` - 执行 `npm link` 使得这个脚本可以在任何地方调用。 -这就是是当你运行这个命令时会发生的事情。 +这就是是当你运行这个命令时的结果。 ``` /usr/bin/creator -> /usr/lib/node_modules/creator/index.js - /usr/lib/node_modules/creator -> /home/hugo/code/creator - ``` - 这会连接 `index.js` 作为一个可执行文件。这是完全可能的,因为这个 CLI 脚本的第一行是 `#!/usr/bin/env node`。 - 现在我们可以通过执行如下命令来调用。 + ``` $ creator - ``` ### 总结 正如你所看到的,Node.js 使得构建一个好的命令行工具变得非常简单。如果你希望了解更多内容,查看下列包。 - * [meow][3] – 一个简单的命令行助手工具 - * [yargs][4] – 一个命令行参数 opts 解析工具 - * [pkg][5] – 将你的 Node.js 程序包装在一个可执行文件中。 + * [meow][3]:一个简单的命令行助手工具 + * [yargs][4]:一个命令行参数解析工具 + * [pkg][5]:将你的 Node.js 程序包装在一个可执行文件中。 - -在评论中留下你关于构建 CLI 的经验吧! +在评论中留下你关于构建命令行工具的经验吧! -------------------------------------------------------------------------------- @@ -530,7 +323,7 @@ via: https://opensource.com/article/18/7/node-js-interactive-cli 作者:[Hugo Dias][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[bestony](https://github.com/bestony) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 5d4b6ce9077fb2a3b44a82bcf66e03aea8ecd035 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 2 Jan 2019 23:26:42 +0800 Subject: [PATCH 165/322] PUB:20180725 Build an interactive CLI with Node.js.md @bestony https://linux.cn/article-10408-1.html --- .../20180725 Build an interactive CLI with Node.js.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180725 Build an interactive CLI with Node.js.md (100%) diff --git a/translated/tech/20180725 Build an interactive CLI with Node.js.md b/published/20180725 Build an interactive CLI with Node.js.md similarity index 100% rename from translated/tech/20180725 Build an interactive CLI with Node.js.md rename to published/20180725 Build an interactive CLI with Node.js.md From 56951389e57468eee6e4676eb4ae98b41e18d146 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 2 Jan 2019 23:35:07 +0800 Subject: [PATCH 166/322] PRF:20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md @geekpi --- ... Mode Or Emergency Mode In Ubuntu 18.04.md | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/translated/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md b/translated/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md index 9d5836b921..8598c7e4cc 100644 --- a/translated/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md +++ b/translated/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04) @@ -9,13 +9,14 @@ 如何在 Ubuntu 18.04 中启动到救援模式或紧急模式 ====== + ![](https://www.ostechnix.com/wp-content/uploads/2018/12/Boot-Into-Rescue-Mode-Or-Emergency-Mode-720x340.png) -正如你可能已经知道的那样,**runlevel** 在许多最近的 Linux 发行版(如 RHEL 7 和 Ubuntu 16.04 LTS)中被 **systemd target** 替换。有关 runlevel 和 systemd target 的更多详细信息,请参阅[**本指南**][1]。在这个简短的教程中,我们将看到如何启动**救援模式**以及**紧急模式**。本指南在 Ubuntu 18.04 LTS 中进行了测试,但是下面给出的步骤适用于大多数使用 systemd 作为默认服务管理器的 Linux 发行版。在进一步讨论之前,让我澄清什么是救援模式和紧急模式以及这两种模式的目的是什么。 +正如你可能已经知道的那样,**运行级别** 在许多最近的 Linux 发行版(如 RHEL 7 和 Ubuntu 16.04 LTS)中被 **systemd 的目标** 替换。有关它们的更多详细信息,请参阅[这个指南][1]。在这个简短的教程中,我们将看到如何启动**救援模式**以及**紧急模式**。本指南在 Ubuntu 18.04 LTS 中进行了测试,但是下面给出的步骤适用于大多数使用 systemd 作为默认服务管理器的 Linux 发行版。在进一步讨论之前,让我澄清什么是救援模式和紧急模式以及这两种模式的目的是什么。 ### 什么是救援模式? -**救援模式**相当于使用 **SysV** 作为默认服务管理器的 Linux 发行版中的 **单用户模式**。在救援模式下,将挂载所有本地文件系统,仅启动一些重要服务。但是,不会启动正常服务(例如网络服务)。救援模式在系统无法正常启动的情况下很有用。此外,我们可以在救援模式下执行一些重要的救援操作,例如[**重置 root 密码**][2]。 +**救援模式**相当于使用 **SysV** 作为默认的服务管理器的 Linux 发行版中的 **单用户模式**。在救援模式下,将挂载所有本地文件系统,仅启动一些重要服务。但是,不会启动正常服务(例如网络服务)。救援模式在系统无法正常启动的情况下很有用。此外,我们可以在救援模式下执行一些重要的救援操作,例如[重置 root 密码][2]。 ### 什么是紧急模式? @@ -23,13 +24,13 @@ ### 在 Ubuntu 18.04 LTS 中进入救援模式 -启动你的 Ubuntu 系统。出现 Grub 菜单时,选择第一条并按下 **e** 进行编辑。 +启动你的 Ubuntu 系统。出现 Grub 菜单时,选择第一条并按下 `e` 进行编辑。 ![](https://www.ostechnix.com/wp-content/uploads/2018/12/Grub-menu.png) -如果你没有看到 Grub 菜单,只需在 BIOS logo 消失后立即按下 ESC 键。 +如果你没有看到 Grub 菜单,只需在 BIOS 的 logo 消失后立即按下 `ESC` 键。 -找到以单词 **“linux”** 开头的行,并在该行的末尾添加以下行(要到达末尾,只需按下 **CTRL+e** 或使用 END 键或左右箭头键): +找到以单词 `linux` 开头的行,并在该行的末尾添加以下内容(要到达末尾,只需按下 `CTRL+e` 或使用 `END` 键或左右箭头键): ``` systemd.unit=rescue.target @@ -37,11 +38,11 @@ systemd.unit=rescue.target ![](https://www.ostechnix.com/wp-content/uploads/2018/12/Edit-grub-menu.png) -添加完成后,只需按下 **CTRL+x** 或 **F10** 即可继续启动救援模式。几秒钟后,你将以 root 用户身份进入救援模式(单用户模式)。以下是 Ubuntu 18.04 LTS 服务器版中救援模式的样子: +添加完成后,只需按下 `CTRL+x` 或 `F10` 即可继续启动救援模式。几秒钟后,你将以 root 用户身份进入救援模式(单用户模式)。以下是 Ubuntu 18.04 LTS 服务器版中救援模式的样子: ![](https://www.ostechnix.com/wp-content/uploads/2018/12/Ubuntu-rescue-mode.png) -接下来,输入以下命令将根 (/) 文件系统挂载成读/写模式。 +接下来,输入以下命令将根 (`/`) 文件系统重新挂载成读/写模式。 ``` mount -n -o remount,rw / @@ -49,15 +50,15 @@ mount -n -o remount,rw / ### 启动到紧急模式 -将 Ubuntu 引导到紧急模式与上述方法相同。你只需在编辑 grub 菜单时将 “systemd.unit=rescue.target” 替换为 “systemd.unit=emergency.target” 即可。 +将 Ubuntu 引导到紧急模式与上述方法相同。你只需在编辑 Grub 菜单时将 `systemd.unit=rescue.target` 替换为 `systemd.unit=emergency.target` 即可。 [![emergency mode][3]][4] -添加 “systemd.unit=emergency.target” 后,按下 **Ctrl+x** 或 **F10** 继续启动到紧急模式。 +添加 `systemd.unit=emergency.target` 后,按下 `Ctrl+x` 或 `F10` 继续启动到紧急模式。 ![](https://www.ostechnix.com/wp-content/uploads/2018/12/emergency-mode-1.png) -最后,你可以使用以下命令将根文件系统挂载成读/写模式: +最后,你可以使用以下命令将根文件系统重新挂载成读/写模式: ``` mount -n -o remount,rw / @@ -65,7 +66,7 @@ mount -n -o remount,rw / ### 在救援模式和紧急模式之间切换 -如果你处于救援模式,则不必像上面提到的那样编辑 grub 条目。相反,只需输入以下命令即可立即切换到紧急模式: +如果你处于救援模式,则不必像上面提到的那样编辑 Grub 条目。相反,只需输入以下命令即可立即切换到紧急模式: ``` systemctl emergency @@ -86,7 +87,6 @@ systemctl rescue 干杯! - -------------------------------------------------------------------------------- via: https://www.ostechnix.com/how-to-boot-into-rescue-mode-or-emergency-mode-in-ubuntu-18-04/ @@ -94,7 +94,7 @@ via: https://www.ostechnix.com/how-to-boot-into-rescue-mode-or-emergency-mode-in 作者:[SK][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -103,4 +103,4 @@ via: https://www.ostechnix.com/how-to-boot-into-rescue-mode-or-emergency-mode-in [1]: https://www.ostechnix.com/check-runlevel-linux/ [2]: https://www.ostechnix.com/how-to-reset-or-recover-root-user-password-in-linux/ [3]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[4]: http://www.ostechnix.com/wp-content/uploads/2018/12/emergency-mode.png \ No newline at end of file +[4]: http://www.ostechnix.com/wp-content/uploads/2018/12/emergency-mode.png From ebe6925711fc4b93623369b2e38b66fc002dd9bd Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 2 Jan 2019 23:35:42 +0800 Subject: [PATCH 167/322] PUB:20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md @geekpi https://linux.cn/article-10409-1.html --- ...Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md (98%) diff --git a/translated/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md b/published/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md similarity index 98% rename from translated/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md rename to published/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md index 8598c7e4cc..5e599cfa66 100644 --- a/translated/tech/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md +++ b/published/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10409-1.html) [#]: subject: (How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04) [#]: via: (https://www.ostechnix.com/how-to-boot-into-rescue-mode-or-emergency-mode-in-ubuntu-18-04/) [#]: author: (SK https://www.ostechnix.com/author/sk/) From 150cffb49be287b8278ef7f3fc6fc79e16bdfc39 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 2 Jan 2019 23:50:20 +0800 Subject: [PATCH 168/322] PRF:20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md --- ...o Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md b/published/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md index 5e599cfa66..cd334fe55a 100644 --- a/published/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md +++ b/published/20181206 How To Boot Into Rescue Mode Or Emergency Mode In Ubuntu 18.04.md @@ -52,7 +52,7 @@ mount -n -o remount,rw / 将 Ubuntu 引导到紧急模式与上述方法相同。你只需在编辑 Grub 菜单时将 `systemd.unit=rescue.target` 替换为 `systemd.unit=emergency.target` 即可。 -[![emergency mode][3]][4] +![emergency mode][4] 添加 `systemd.unit=emergency.target` 后,按下 `Ctrl+x` 或 `F10` 继续启动到紧急模式。 From 908b8dc6a583d0e72b8489cac65ace1af4662453 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 3 Jan 2019 08:55:16 +0800 Subject: [PATCH 169/322] translated --- ...ojects to try in COPR for December 2018.md | 93 ------------------- ...ojects to try in COPR for December 2018.md | 93 +++++++++++++++++++ 2 files changed, 93 insertions(+), 93 deletions(-) delete mode 100644 sources/tech/20181217 4 cool new projects to try in COPR for December 2018.md create mode 100644 translated/tech/20181217 4 cool new projects to try in COPR for December 2018.md diff --git a/sources/tech/20181217 4 cool new projects to try in COPR for December 2018.md b/sources/tech/20181217 4 cool new projects to try in COPR for December 2018.md deleted file mode 100644 index 0564320363..0000000000 --- a/sources/tech/20181217 4 cool new projects to try in COPR for December 2018.md +++ /dev/null @@ -1,93 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (4 cool new projects to try in COPR for December 2018) -[#]: via: (https://fedoramagazine.org/4-try-copr-december-2018/) -[#]: author: (Dominik Turecek https://fedoramagazine.org) - -4 cool new projects to try in COPR for December 2018 -====== -![](https://fedoramagazine.org/wp-content/uploads/2017/08/4-copr-945x400.jpg) - -COPR is a [collection][1] of personal repositories for software that isn’t carried in Fedora. Some software doesn’t conform to standards that allow easy packaging. Or it may not meet other Fedora standards, despite being free and open source. COPR can offer these projects outside the Fedora set of packages. Software in COPR isn’t supported by Fedora infrastructure or signed by the project. However, it can be a neat way to try new or experimental software. - -Here’s a set of new and interesting projects in COPR. - -### MindForger - -[MindForger][2] is a Markdown editor and a notebook. In addition to features you’d expect from a Markdown editor, MindForger lets you split a single file into multiple notes. It’s easy to organize the notes and move them around between files, as well as search through them. I’ve been using MindForger for some time for my study notes, so it’s nice that it’s available through COPR now.![][3] - -#### Installation instructions - -The repo currently provides MindForger for Fedora 29 and Rawhide. To install MindForger, use these commands: - -``` -sudo dnf copr enable deadmozay/mindforger -sudo dnf install mindforger -``` - -### Clingo - -[Clingo][4] is a program for solving logical problems using [answer set programming][5] (ASP) modeling language. With ASP, you can declaratively describe a problem as a logical program that Clingo then solves. As a result, Clingo produces solutions to the problem in the form of logical models, called answer sets. - -#### Installation instructions - -The repo currently provides Clingo for Fedora 28 and 29. To install Clingo, use these commands: - -``` -sudo dnf copr enable timn/clingo -sudo dnf install clingo -``` - -### SGVrecord - -[SGVrecord][6] is a simple tool for recording your screen. It allows you to either capture the whole screen or select just a part of it. Furthermore, it is possible to make the record with or without sound. Sgvrecord produces files in WebM format.![][7] - -#### Installation instructions - -The repo currently provides SGVrecord for Fedora 28, 29, and Rawhide. To install SGVrecord, use these commands: - -``` -sudo dnf copr enable youssefmsourani/sgvrecord -sudo dnf install sgvrecord -``` - -### Watchman - -[Watchman][8] is a service for monitoring and recording when changes are done to files. -You can specify directory trees for Watchman to monitor, as well as define actions -that are triggered when specified files are changed. - -#### Installation instructions - -The repo currently provides Watchman for Fedora 29 and Rawhide. To install Watchman, use these commands: - -``` -sudo dnf copr enable eklitzke/watchman -sudo dnf install watchman -``` - - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/4-try-copr-december-2018/ - -作者:[Dominik Turecek][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://fedoramagazine.org -[b]: https://github.com/lujun9972 -[1]: https://copr.fedorainfracloud.org/ -[2]: https://www.mindforger.com/ -[3]: https://fedoramagazine.org/wp-content/uploads/2018/12/mindforger.png -[4]: https://potassco.org/clingo/ -[5]: https://en.wikipedia.org/wiki/Answer_set_programming -[6]: https://github.com/yucefsourani/sgvrecord -[7]: https://fedoramagazine.org/wp-content/uploads/2018/12/SGVrecord.png -[8]: https://facebook.github.io/watchman/ diff --git a/translated/tech/20181217 4 cool new projects to try in COPR for December 2018.md b/translated/tech/20181217 4 cool new projects to try in COPR for December 2018.md new file mode 100644 index 0000000000..e69a659b9e --- /dev/null +++ b/translated/tech/20181217 4 cool new projects to try in COPR for December 2018.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 cool new projects to try in COPR for December 2018) +[#]: via: (https://fedoramagazine.org/4-try-copr-december-2018/) +[#]: author: (Dominik Turecek https://fedoramagazine.org) + +2018 年 12 月值得尝试的 4个很酷的 COPR 新项目 +====== +![](https://fedoramagazine.org/wp-content/uploads/2017/08/4-copr-945x400.jpg) + +COPR 是个人软件仓库[集合][1],它不在 Fedora 中。某些软件不符合允许轻松打包的标准。或者它可能不符合其他 Fedora 标准,尽管它是自由开源的。COPR 可在 Fedora套件之外提供这些项目。COPR 中的软件不受 Fedora 基础设施的支持,或由项目自己签名。但是,这是尝试新的或实验性软件的一种很好的方法。 + +这是 COPR 中一组新的有趣项目。 + +### MindForger + +[MindForger][2] 是 Markdown 编辑器和笔记本。除了你希望的 Markdown 编辑器的功能之外,MindForger 还允许你将单个文件拆分为多个笔记。组织笔记并在文件之间移动、搜索它们都很容易。我已经使用 MindForger 一段时间来记录学习笔记了,现在可以在 COPR 中找到它啦。 +![][3] + +#### 安装说明 + +该仓库目前在 Fedora 29 和 Rawhide 中提供 MindForger。要安装 MindForger,请使用以下命令: + +``` +sudo dnf copr enable deadmozay/mindforger +sudo dnf install mindforger +``` + +### Clingo + +[Clingo][4] 是使用[回答集编程][5] (ASP) 建模语言解决逻辑问题的程序。使用 ASP,你可以将问题声明为一个 Clingo 逻辑程序然后解决。最后,Clingo 以逻辑模型的形式产生问题的解决方案,称为回答集。 + +#### 安装说明 + +该仓库目前为 Fedora 28 和 29 提供 Clingo。要安装 Clingo,请使用以下命令: + +``` +sudo dnf copr enable timn/clingo +sudo dnf install clingo +``` + +### SGVrecord + +[SGVrecord][6] 是一个用于录制屏幕的简单工具。它允许你捕获整个屏幕或仅选择其中的一部分。此外,有没有声音都可以进行录制。Sgvrecord 以 WebM 格式生成文件。 +![][7] + +#### 安装说明 + +该仓库目前为 Fedora 28、29 和 Rawhide 提供 SGVrecord。要安装 SGVrecord,请使用以下命令: + +``` +sudo dnf copr enable youssefmsourani/sgvrecord +sudo dnf install sgvrecord +``` + +### Watchman + +[Watchman][8] 是一个对文件更改进行监视和记录的服务。你可以为指定 Watchman 监视的目录树,以及定义指定文件发生更改时触发的操作。 + +#### 安装说明 + +该仓库目前为 Fedora 29 和 Rawhide 提供 Watchman。要安装 Watchman,请使用以下命令: + +``` +sudo dnf copr enable eklitzke/watchman +sudo dnf install watchman +``` + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/4-try-copr-december-2018/ + +作者:[Dominik Turecek][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org +[b]: https://github.com/lujun9972 +[1]: https://copr.fedorainfracloud.org/ +[2]: https://www.mindforger.com/ +[3]: https://fedoramagazine.org/wp-content/uploads/2018/12/mindforger.png +[4]: https://potassco.org/clingo/ +[5]: https://en.wikipedia.org/wiki/Answer_set_programming +[6]: https://github.com/yucefsourani/sgvrecord +[7]: https://fedoramagazine.org/wp-content/uploads/2018/12/SGVrecord.png +[8]: https://facebook.github.io/watchman/ \ No newline at end of file From 794af2bbba1a716475781f125b92fdee2e3b4d16 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 3 Jan 2019 09:02:11 +0800 Subject: [PATCH 170/322] translating --- ...1219 Solve a puzzle at the Linux command line with nudoku.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md b/sources/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md index 7822a0cb98..664921bb87 100644 --- a/sources/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md +++ b/sources/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 85929b48443eca4661001f3faeb3434cf3cac977 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 3 Jan 2019 09:07:21 +0800 Subject: [PATCH 171/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Linux=20commands?= =?UTF-8?q?=20for=20measuring=20disk=20activity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ux commands for measuring disk activity.md | 252 ++++++++++++++++++ 1 file changed, 252 insertions(+) create mode 100644 sources/tech/20181227 Linux commands for measuring disk activity.md diff --git a/sources/tech/20181227 Linux commands for measuring disk activity.md b/sources/tech/20181227 Linux commands for measuring disk activity.md new file mode 100644 index 0000000000..badda327dd --- /dev/null +++ b/sources/tech/20181227 Linux commands for measuring disk activity.md @@ -0,0 +1,252 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux commands for measuring disk activity) +[#]: via: (https://www.networkworld.com/article/3330497/linux/linux-commands-for-measuring-disk-activity.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Linux commands for measuring disk activity +====== +![](https://images.idgesg.net/images/article/2018/12/tape-measure-100782593-large.jpg) +Linux systems provide a handy suite of commands for helping you see how busy your disks are, not just how full. In this post, we examine five very useful commands for looking into disk activity. Two of the commands (iostat and ioping) may have to be added to your system, and these same two commands require you to use sudo privileges, but all five commands provide useful ways to view disk activity. + +Probably one of the easiest and most obvious of these commands is **dstat**. + +### dtstat + +In spite of the fact that the **dstat** command begins with the letter "d", it provides stats on a lot more than just disk activity. If you want to view just disk activity, you can use the **-d** option. As shown below, you’ll get a continuous list of disk read/write measurements until you stop the display with a ^c. Note that after the first report, each subsequent row in the display will report disk activity in the following time interval, and the default is only one second. + +``` +$ dstat -d +-dsk/total- + read writ + 949B 73k + 65k 0 <== first second + 0 24k <== second second + 0 16k + 0 0 ^C +``` + +Including a number after the -d option will set the interval to that number of seconds. + +``` +$ dstat -d 10 +-dsk/total- + read writ + 949B 73k + 65k 81M <== first five seconds + 0 21k <== second five second + 0 9011B ^C +``` + +Notice that the reported data may be shown in a number of different units — e.g., M (megabytes), k (kilobytes), and B (bytes). + +Without options, the dstat command is going to show you a lot of other information as well — indicating how the CPU is spending its time, displaying network and paging activity, and reporting on interrupts and context switches. + +``` +$ dstat +You did not select any stats, using -cdngy by default. +--total-cpu-usage-- -dsk/total- -net/total- ---paging-- ---system-- +usr sys idl wai stl| read writ| recv send| in out | int csw + 0 0 100 0 0| 949B 73k| 0 0 | 0 3B| 38 65 + 0 0 100 0 0| 0 0 | 218B 932B| 0 0 | 53 68 + 0 1 99 0 0| 0 16k| 64B 468B| 0 0 | 64 81 ^C +``` + +The dstat command provides valuable insights into overall Linux system performance, pretty much replacing a collection of older tools, such as vmstat, netstat, iostat, and ifstat, with a flexible and powerful command that combines their features. For more insight into the other information that the dstat command can provide, refer to this post on the [dstat][1] command. + +### iostat + +The iostat command helps monitor system input/output device loading by observing the time the devices are active in relation to their average transfer rates. It's sometimes used to evaluate the balance of activity between disks. + +``` +$ iostat +Linux 4.18.0-041800-generic (butterfly) 12/26/2018 _x86_64_ (2 CPU) + +avg-cpu: %user %nice %system %iowait %steal %idle + 0.07 0.01 0.03 0.05 0.00 99.85 + +Device tps kB_read/s kB_wrtn/s kB_read kB_wrtn +loop0 0.00 0.00 0.00 1048 0 +loop1 0.00 0.00 0.00 365 0 +loop2 0.00 0.00 0.00 1056 0 +loop3 0.00 0.01 0.00 16169 0 +loop4 0.00 0.00 0.00 413 0 +loop5 0.00 0.00 0.00 1184 0 +loop6 0.00 0.00 0.00 1062 0 +loop7 0.00 0.00 0.00 5261 0 +sda 1.06 0.89 72.66 2837453 232735080 +sdb 0.00 0.02 0.00 48669 40 +loop8 0.00 0.00 0.00 1053 0 +loop9 0.01 0.01 0.00 18949 0 +loop10 0.00 0.00 0.00 56 0 +loop11 0.00 0.00 0.00 7090 0 +loop12 0.00 0.00 0.00 1160 0 +loop13 0.00 0.00 0.00 108 0 +loop14 0.00 0.00 0.00 3572 0 +loop15 0.01 0.01 0.00 20026 0 +loop16 0.00 0.00 0.00 24 0 +``` + +Of course, all the stats provided on Linux loop devices can clutter the display when you want to focus solely on your disks. The command, however, does provide the **-p** option, which allows you to just look at your disks — as shown in the commands below. + +``` +$ iostat -p sda +Linux 4.18.0-041800-generic (butterfly) 12/26/2018 _x86_64_ (2 CPU) + +avg-cpu: %user %nice %system %iowait %steal %idle + 0.07 0.01 0.03 0.05 0.00 99.85 + +Device tps kB_read/s kB_wrtn/s kB_read kB_wrtn +sda 1.06 0.89 72.54 2843737 232815784 +sda1 1.04 0.88 72.54 2821733 232815784 +``` + +Note that **tps** refers to transfers per second. + +You can also get iostat to provide repeated reports. In the example below, we're getting measurements every five seconds by using the **-d** option. + +``` +$ iostat -p sda -d 5 +Linux 4.18.0-041800-generic (butterfly) 12/26/2018 _x86_64_ (2 CPU) + +Device tps kB_read/s kB_wrtn/s kB_read kB_wrtn +sda 1.06 0.89 72.51 2843749 232834048 +sda1 1.04 0.88 72.51 2821745 232834048 + +Device tps kB_read/s kB_wrtn/s kB_read kB_wrtn +sda 0.80 0.00 11.20 0 56 +sda1 0.80 0.00 11.20 0 56 +``` + +If you prefer to omit the first (stats since boot) report, add a **-y** to your command. + +``` +$ iostat -p sda -d 5 -y +Linux 4.18.0-041800-generic (butterfly) 12/26/2018 _x86_64_ (2 CPU) + +Device tps kB_read/s kB_wrtn/s kB_read kB_wrtn +sda 0.80 0.00 11.20 0 56 +sda1 0.80 0.00 11.20 0 56 +``` + +Next, we look at our second disk drive. + +``` +$ iostat -p sdb +Linux 4.18.0-041800-generic (butterfly) 12/26/2018 _x86_64_ (2 CPU) + +avg-cpu: %user %nice %system %iowait %steal %idle + 0.07 0.01 0.03 0.05 0.00 99.85 + +Device tps kB_read/s kB_wrtn/s kB_read kB_wrtn +sdb 0.00 0.02 0.00 48669 40 +sdb2 0.00 0.00 0.00 4861 40 +sdb1 0.00 0.01 0.00 35344 0 +``` + +### iotop + +The **iotop** command is top-like utility for looking at disk I/O. It gathers I/O usage information provided by the Linux kernel so that you can get an idea which processes are most demanding in terms in disk I/O. In the example below, the loop time has been set to 5 seconds. The display will update itself, overwriting the previous output. + +``` +$ sudo iotop -d 5 +Total DISK READ: 0.00 B/s | Total DISK WRITE: 1585.31 B/s +Current DISK READ: 0.00 B/s | Current DISK WRITE: 12.39 K/s + TID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND +32492 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.12 % [kworker/u8:1-ev~_power_efficient] + 208 be/3 root 0.00 B/s 1585.31 B/s 0.00 % 0.11 % [jbd2/sda1-8] + 1 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % init splash + 2 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [kthreadd] + 3 be/0 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [rcu_gp] + 4 be/0 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [rcu_par_gp] + 8 be/0 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [mm_percpu_wq] +``` + +### ioping + +The **ioping** command is an altogether different type of tool, but it can report disk latency — how long it takes a disk to respond to requests — and can be helpful in diagnosing disk problems. + +``` +$ sudo ioping /dev/sda1 +4 KiB <<< /dev/sda1 (block device 111.8 GiB): request=1 time=960.2 us (warmup) +4 KiB <<< /dev/sda1 (block device 111.8 GiB): request=2 time=841.5 us +4 KiB <<< /dev/sda1 (block device 111.8 GiB): request=3 time=831.0 us +4 KiB <<< /dev/sda1 (block device 111.8 GiB): request=4 time=1.17 ms +^C +--- /dev/sda1 (block device 111.8 GiB) ioping statistics --- +3 requests completed in 2.84 ms, 12 KiB read, 1.05 k iops, 4.12 MiB/s +generated 4 requests in 3.37 s, 16 KiB, 1 iops, 4.75 KiB/s +min/avg/max/mdev = 831.0 us / 947.9 us / 1.17 ms / 158.0 us +``` + +### atop + +The **atop** command, like **top** provides a lot of information on system performance, including some stats on disk activity. + +``` +ATOP - butterfly 2018/12/26 17:24:19 37d3h13m------ 10ed +PRC | sys 0.03s | user 0.01s | #proc 179 | #zombie 0 | #exit 6 | +CPU | sys 1% | user 0% | irq 0% | idle 199% | wait 0% | +cpu | sys 1% | user 0% | irq 0% | idle 99% | cpu000 w 0% | +CPL | avg1 0.00 | avg5 0.00 | avg15 0.00 | csw 677 | intr 470 | +MEM | tot 5.8G | free 223.4M | cache 4.6G | buff 253.2M | slab 394.4M | +SWP | tot 2.0G | free 2.0G | | vmcom 1.9G | vmlim 4.9G | +DSK | sda | busy 0% | read 0 | write 7 | avio 1.14 ms | +NET | transport | tcpi 4 | tcpo stall 8 | udpi 1 | udpo 0swout 2255 | +NET | network | ipi 10 | ipo 7 | ipfrw 0 | deliv 60.67 ms | +NET | enp0s25 0% | pcki 10 | pcko 8 | si 1 Kbps | so 3 Kbp0.73 ms | + + PID SYSCPU USRCPU VGROW RGROW ST EXC THR S CPUNR CPU CMD 1/1673e4 | + 3357 0.01s 0.00s 672K 824K -- - 1 R 0 0% atop + 3359 0.01s 0.00s 0K 0K NE 0 0 E - 0% + 3361 0.00s 0.01s 0K 0K NE 0 0 E - 0% + 3363 0.01s 0.00s 0K 0K NE 0 0 E - 0% +31357 0.00s 0.00s 0K 0K -- - 1 S 1 0% bash + 3364 0.00s 0.00s 8032K 756K N- - 1 S 1 0% sleep + 2931 0.00s 0.00s 0K 0K -- - 1 I 1 0% kworker/u8:2-e + 3356 0.00s 0.00s 0K 0K -E 0 0 E - 0% + 3360 0.00s 0.00s 0K 0K NE 0 0 E - 0% + 3362 0.00s 0.00s 0K 0K NE 0 0 E - 0% +``` + +If you want to look at _just_ the disk stats, you can easily manage that with a command like this: + +``` +$ atop | grep DSK +$ atop | grep DSK +DSK | sda | busy 0% | read 122901 | write 3318e3 | avio 0.67 ms | +DSK | sdb | busy 0% | read 1168 | write 103 | avio 0.73 ms | +DSK | sda | busy 2% | read 0 | write 92 | avio 2.39 ms | +DSK | sda | busy 2% | read 0 | write 94 | avio 2.47 ms | +DSK | sda | busy 2% | read 0 | write 99 | avio 2.26 ms | +DSK | sda | busy 2% | read 0 | write 94 | avio 2.43 ms | +DSK | sda | busy 2% | read 0 | write 94 | avio 2.43 ms | +DSK | sda | busy 2% | read 0 | write 92 | avio 2.43 ms | +^C +``` + +### Being in the know with disk I/O + +Linux provides enough commands to give you good insights into how hard your disks are working and help you focus on potential problems or slowdowns. Hopefully, one of these commands will tell you just what you need to know when it's time to question disk performance. Occasional use of these commands will help ensure that especially busy or slow disks will be obvious when you need to check them. + +Join the Network World communities on [Facebook][2] and [LinkedIn][3] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3330497/linux/linux-commands-for-measuring-disk-activity.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3291616/linux/examining-linux-system-performance-with-dstat.html +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world From dbaee7265e609d10b381670ea2c78846f274940e Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 3 Jan 2019 09:11:14 +0800 Subject: [PATCH 172/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20To=20Displa?= =?UTF-8?q?y=20Thumbnail=20Images=20In=20Terminal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...To Display Thumbnail Images In Terminal.md | 186 ++++++++++++++++++ 1 file changed, 186 insertions(+) create mode 100644 sources/tech/20190102 How To Display Thumbnail Images In Terminal.md diff --git a/sources/tech/20190102 How To Display Thumbnail Images In Terminal.md b/sources/tech/20190102 How To Display Thumbnail Images In Terminal.md new file mode 100644 index 0000000000..2756747334 --- /dev/null +++ b/sources/tech/20190102 How To Display Thumbnail Images In Terminal.md @@ -0,0 +1,186 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Display Thumbnail Images In Terminal) +[#]: via: (https://www.ostechnix.com/how-to-display-thumbnail-images-in-terminal/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +How To Display Thumbnail Images In Terminal +====== +![](https://www.ostechnix.com/wp-content/uploads/2019/01/lsix-720x340.png) + +A while ago, we discussed about [**Fim**][1], a lightweight, CLI image viewer application used to display various type of images, such as bmp, gif, jpeg, and png etc., from command line. Today, I stumbled upon a similar utility named **‘lsix’**. It is like ‘ls’ command in Unix-like systems, but for images only. The lsix is a simple CLI utility designed to display thumbnail images in Terminal using **Sixel** graphics. For those wondering, Sixel, short for six pixels, is a type of bitmap graphics format. It uses **ImageMagick** , so almost all file formats supported by imagemagick will work fine. + +### Features + +Concerning the features of lsix, we can list the following: + + * Automatically detects if your Terminal supports Sixel graphics or not. If your Terminal doesn’t support Sixel, it will notify you to enable it. + * Automatically detects the terminal background color. It uses terminal escape sequences to try to figure out the foreground and background colors of your Terminal application and will display the thumbnails clearly. + * If there are more images in the directory, usually >21, lsix will display those images one row a a time, so you need not to wait for the entire montage to be created. + * Works well over SSH, so you can manipulate images stored on your remote web server without much hassle. + * It supports Non-bitmap graphics, such as.svg, .eps, .pdf, .xcf etc. + * Written in BASH, so works on almost all Linux distros. + + + +### Installing lsix + +Since lsix uses ImageMagick, make sure you have installed it. It is available in the default repositories of most Linux distributions. For example, on Arch Linux and its variants like Antergos, Manjaro Linux, ImageMagick can be installed using command: + +``` +$ sudo pacman -S imagemagick +``` + +On Debian, Ubuntu, Linux Mint: + +``` +$ sudo apt-get install imagemagick +``` + +lsix doesn’t require any installation as it is just a BASH script. Just download it and move it to your $PATH. It’s that simple. + +Download the latest lsix version from project’s github page. I am going to download the lsix archive file using command: + +``` +$ wget https://github.com/hackerb9/lsix/archive/master.zip +``` + +Extract the downloaded zip file: + +``` +$ unzip master.zip +``` + +This command will extract all contents into a folder named ‘lsix-master’. Copy the lsix binary from this directory to your $PATH, for example /usr/local/bin/. + +``` +$ sudo cp lsix-master/lsix /usr/local/bin/ +``` + +Finally, make the lsbix binary executable: + +``` +$ sudo chmod +x /usr/local/bin/lsix +``` + +That’s it. Now is the time to display thumbnails in the terminal itself. + +Before start using lsix, **make sure your Terminal supports Sixel graphics**. + +The developer has developed lsix on an Xterm in **vt340 emulation mode**. However, the he claims that lsix should work on any Sixel compatible Terminal. + +Xterm supports Sixel graphics, but it isn’t enabled by default. + +You can launch Xterm with Sixel mode enabled using command (from another Terminal): + +``` +$ xterm -ti vt340 +``` + +Alternatively, you can make vt340 the default terminal type for Xterm as described below. + +Edit **.Xresources** file (If it not available, just create it): + +``` +$ vi .Xresources +``` + +Add the following line: + +``` +xterm*decTerminalID : vt340 +``` + +Press **ESC** and type **:wq** to save and close the file. + +Finally, run the following command to apply the changes: + +``` +$ xrdb -merge .Xresources +``` + +Now Xterm will start with Sixel mode enabled at every launch by default. + +### Display Thumbnail Images In Terminal + +Launch Xterm (Don’t forget to start it with vt340 mode). Here is how Xterm looks like in my system. +![](https://www.ostechnix.com/wp-content/uploads/2019/01/xterm-1.png) + +Like I already stated, lsix is very simple utility. It doesn’t have any command line flags or configuration files. All you have to do is just pass the path of your file as an argument like below. + +``` +$ lsix ostechnix/logo.png +``` + +![](https://www.ostechnix.com/wp-content/uploads/2019/01/lsix-4.png) + +If you run it without path, it will display the thumbnail images in your current working directory. I have few files in a directory named **ostechnix**. + +To display the thumbnails in this directory, just run: + +``` +$ lsix +``` + +![](https://www.ostechnix.com/wp-content/uploads/2019/01/lsix-1.png) + +See? The thumbnails of all files are displayed in the terminal itself. + +If you use ‘ls’ command, you would just see the filenames only, not thumbnails. + +![][3] + +You can also display a specific image or group of images of a specific type using wildcards. + +For example, to display a single image, just mention the full path of the image like below. + +``` +$ lsix girl.jpg +``` + +![](https://www.ostechnix.com/wp-content/uploads/2019/01/lsix-2.png) + +To display all images of a specific type, say PNG, use the wildcard character like below. + +``` +$ lsix *.png +``` + +![][4] + +For JPEG type images, the command would be: + +``` +$ lsix *jpg +``` + +The thumbnail image quality is surprisingly good. I thought lsix would just display blurry thumbnails. I was wrong. The thumbnails are clearly visible just like on the graphical image viewers. + +And, that’s all for now. As you can see, lsix is very similar to ‘ls’ command, but it only for displaying thumbnails. If you deal with a lot of images at work, lsix might be quite handy. Give it a try and let us know your thoughts on this utility in the comment section below. If you know any similar tools, please suggest them as well. I will check and update this guide. + +More good stuffs to come. Stay tuned! + +Cheers! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-display-thumbnail-images-in-terminal/ + +作者:[SK][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: https://www.ostechnix.com/how-to-display-images-in-the-terminal/ +[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[3]: http://www.ostechnix.com/wp-content/uploads/2019/01/ls-command-1.png +[4]: http://www.ostechnix.com/wp-content/uploads/2019/01/lsix-3.png From 02afe4e8fa4b8c437745ecf7cf52419bf05e652c Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 3 Jan 2019 09:14:29 +0800 Subject: [PATCH 173/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Using=20Yarn=20on?= =?UTF-8?q?=20Ubuntu=20and=20Other=20Linux=20Distributions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...on Ubuntu and Other Linux Distributions.md | 265 ++++++++++++++++++ 1 file changed, 265 insertions(+) create mode 100644 sources/tech/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md diff --git a/sources/tech/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md b/sources/tech/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md new file mode 100644 index 0000000000..71555454f5 --- /dev/null +++ b/sources/tech/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md @@ -0,0 +1,265 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using Yarn on Ubuntu and Other Linux Distributions) +[#]: via: (https://itsfoss.com/install-yarn-ubuntu) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Using Yarn on Ubuntu and Other Linux Distributions +====== + +**This quick tutorial shows you the official way of installing Yarn package manager on Ubuntu and Debian Linux. You’ll also learn some basic Yarn commands and the steps to remove Yarn completely.** + +[Yarn][1] is an open source JavaScript package manager developed by Facebook. It is an alternative or should I say improvement to the popular npm package manager. [Facebook developers’ team][2] created Yarn to overcome the shortcomings of [npm][3]. Facebook claims that Yarn is faster, reliable and more secure than npm. + +Like npm, Yarn provides you a way to automate the process of installing, updating, configuring, and removing packages retrieved from a global registry. + +The advantage of Yarn is that it is faster as it caches every package it downloads so it doesn’t need to download it again. It also parallelizes operations to maximize resource utilization. Yarn also uses [checksums to verify the integrity][4] of every installed package before its code is executed. Yarn also guarantees that an install that worked on one system will work exactly the same way on any other system. + +If you are [using nodejs on Ubuntu][5], probably you already have npm installed on your system. In that case, you can use npm to install Yarn globally in the following manner: + +``` +sudo npm install yarn -g +``` + +However, I would recommend using the official way to install Yarn on Ubuntu/Debian. + +### Installing Yarn on Ubuntu and Debian [The Official Way] + +![Yarn JS][6] + +The instructions mentioned here should be applicable to all versions of Ubuntu such as Ubuntu 18.04, 16.04 etc. The same set of instructions are also valid for Debian and other Debian based distributions. + +Since the tutorial uses Curl to add the GPG key of Yarn project, it would be a good idea to verify whether you have Curl installed already or not. + +``` +sudo apt install curl +``` + +The above command will install Curl if it wasn’t installed already. Now that you have curl, you can use it to add the GPG key of Yarn project in the following fashion: + +``` +curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - +``` + +After that, add the repository to your sources list so that you can easily upgrade the Yarn package in future with the rest of the system updates: + +``` +sudo sh -c 'echo "deb https://dl.yarnpkg.com/debian/ stable main" >> /etc/apt/sources.list.d/yarn.list' +``` + +You are set to go now. [Update Ubuntu][7] or Debian system to refresh the list of available packages and then install yarn: + +``` +sudo apt update +sudo apt install yarn +``` + +This will install Yarn along with nodejs. Once the process completes, verify that Yarn has been installed successfully. You can do that by checking the Yarn version. + +``` +yarn --version +``` + +For me, it showed an output like this: + +``` +yarn --version +1.12.3 +``` + +This means that I have Yarn version 1.12.3 installed on my system. + +### Using Yarn + +I presume that you have some basic understandings of JavaScript programming and how dependencies work. I am not going to go in details here. I’ll show you some of the basic Yarn commands that will help you getting started with it. + +#### Creating a new project with Yarn + +Like npm, Yarn also works with a package.json file. This is where you add your dependencies. All the packages of the dependencies are cached in the node_modules directory in the root directory of your project. + +In the root directory of your project, run the following command to generate a fresh package.json file: + +It will ask you a number of questions. You can skip the questions r go with the defaults by pressing enter. + +``` +yarn init +yarn init v1.12.3 +question name (test_yarn): test_yarn_proect +question version (1.0.0): 0.1 +question description: Test Yarn +question entry point (index.js): +question repository url: +question author: abhishek +question license (MIT): +question private: +success Saved package.json +Done in 82.42s. +``` + +With this, you get a package.json file of this sort: + +``` +{ + "name": "test_yarn_proect", + "version": "0.1", + "description": "Test Yarn", + "main": "index.js", + "author": "abhishek", + "license": "MIT" +} +``` + +Now that you have the package.json, you can either manually edit it to add or remove package dependencies or use Yarn commands (preferred). + +#### Adding dependencies with Yarn + +You can add a dependency on a certain package in the following fashion: + +``` +yarn add +``` + +For example, if you want to use [Lodash][8] in your project, you can add it using Yarn like this: + +``` +yarn add lodash +yarn add v1.12.3 +info No lockfile found. +[1/4] Resolving packages… +[2/4] Fetching packages… +[3/4] Linking dependencies… +[4/4] Building fresh packages… +success Saved lockfile. +success Saved 1 new dependency. +info Direct dependencies +└─ [email protected] +info All dependencies +└─ [email protected] +Done in 2.67s. +``` + +And you can see that this dependency has been added automatically in the package.json file: + +``` +{ + "name": "test_yarn_proect", + "version": "0.1", + "description": "Test Yarn", + "main": "index.js", + "author": "abhishek", + "license": "MIT", + "dependencies": { + "lodash": "^4.17.11" + } +} +``` + +By default, Yarn will add the latest version of a package in the dependency. If you want to use a specific version, you may specify it while adding. + +As always, you can also update the package.json file manually. + +#### Upgrading dependencies with Yarn + +You can upgrade a particular dependency to its latest version with the following command: + +``` +yarn upgrade +``` + +It will see if the package in question has a newer version and will update it accordingly. + +You can also change the version of an already added dependency in the following manner: + +You can also upgrade all the dependencies of your project to their latest version with one single command: + +``` +yarn upgrade +``` + +It will check the versions of all the dependencies and will update them if there are any newer versions. + +#### Removing dependencies with Yarn + +You can remove a package from the dependencies of your project in this way: + +``` +yarn remove +``` + +#### Install all project dependencies + +If you made any changes to the project.json file, you should run either + +``` +yarn +``` + +or + +``` +yarn install +``` + +to install all the dependencies at once. + +### How to remove Yarn from Ubuntu or Debian + +I’ll complete this tutorial by mentioning the steps to remove Yarn from your system if you used the above steps to install it. If you ever realized that you don’t need Yarn anymore, you will be able to remove it. + +Use the following command to remove Yarn and its dependencies. + +``` +sudo apt purge yarn +``` + +You should also remove the Yarn repository from the repository list: + +``` +sudo rm /etc/apt/sources.list.d/yarn.list +``` + +The optional next step is to remove the GPG key you had added to the trusted keys. But for that, you need to know the key. You can get that using the apt-key command: + +Warning: apt-key output should not be parsed (stdout is not a terminal) pub rsa4096 2016-10-05 [SC] 72EC F46A 56B4 AD39 C907 BBB7 1646 B01B 86E5 0310 uid [ unknown] Yarn Packaging + +Warning: apt-key output should not be parsed (stdout is not a terminal) pub rsa4096 2016-10-05 [SC] 72EC F46A 56B4 AD39 C907 BBB7 1646 B01B 86E5 0310 uid [ unknown] Yarn Packaging yarn@dan.cx sub rsa4096 2016-10-05 [E] sub rsa4096 2019-01-02 [S] [expires: 2020-02-02] + +The key here is the last 8 characters of the GPG key’s fingerprint in the line starting with pub. + +So, in my case, the key is 86E50310 and I’ll remove it using this command: + +``` +sudo apt-key del 86E50310 +``` + +You’ll see an OK in the output and the GPG key of Yarn package will be removed from the list of GPG keys your system trusts. + +I hope this tutorial helped you to install Yarn on Ubuntu, Debian, Linux Mint, elementary OS etc. I provided some basic Yarn commands to get you started along with complete steps to remove Yarn from your system. + +I hope you liked this tutorial and if you have any questions or suggestions, please feel free to leave a comment below. + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-yarn-ubuntu + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://yarnpkg.com/lang/en/ +[2]: https://code.fb.com/ +[3]: https://www.npmjs.com/ +[4]: https://itsfoss.com/checksum-tools-guide-linux/ +[5]: https://itsfoss.com/install-nodejs-ubuntu/ +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/yarn-js-ubuntu-debian.jpeg?resize=800%2C450&ssl=1 +[7]: https://itsfoss.com/update-ubuntu/ +[8]: https://lodash.com/ From 6534f92dbed110088b2f5ab2f706fb5abec098ef Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Thu, 3 Jan 2019 10:43:46 +0800 Subject: [PATCH 174/322] Translating Translating: Let your Linux terminal speak its mind --- sources/tech/20181220 Let your Linux terminal speak its mind.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181220 Let your Linux terminal speak its mind.md b/sources/tech/20181220 Let your Linux terminal speak its mind.md index 7f237c0962..8934bc60d6 100644 --- a/sources/tech/20181220 Let your Linux terminal speak its mind.md +++ b/sources/tech/20181220 Let your Linux terminal speak its mind.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (zhs852) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 7a7cef837f75a92335f66f6d4db28a8b2b1ba640 Mon Sep 17 00:00:00 2001 From: leon-shi <45240011+1eon-shi@users.noreply.github.com> Date: Thu, 3 Jan 2019 05:14:45 +0000 Subject: [PATCH 175/322] Update 20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md --- ... 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md b/sources/tech/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md index 66e96549c7..4335a7a98d 100644 --- a/sources/tech/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md +++ b/sources/tech/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md @@ -1,6 +1,7 @@ 8 KDE Plasma Tips and Tricks to Improve Your Productivity ====== +[#] leon-shi is translating ![](https://www.maketecheasier.com/assets/uploads/2018/01/kde-plasma-desktop-featured.jpg) KDE's Plasma is easily one of the most powerful desktop environments available for Linux. It's highly configurable, and it looks pretty good, too. That doesn't amount to a whole lot unless you can actually get things done. From ec088c2d9077785d5dc9c8d5230cc01aea920a24 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Thu, 3 Jan 2019 13:21:47 +0800 Subject: [PATCH 176/322] Translated Translated: Let your Linux terminal speak its mind --- ... Let your Linux terminal speak its mind.md | 62 ------------------- ... Let your Linux terminal speak its mind.md | 62 +++++++++++++++++++ 2 files changed, 62 insertions(+), 62 deletions(-) delete mode 100644 sources/tech/20181220 Let your Linux terminal speak its mind.md create mode 100644 translated/tech/20181220 Let your Linux terminal speak its mind.md diff --git a/sources/tech/20181220 Let your Linux terminal speak its mind.md b/sources/tech/20181220 Let your Linux terminal speak its mind.md deleted file mode 100644 index 8934bc60d6..0000000000 --- a/sources/tech/20181220 Let your Linux terminal speak its mind.md +++ /dev/null @@ -1,62 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (zhs852) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Let your Linux terminal speak its mind) -[#]: via: (https://opensource.com/article/18/12/linux-toy-espeak) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) - -Let your Linux terminal speak its mind -====== -eSpeak is an open source text-to-speech synthesizer that can be invoked from the Linux command line. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-cava.png?itok=4EWYL8uZ) - -Greetings from another day in our 24-day-long Linux command-line toys advent calendar. If this is your first visit to the series, you might be asking yourself what a command-line toy even is. We’re figuring that out as we go, but generally, it could be a game, or any simple diversion that helps you have fun at the terminal. - -We hope that even if you've seen some of these before, there will be something new for everybody in our series. - -Some of you may be too young to remember, but before there was Alexa, Siri, or the Google Assistant, computers still had voices. - -Many of us will never forget HAL 9000 from [2001: A Space Odessey][1] helpfully conversing with the crew (sorry, Dave). But between 1960s science fiction and today, there was a whole generation of speaking computers. Some of them great, most of them, not so great. - -One of my favorites is the open source project [eSpeak][2]. It's available in many forms, including a library version you can use to include speech technology in your own project, but it also coms as a command-line program that you can install and use easily. In my distribution, this was as simple as: - -``` -$ sudo dnf install espeak -``` - -Invoking eSpeak then can be invoked either interactively, or by piping text to it using the output of another program or a simple echo command. There are a number of [voice files][3] available for eSpeak, and if you're especially bored over the holidays, you could even create your own. - -A fork of eSpeak called eSpeak NG ("Next Generation") was created in 2015 from some developers who wanted to continue development of the otherwise lightly-updated eSpeak. eSpeak is made available as open source under a GPL version 3 license, and you can find out more about the project and download the source code [on SourceForge][2]. - -I'll also throw in a bonus toy today, [cava][4]. Because I've been eager to give each of these articles a unique screenshot as the lead image, and today's toy outputs sound rather than something visual, I needed to find something to fill the space. Short for "console-based audio visualizer for ALSA" (although it supports more than just ALSA now), cava is a nice MIT-licensed terminal audio visualization tool that's fun to watch. Below, is a visualization of eSpeak's output of the following: - -``` -$ echo "Rudolph, the red-nosed reindeer, had a very shiny nose." | espeak -``` - -![](https://opensource.com/sites/default/files/uploads/linux-toy-cava.gif) - -Do you have a favorite command-line toy that you we should have included? Our calendar is basically set for the remainder of the series, but we'd still love to feature some cool command-line toys in the new year. Let me know in the comments below, and I'll check it out. And let me know what you thought of today's amusement. - -Be sure to check out yesterday's toy, [Solve a puzzle at the Linux command line with nudoku][5], and come back tomorrow for another! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-espeak - -作者:[Jason Baker][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/jason-baker -[b]: https://github.com/lujun9972 -[1]: https://en.wikipedia.org/wiki/2001:_A_Space_Odyssey_(film) -[2]: http://espeak.sourceforge.net/ -[3]: http://espeak.sourceforge.net/voices.html -[4]: https://github.com/karlstav/cava -[5]: https://opensource.com/article/18/12/linux-toy-nudoku diff --git a/translated/tech/20181220 Let your Linux terminal speak its mind.md b/translated/tech/20181220 Let your Linux terminal speak its mind.md new file mode 100644 index 0000000000..f61b258c31 --- /dev/null +++ b/translated/tech/20181220 Let your Linux terminal speak its mind.md @@ -0,0 +1,62 @@ +[#]: collector: (lujun9972) +[#]: translator: (zhs852) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Let your Linux terminal speak its mind) +[#]: via: (https://opensource.com/article/18/12/linux-toy-espeak) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +让 Linux 终端说出它的想法 +====== +> eSpeak 是一个可在 Linux 命令行中使用的开源的 TTS 合成器。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-cava.png?itok=4EWYL8uZ) + +欢迎回到《24 天介绍 Linux 命令行小玩具》。如果这是你首次阅读本系列文章,你大概连什么是 Linux 命令行小玩具都不知道。无需担心,你只需要边看边体会。通常来说,它有可能是游戏或其它能让你在终端中娱乐的小程序。 + +或许你已经对一些玩具有了解了,不过我们相信,在本系列文章中总有那么几个你没见过的玩意。 + +年轻读者可能不知道,在 Alexa、Siri 或 Google Assistant 问世之前,计算机就能说话了。 + +我们也许永远不会忘记来自 [2001 太空漫游][1] 中与机组人员交流的 HAL 9000。但是在 1960 年代到今天的时间里,是存在着许多能说话的计算机的。它们有些很出色,也有些不那么出色。 + +其中一个我最爱的是一个叫做 [eSpeak][2] 的开源项目。它以多种形式被发布,比如可以嵌入你自己项目中的库。与此同时,它也提供了可供你安装的命令行版本。在我所用的发行版中,安装十分简单,只需使用: + +``` +$ sudo dnf install espeak +``` + +你既可以与 eSpeak 交互,也可以用它来输出其它程序的信息,甚至通过简单的 echo 命令来使用它。[这里][3] 有一些可供 eSpeak 使用的声音文件,你可以在无聊时切换他们。甚者你可以制作一个属于你自己的声音。 + +在 2015 年,一些希望继续 eSpeak 开发的开发者创建了一个名为 eSpeak NG (即 "Next Generation",“下一代”的意思)的项目。eSpeak 目前在 GPL v3 许可证下开源,你可以在 [SourceForge][2] 上详细了解这个项目或下载源代码。 + +别急,我今天还会介绍一个额外的小程序,它叫 [cava][4]。我经常希望用一张独一无二的截图作为我文章的头图,更何况今天的玩具主要是关于声音的,导致图片更少了。因此,我需要一些东西来填补这些空白。Cava 是 "console-based audio visualizer for ALSA" (译注:基于 ALSA 的命令行音频可视化工具)(尽管它现在支持的比 ALSA 更多)的简写,它是一个优秀的命令行音频可视化工具,并且它正以 MIT 许可证开源。下面是一个将 eSpeak 输出可视化的命令: + +``` +$ echo "Rudolph, the red-nosed reindeer, had a very shiny nose." | espeak +``` + +![](https://opensource.com/sites/default/files/uploads/linux-toy-cava.gif) + +你想让作者介绍你喜欢的命令行玩具吗?请前往原文下留言,作者可能会考虑介绍的。同时,你也可以去原文下评论你对文章的看法。 + +欢迎去看看我们昨天介绍的玩具,[在 Linux 命令行中使用 nudoku 解决谜题][5]。敬请期待我们明天的文章吧! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-espeak + +作者:[Jason Baker][a] +选题:[lujun9972][b] +译者:[zhs852](https://github.com/zhs852) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jason-baker +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/2001:_A_Space_Odyssey_(film) +[2]: http://espeak.sourceforge.net/ +[3]: http://espeak.sourceforge.net/voices.html +[4]: https://github.com/karlstav/cava +[5]: https://opensource.com/article/18/12/linux-toy-nudoku From d609a764b0002d3d3077e316336227799f36bc88 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Thu, 3 Jan 2019 13:22:32 +0800 Subject: [PATCH 177/322] Translated --- .../tech/20181220 Let your Linux terminal speak its mind.md | 1 + 1 file changed, 1 insertion(+) diff --git a/translated/tech/20181220 Let your Linux terminal speak its mind.md b/translated/tech/20181220 Let your Linux terminal speak its mind.md index f61b258c31..cbf61034a6 100644 --- a/translated/tech/20181220 Let your Linux terminal speak its mind.md +++ b/translated/tech/20181220 Let your Linux terminal speak its mind.md @@ -10,6 +10,7 @@ 让 Linux 终端说出它的想法 ====== > eSpeak 是一个可在 Linux 命令行中使用的开源的 TTS 合成器。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-cava.png?itok=4EWYL8uZ) 欢迎回到《24 天介绍 Linux 命令行小玩具》。如果这是你首次阅读本系列文章,你大概连什么是 Linux 命令行小玩具都不知道。无需担心,你只需要边看边体会。通常来说,它有可能是游戏或其它能让你在终端中娱乐的小程序。 From a34e5926ed14cd28502c5afeb6ba4a92294b359b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Thu, 3 Jan 2019 13:24:09 +0800 Subject: [PATCH 178/322] Update and rename sources/tech/20170523 Best Websites to Download Linux Games.md to translated/tech/20170523 Best Websites to Download Linux Games.md --- ...3 Best Websites to Download Linux Games.md | 140 ------------------ ...3 Best Websites to Download Linux Games.md | 140 ++++++++++++++++++ 2 files changed, 140 insertions(+), 140 deletions(-) delete mode 100644 sources/tech/20170523 Best Websites to Download Linux Games.md create mode 100644 translated/tech/20170523 Best Websites to Download Linux Games.md diff --git a/sources/tech/20170523 Best Websites to Download Linux Games.md b/sources/tech/20170523 Best Websites to Download Linux Games.md deleted file mode 100644 index b29afc1dfb..0000000000 --- a/sources/tech/20170523 Best Websites to Download Linux Games.md +++ /dev/null @@ -1,140 +0,0 @@ -Translating by robsean -Best Websites to Download Linux Games -====== -Brief: New to Linux gaming and wondering where to **download Linux games** from? We list the best resources from where you can **download free Linux games** as well as buy premium Linux games. - -Linux and Games? Once upon a time, it was hard to imagine these two going together. Then time passed and a lot of things happened. Fast-forward to the present, there are thousands and thousands of games available for Linux and more are being developed by both big game companies and independent developers. - -[Gaming on Linux][1] is real now and today we are going to see where you can find games for Linux platform and hunt down the games that you like. - -### Where to download Linux games? - -![Websites to download Linux games][2] - -First and foremost, look into your Linux distribution's software center (if it has one). You should find plenty of games there already. - -But that doesn't mean you should restrict yourself to the software center. Let me list you some websites to download Linux games. - -#### 1. Steam - -If you are a seasoned gamer, you have heard about Steam. Yes, if you don't know it already, Steam is available for Linux. Steam recommends Ubuntu but it should run on other major distributions too. And if you are really psyched up about Steam, there is even a dedicated operating system for playing Steam games - [SteamOS][3]. We covered it last year in the [Best Linux Gaming Distribution][4] article. - -![Steam Store][5] - -Steam has the largest games store for Linux. While writing this article, it has exactly 3487 games on Linux platform and that's really huge. You can find games from wide range of genre. As for [Digital Rights Management][6], most of the Steam games have some kind of DRM. - -For using Steam either you will have to install the [Steam client][7] on your Linux distribution or use SteamOS. One of the advantages of Steam is that, after your initial setup, for most of the games you wouldn't need to worry about dependencies and complex installation process. Steam client will do the heavy tasks for you. - -[Steam Store][8] - -#### 2. GOG - -If you are solely interested in DRM-free games, GOG has a pretty large collection of it. At this moment, GOG has 1978 DRM-free games in their library. GOG is kind of famous for its vast collection of DRM-free games. - -![GOG Store][9] - -Officially, GOG games support Ubuntu LTS versions and Linux Mint. So, Ubuntu and its derivatives will have no problem installing them. Installing them on other distributions might need some extra works, such as - installing correct dependencies. - -You will not need any extra clients for downloading games from GOG. All the purchased games will be available in your accounts section. You can download them directly with your favorite download manager. - -[GOG Store][10] - -#### 3. Humble Store - -The Humble Store is another place where you can find various games for Linux. There are both DRM-free and non-DRM-free games available on Humble Store. The non-DRM-free games are generally from the Steam. Currently there are about 1826 games for Linux in the Humble Store. - -![The Humble Store][11] - -Humble Store is famous for another reason though. They have a program called [**Humble Indie Bundle**][12] where they offer a bunch of games together with a compelling discount for a limited time period. Another thing about Humble is that when you make a purchase, 10% of the revenue from your purchase goes to charities. - -Humble doesn't have any extra clients for downloading their games. - -[The Humble Store][13] - -#### 4. itch.io - -itch.io is an open marketplace for independent digital creators with a focus on independent video games. itch.io has some of the most interesting and unique games that you can find. Most games available on itch.io are DRM-free. - -![itch.io Store][14] - -Right now, itch.io has 9514 games available in their store for Linux platform. - -itch.io has their own [client][15] for effortlessly downloading, installing, updating and playing their games. - -[itch.io Store][16] - -#### 5. LGDB - -LGDB is an abbreviation for Linux Game Database. Though technically not a game store, it has a large collection of games for Linux along with various information about them. Every game is documented with links of where you can find them. - -![Linux Game Database][17] - -As of now, there are 2046 games entries in the database. They also have very long lists for [Emulators][18], [Tools][19] and [Game Engines][20]. - -[LGDB][21] - -[Annoying Experiences Every Linux Gamer Never Wanted!][27] - -#### 6. Game Jolt - -Game Jolt has a very impressive collection with about 5000 indie games for Linux under their belt. - -![GameJolt Store][22] - -Game Jolt has an (pre-release) [client][23] for downloading, installing, updating and playing games with ease. - -[Game Jolt Store][24] - -### Others - -There are many other stores that sells Linux Games. Also there are many places you can find free games too. Here are a couple of them: - - * [**Bundle Stars**][25]: Bundle Stars currently has 814 Linux games and 31 games bundles. - * [**GamersGate**][26]: GamersGate has 595 Linux games as for now. There are both DRM-free and non-DRM-free games. - - - -#### App Stores, Software Center & Repositories - -Linux distribution has their own application stores or repositories. Though not many, but there you can find various games too. - -That's all for today. Did you know there are this many games available for Linux? How do you feel about this? Do you use some other websites to download Linux games? Do share your favorites with us. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/download-linux-games/ - -作者:[Munif Tanjim][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/munif/ -[1]:https://itsfoss.com/linux-gaming-guide/ -[2]:https://itsfoss.com/wp-content/uploads/2017/05/download-linux-games-800x450.jpg -[3]:http://store.steampowered.com/steamos/ -[4]:https://itsfoss.com/linux-gaming-distributions/ -[5]:https://itsfoss.com/wp-content/uploads/2017/05/Steam-Store-800x382.jpg -[6]:https://www.wikiwand.com/en/Digital_rights_management -[7]:http://store.steampowered.com/about/ -[8]:http://store.steampowered.com/linux -[9]:https://itsfoss.com/wp-content/uploads/2017/05/GOG-Store-800x366.jpg -[10]:https://www.gog.com/games?system=lin_mint,lin_ubuntu -[11]:https://itsfoss.com/wp-content/uploads/2017/05/The-Humble-Store-800x393.jpg -[12]:https://www.humblebundle.com/?partner=itsfoss -[13]:https://www.humblebundle.com/store?partner=itsfoss -[14]:https://itsfoss.com/wp-content/uploads/2017/05/itch.io-Store-800x485.jpg -[15]:https://itch.io/app -[16]:https://itch.io/games/platform-linux -[17]:https://itsfoss.com/wp-content/uploads/2017/05/LGDB-800x304.jpg -[18]:https://lgdb.org/emulators -[19]:https://lgdb.org/tools -[20]:https://lgdb.org/engines -[21]:https://lgdb.org/games -[22]:https://itsfoss.com/wp-content/uploads/2017/05/GameJolt-Store-800x357.jpg -[23]:http://gamejolt.com/client -[24]:http://gamejolt.com/games/best?os=linux -[25]:https://www.bundlestars.com/en/games?page=1&platforms=Linux -[26]:https://www.gamersgate.com/games?state=available -[27]:https://itsfoss.com/linux-gaming-problems/ diff --git a/translated/tech/20170523 Best Websites to Download Linux Games.md b/translated/tech/20170523 Best Websites to Download Linux Games.md new file mode 100644 index 0000000000..8fc5610b7c --- /dev/null +++ b/translated/tech/20170523 Best Websites to Download Linux Games.md @@ -0,0 +1,140 @@ +最好的下载 Linux 游戏的网站 +====== +简述:新接触 Linux 游戏并想知道从哪里来 **下载 Linux 游戏** ?我们列出最好的资源,你既能 **下载免费的 Linux 游戏** ,也能购买优质的 Linux 游戏。 + +Linux 和游戏?从前,很难想象这两者走到一起。然而时间流逝,很多事情发生。快进到现在,有成千上万对 Linux 可用的游戏,更多的游戏正在被大公司和独立开发者开发。 + +[在 Linux 上的游戏][1] 现在是真是,今天我们将去看看,你在哪里可以找到 Linux 平台游戏,和搜索到你喜欢的游戏。 + +### 在哪里来下载 Linux 游戏? + +![下载 Linux 游戏的网站][2] + +首先,看看你的 Linux 发行版的软件中心(如果它有)。在这里你也能找到大量的游戏。 + +但是,这不意味着你应该限制你自己到软件中心。让我们列出为你列出网站来下载 Linux 游戏。 + +#### 1. Steam + +如果你是老练的游戏者,你应该听过 Steam 。是的,如果你还不知道它,Steam 对 Linux 是可用的。Steam 推荐 Ubuntu ,但是它也能运行在其它主要的发行版上。如果你真的对 Steam 兴奋起来,这里甚至有一个玩 Steam 游戏的专用操作系统 - [SteamOS][3]。我们在上一年 [最佳的 Linux 游戏发行版][4] 文章中国包括它。 + +![Steam 商店][5] + +Steam 有最大的 Linux 游戏商店。当写这篇文章的时候,在 Linux 平台上,确切地有 3487 款游戏,这真的是庞大的。你可以从宽广的类型范围中查找游戏。。说起 [数字版权管理][6],大多数的 Steam 游戏有各种 DRM 。 + +对于使用 Steam ,要么你将不得不在你的 Linux 系统上安装 [Steam 客户端][7],要么使用 SteamOS。Steam 的一个优势是,在初始化安装后,对于大多数的游戏,你不需要担心依赖关系和复杂的安装过程。 Steam 客户端将为你做重要的任务。 + +[Steam 商店][8] + +#### 2. GOG + +如果你完全对 自由-DRM 游戏感兴趣,GOG 有它的相当多的收集。在这一时刻,GOG 在它们的库中有1978中 自由-DRM 游戏。 GOG 因它的 自由-DRM 游戏的大量的收集而著名。 + +![GOG 商店][9] + +官方的,GOG 游戏支持 Ubuntu LTS 版本和 Linux Mint。所以,Ubuntu 和它的衍生物在安装它们时将没有问题。在其他发行版上安装它们可能需要一些额外的工作,例如 - 安装正确的依赖关系。 + +从 GOG 中下载游戏,你将不需要一些额外的客户端。所有购买的游戏将在你的账户部分可用。你可以使用你最爱的下载管理器直接下载它们。 + +[GOG 商店][10] + +#### 3. Humble 商店 + +Humble +商店是另一个你可以查找 Linux 的各种各样游戏的地方。在 Humble 商店中有 自由-DRM 和 非-自由-DRM 的可用的游戏。非-自由-DRM 游戏通常来自 Steam。在 Humble 商店中,当前有超过1826款 Linux 游戏。 + +![Humble 商店][11] + +Humble 商店因另一个原因而著名。它们有一个被称为 [**Humble 内部包**][12]的程序,在程序它们提供游戏的一个包,在限定时间中带有令人不可抗拒的优惠。 Another thing about关于 Humble 的另一件事是,当你制作一个优惠时,,你的优惠的10%的税收将去慈善机构。 + +Humble 没有一些额外的客户端来下载它们的游戏, + +[Humble 商店][13] + +#### 4. itch.io + +itch.io 对于致力于独立视频游戏的独立数字创造者是一个开放市场。itch.io 有一些你能找到的最感兴趣的和独特的游戏。在 itch.io 的大多数游戏是 自由-DRM 。 + +![itch.io 商店][14] + +现在,itch.io 在它们的商店中有9514款 Linux 平台可用游戏。 + +itch.io 有它们自己的 [客户端][15] 来不费力地下载,安装,更新和玩它们的游戏。 + +[itch.io 商店][16] + +#### 5. LGDB + +LGDB 是 Linux 游戏数据库的缩写。虽然技术上不是一个游戏商店,它有x大量的 Linux 游戏收藏,以及关于它们的各种各样的信息。每一款游戏被用你可以找到它们的链接记录。 + +![Linux 游戏数据库][17] + +从现在起,在数据库中有2046款游戏入口。[Emulators][18],[Tools][19] 和 [Game Engines][20]也有很长的列表 + +[LGDB][21] + +[令人讨厌的体验,每一个 Linux 游戏者从不想要!][27] + +#### 6. Game Jolt + +Game Jolt 有一个非常可观的收集,在 belt 的区域下大约有5000个 Linux 游戏。 + +![GameJolt Store][22] + +Game Jolt 有一个(预览版) [client][23] 用于轻松地下载,安装,更新和玩游戏。 + +[Game Jolt Store][24] + +### 其他 + +这里有很多其他的卖 Linux 游戏的商店。这里也有很多你能找到免费游戏的地方。这是它们中的两个: + + * [**Bundle Stars**][25]: Bundle Stars 当前有814个 Linux 游戏和31个游戏包。 + * [**GamersGate**][26]: GamersGate 现在有595个 Linux 游戏。它们都是 DRM-free and non-DRM-free games. + + + +#### 应用商店,软件中心 & 存储库 + +Linux 发行版有它们自己的应用程序商店或存储库。尽管不是很多,但是在这里你也能找到各种各样的游戏。 + +今天到此为止。你知道这里有这么多 Linux 可用的游戏吗?你使用一些其他的网站来下载 Linux 游戏?与我们分享你的收藏。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/download-linux-games/ + +作者:[Munif Tanjim][a] +译者:[robsean](https://github.com/robsean) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/munif/ +[1]:https://itsfoss.com/linux-gaming-guide/ +[2]:https://itsfoss.com/wp-content/uploads/2017/05/download-linux-games-800x450.jpg +[3]:http://store.steampowered.com/steamos/ +[4]:https://itsfoss.com/linux-gaming-distributions/ +[5]:https://itsfoss.com/wp-content/uploads/2017/05/Steam-Store-800x382.jpg +[6]:https://www.wikiwand.com/en/Digital_rights_management +[7]:http://store.steampowered.com/about/ +[8]:http://store.steampowered.com/linux +[9]:https://itsfoss.com/wp-content/uploads/2017/05/GOG-Store-800x366.jpg +[10]:https://www.gog.com/games?system=lin_mint,lin_ubuntu +[11]:https://itsfoss.com/wp-content/uploads/2017/05/The-Humble-Store-800x393.jpg +[12]:https://www.humblebundle.com/?partner=itsfoss +[13]:https://www.humblebundle.com/store?partner=itsfoss +[14]:https://itsfoss.com/wp-content/uploads/2017/05/itch.io-Store-800x485.jpg +[15]:https://itch.io/app +[16]:https://itch.io/games/platform-linux +[17]:https://itsfoss.com/wp-content/uploads/2017/05/LGDB-800x304.jpg +[18]:https://lgdb.org/emulators +[19]:https://lgdb.org/tools +[20]:https://lgdb.org/engines +[21]:https://lgdb.org/games +[22]:https://itsfoss.com/wp-content/uploads/2017/05/GameJolt-Store-800x357.jpg +[23]:http://gamejolt.com/client +[24]:http://gamejolt.com/games/best?os=linux +[25]:https://www.bundlestars.com/en/games?page=1&platforms=Linux +[26]:https://www.gamersgate.com/games?state=available +[27]:https://itsfoss.com/linux-gaming-problems/ From 9cba55350f9c21ad441c3517823b567db07f8dcf Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 3 Jan 2019 13:45:10 +0800 Subject: [PATCH 179/322] PRF:20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md @geekpi --- ...Locally As Virtual File System In Linux.md | 38 ++++++++----------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/translated/tech/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md b/translated/tech/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md index 889fb00ac8..a271bca1ac 100644 --- a/translated/tech/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md +++ b/translated/tech/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md @@ -1,15 +1,15 @@ -Dbxfs - 在 Linux 中本地挂载 Dropbox 文件夹作为虚拟文件系统 +dbxfs:在 Linux 中本地挂载 Dropbox 文件夹 ====== ![](https://www.ostechnix.com/wp-content/uploads/2018/10/dbxfs-720x340.png) -不久前,我们总结了所有**[在本地挂载 Google Drive][1]**作为虚拟文件系统,并从 Linux 系统访问存储在 Google Drive 中的文件的方法。今天,我们将学习使用 **dbxfs**将 Dropbox 文件夹挂载到本地文件系统中。dbxfs 用于在类 Unix 操作系统中本地挂载 Dropbox 文件夹作为虚拟文件系统。虽然在 Linux 中很容易[**安装 Dropbox 客户端**][2],但这种方法与官方方法略有不同。它是一个命令行 dropbox 客户端,且无需磁盘空间即可访问。dbxfs 是免费、开源的,并且是用 Python 3.5+ 编写的。 +不久前,我们总结了所有 [在本地挂载 Google Drive][1] 作为虚拟文件系统,并从 Linux 系统访问存储在 Google Drive 中的文件的方法。今天,我们将学习使用 `dbxfs` 将 Dropbox 文件夹挂载到本地文件系统中。`dbxfs` 用于在类 Unix 操作系统中本地挂载 Dropbox 文件夹作为虚拟文件系统。虽然在 Linux 中很容易[安装 Dropbox 客户端][2],但这种方法与官方方法略有不同。它是一个命令行 dropbox 客户端,且无需磁盘空间即可访问。`dbxfs` 是自由开源的,并且是用 Python 3.5+ 编写的。 ### 安装 dbxfs -dbxfs 官方支持 Linux 和 Mac OS。但是,它应该适用于任何提供 **FUSE 兼容库**或能够挂载 **SMB** 共享的 POSIX 系统。由于它是用 Python 3.5 编写的,因此可以使用 **pip3** 包管理器进行安装。如果尚未安装 PIP,请参阅以下指南。 +`dbxfs` 官方支持 Linux 和 Mac OS。但是,它应该适用于任何提供 **FUSE 兼容库**或能够挂载 SMB 共享的 POSIX 系统。由于它是用 Python 3.5 编写的,因此可以使用 pip3 包管理器进行安装。如果尚未安装 pip,请参阅以下指南。 -[如何使用 pip 管理 Python 包][13] +- [如何使用 pip 管理 Python 包][13] 并且也要安装 FUSE 库。 @@ -17,21 +17,18 @@ dbxfs 官方支持 Linux 和 Mac OS。但是,它应该适用于任何提供 ** ``` $ sudo apt install libfuse2 - ``` 在 Fedora 上: ``` $ sudo dnf install fuse - ``` -安装完所有必需的依赖项后,运行以下命令以安装 dbxfs: +安装完所有必需的依赖项后,运行以下命令以安装 `dbxfs`: ``` $ pip3 install dbxfs - ``` ### 在本地挂载 Dropbox 文件夹 @@ -40,29 +37,27 @@ $ pip3 install dbxfs ``` $ mkdir ~/mydropbox - ``` -然后,使用 dbxfs 在本地挂载 dropbox 文件夹,如下所示: +然后,使用 `dbxfs` 在本地挂载 dropbox 文件夹,如下所示: ``` $ dbxfs ~/mydropbox - ``` 你将被要求生成一个访问令牌: ![](https://www.ostechnix.com/wp-content/uploads/2018/10/Generate-access-token-1.png) -要生成访问令牌,只需在 Web 浏览器中输入上面输出的 URL,然后单击**允许** 以授权 Dropbox 访问。你需要登录 Dropbox 帐户才能完成授权过程。 +要生成访问令牌,只需在 Web 浏览器中输入上面输出的 URL,然后单击 **允许** 以授权 Dropbox 访问。你需要登录 Dropbox 帐户才能完成授权过程。 下一个页面将生成新的授权码。复制代码并返回终端将其粘贴到 cli-dbxfs 提示符中以完成该过程。 -然后,系统会要求你保存凭据以供将来访问。无论你是要保存还是拒绝,输入 **Y** 或 **N**。然后,你需要为新的访问令牌输入两次密码。 +然后,系统会要求你保存凭据以供将来访问。根据你是要保存还是拒绝,输入 `Y` 或 `N`。然后,你需要为新的访问令牌输入两次密码。 -最后,输入 **Y** 接受 **“/home/username/mydropbox”** 作为默认挂载点。如果你要设置不同的路径,输入 **N** 并输入你选择的位置。 +最后,输入 `Y` 接受 `/home/username/mydropbox` 作为默认挂载点。如果你要设置不同的路径,输入 `N` 并输入你选择的位置。 -[![Generate access token 2][3]][4] +![Generate access token 2][4] 完成了!从现在开始,你可以看到你的 Dropbox 文件夹已挂载到本地文件系统中。 @@ -70,7 +65,7 @@ $ dbxfs ~/mydropbox ### 更改访问令牌存储路径 -默认情况下,dbxfs 会将 Dropbox 访问令牌存储在系统密钥环或加密文件中。但是,你可能希望将其存储在 **gpg** 加密文件或其他地方。如果是这样,请在 [Dropbox 开发者应用控制台][5]上创建个人应用来获取访问令牌。 +默认情况下,`dbxfs` 会将 Dropbox 访问令牌存储在系统密钥环或加密文件中。但是,你可能希望将其存储在 gpg 加密文件或其他地方。如果是这样,请在 [Dropbox 开发者应用控制台][5]上创建个人应用来获取访问令牌。 ![](https://www.ostechnix.com/wp-content/uploads/2018/10/access-token.png) @@ -78,30 +73,27 @@ $ dbxfs ~/mydropbox ![](https://www.ostechnix.com/wp-content/uploads/2018/10/Create-a-new-app.png) -创建访问令牌后,使用任何你选择的加密工具对其进行加密,例如 [**Cryptomater**][6]、[**Cryptkeeper**][7]、[**CryptGo**][8]、[**Cryptr**][9]、[**Tomb**][10]、[**Toplip**][11] 和 [**GnuPG**][12] 等,并在你喜欢的位置保存。 +创建访问令牌后,使用任何你选择的加密工具对其进行加密,例如 [Cryptomater][6]、[Cryptkeeper][7]、[CryptGo][8]、[Cryptr][9]、[Tomb][10]、[Toplip][11] 和 [**GnuPG][12] 等,并在你喜欢的位置保存。 接下来编辑 dbxfs 配置文件并添加以下行: ``` "access_token_command": ["gpg", "--decrypt", "/path/to/access/token/file.gpg"] - ``` 你可以通过运行以下命令找到 dbxfs 配置文件: ``` $ dbxfs --print-default-config-file - ``` 有关更多详细信息,请参阅 dbxfs 帮助: ``` $ dbxfs -h - ``` -如你所见,使用 dbxfs 在你的文件系统中本地挂载 Dropfox 文件夹没什么大不了的。经过测试,dbxfs 如常工作。如果你有兴趣了解它是如何工作的,请尝试一下,并在下面的评论栏告诉我们你的体验。 +如你所见,使用 `dbxfs` 在你的文件系统中本地挂载 Dropfox 文件夹并不复杂。经过测试,`dbxfs` 如常工作。如果你有兴趣了解它是如何工作的,请尝试一下,并在下面的评论栏告诉我们你的体验。 就是这些了。希望这篇文章有用。还有更多好东西。敬请期待! @@ -116,7 +108,7 @@ via: https://www.ostechnix.com/dbxfs-mount-dropbox-folder-locally-as-virtual-fil 作者:[SK][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -133,4 +125,4 @@ via: https://www.ostechnix.com/dbxfs-mount-dropbox-folder-locally-as-virtual-fil [10]: https://www.ostechnix.com/tomb-file-encryption-tool-protect-secret-files-linux/ [11]: https://www.ostechnix.com/toplip-strong-file-encryption-decryption-cli-utility/ [12]: https://www.ostechnix.com/an-easy-way-to-encrypt-and-decrypt-files-from-commandline-in-linux/ -[13]:https://www.ostechnix.com/manage-python-packages-using-pip/ \ No newline at end of file +[13]:https://www.ostechnix.com/manage-python-packages-using-pip/ From 1ff80e44b5dc927fc47520298f8556d84aee3289 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 3 Jan 2019 13:45:30 +0800 Subject: [PATCH 180/322] PUB:20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md @geekpi https://linux.cn/article-10410-1.html --- ...ount Dropbox Folder Locally As Virtual File System In Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md (100%) diff --git a/translated/tech/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md b/published/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md similarity index 100% rename from translated/tech/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md rename to published/20181005 Dbxfs - Mount Dropbox Folder Locally As Virtual File System In Linux.md From cc1d90a4435e5870c6d725ec1f74e20fc05657f8 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 3 Jan 2019 14:37:11 +0800 Subject: [PATCH 181/322] PRF:20170523 Best Websites to Download Linux Games.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @robsean 还应该再认真些,翻译完放一放,然后再去通读会找到一些不通顺的地方。 --- ...3 Best Websites to Download Linux Games.md | 84 +++++++++---------- 1 file changed, 40 insertions(+), 44 deletions(-) diff --git a/translated/tech/20170523 Best Websites to Download Linux Games.md b/translated/tech/20170523 Best Websites to Download Linux Games.md index 8fc5610b7c..dc04b472ab 100644 --- a/translated/tech/20170523 Best Websites to Download Linux Games.md +++ b/translated/tech/20170523 Best Websites to Download Linux Games.md @@ -1,104 +1,100 @@ -最好的下载 Linux 游戏的网站 +下载 Linux 游戏的最佳网站 ====== -简述:新接触 Linux 游戏并想知道从哪里来 **下载 Linux 游戏** ?我们列出最好的资源,你既能 **下载免费的 Linux 游戏** ,也能购买优质的 Linux 游戏。 -Linux 和游戏?从前,很难想象这两者走到一起。然而时间流逝,很多事情发生。快进到现在,有成千上万对 Linux 可用的游戏,更多的游戏正在被大公司和独立开发者开发。 +> 新接触 Linux 游戏并想知道从哪里来 **下载 Linux 游戏**?我们列出了最好的资源,在这里你既能 **下载免费的 Linux 游戏** ,也能购买优质的 Linux 游戏。 -[在 Linux 上的游戏][1] 现在是真是,今天我们将去看看,你在哪里可以找到 Linux 平台游戏,和搜索到你喜欢的游戏。 +Linux 和游戏?从前,很难想象这两者走到一起。然而随着时间流逝,很多事情都在变化。到如今,有成千上万在 Linux 上可以玩的游戏,而大公司和独立开发者们正在开发更多的游戏。 + +[在 Linux 上玩游戏][1] 现在已经是现实。今天我们将去看看,你在哪里可以找到 Linux 平台游戏、搜索到你喜欢的游戏。 ### 在哪里来下载 Linux 游戏? ![下载 Linux 游戏的网站][2] -首先,看看你的 Linux 发行版的软件中心(如果它有)。在这里你也能找到大量的游戏。 +首先,看看你的 Linux 发行版的软件中心(如果有的话)。在这里你也能找到大量的游戏。 -但是,这不意味着你应该限制你自己到软件中心。让我们列出为你列出网站来下载 Linux 游戏。 +但是,这不意味着你应该将自己的视野局限于软件中心上。让我们来为你列出一些可以下载 Linux 游戏网站。 #### 1. Steam -如果你是老练的游戏者,你应该听过 Steam 。是的,如果你还不知道它,Steam 对 Linux 是可用的。Steam 推荐 Ubuntu ,但是它也能运行在其它主要的发行版上。如果你真的对 Steam 兴奋起来,这里甚至有一个玩 Steam 游戏的专用操作系统 - [SteamOS][3]。我们在上一年 [最佳的 Linux 游戏发行版][4] 文章中国包括它。 +如果你是老练的玩家,你应该听过 Steam。如果你还不知道的话,没错,Steam 在 Linux 上也是可用的。Steam 推荐运行在 Ubuntu 上,但是它也能运行在其它主要的发行版上。如果你真的对 Steam 很狂热,这里甚至还有一个玩 Steam 游戏的专用操作系统:[SteamOS][3]。我们在上一年 [最佳的 Linux 游戏发行版][4] 文章中提及了它。 ![Steam 商店][5] -Steam 有最大的 Linux 游戏商店。当写这篇文章的时候,在 Linux 平台上,确切地有 3487 款游戏,这真的是庞大的。你可以从宽广的类型范围中查找游戏。。说起 [数字版权管理][6],大多数的 Steam 游戏有各种 DRM 。 +Steam 有最大的 Linux 游戏商店。当写这篇文章的时候,在 Linux 平台上,确切地说有 3487 款游戏,这真的是很多了。你可以从宽广的类型中寻找游戏。至于 [数字版权管理(DRM)][6],大多数的 Steam 游戏都有某种 DRM 。 -对于使用 Steam ,要么你将不得不在你的 Linux 系统上安装 [Steam 客户端][7],要么使用 SteamOS。Steam 的一个优势是,在初始化安装后,对于大多数的游戏,你不需要担心依赖关系和复杂的安装过程。 Steam 客户端将为你做重要的任务。 +对于使用 Steam ,要么你必须在你的 Linux 系统上安装 [Steam 客户端][7],要么使用 SteamOS。Steam 的一个优势是,在初始化安装后,对于大多数的游戏,你不需要担心依赖关系和复杂的安装过程。 Steam 客户端将为你做这些繁重的任务。 -[Steam 商店][8] +- [Steam 商店][8] #### 2. GOG -如果你完全对 自由-DRM 游戏感兴趣,GOG 有它的相当多的收集。在这一时刻,GOG 在它们的库中有1978中 自由-DRM 游戏。 GOG 因它的 自由-DRM 游戏的大量的收集而著名。 +如果你只对免 DRM 的游戏感兴趣,GOG 收集了相当多的这种游戏。此刻,GOG 在它们的库中有 1978 种免 DRM 游戏。GOG 因它大量收集了免 DRM 游戏而闻名。 ![GOG 商店][9] -官方的,GOG 游戏支持 Ubuntu LTS 版本和 Linux Mint。所以,Ubuntu 和它的衍生物在安装它们时将没有问题。在其他发行版上安装它们可能需要一些额外的工作,例如 - 安装正确的依赖关系。 +GOG 游戏官方支持 Ubuntu LTS 版本和 Linux Mint。所以,Ubuntu 和它的衍生版在安装它们时将没有问题。在其他发行版上安装它们时可能需要一些额外的工作,例如,你需要安装正确的依赖关系。 -从 GOG 中下载游戏,你将不需要一些额外的客户端。所有购买的游戏将在你的账户部分可用。你可以使用你最爱的下载管理器直接下载它们。 +从 GOG 中下载游戏,你不需要额外的客户端。所有购买的游戏都可在你的账户区内找到。你可以使用你最爱的下载管理器直接下载它们。 -[GOG 商店][10] +- [GOG 商店][10] #### 3. Humble 商店 -Humble -商店是另一个你可以查找 Linux 的各种各样游戏的地方。在 Humble 商店中有 自由-DRM 和 非-自由-DRM 的可用的游戏。非-自由-DRM 游戏通常来自 Steam。在 Humble 商店中,当前有超过1826款 Linux 游戏。 +Humble 商店是另一个你可以查找各种各样 Linux 游戏的地方。在 Humble 商店中有免 DRM 和非免 DRM 的游戏。非免 DRM 游戏通常来自 Steam。在 Humble 商店中,当前有超过 1826 款 Linux 游戏。 ![Humble 商店][11] -Humble 商店因另一个原因而著名。它们有一个被称为 [**Humble 内部包**][12]的程序,在程序它们提供游戏的一个包,在限定时间中带有令人不可抗拒的优惠。 Another thing about关于 Humble 的另一件事是,当你制作一个优惠时,,你的优惠的10%的税收将去慈善机构。 +Humble 商店因另一个原因而著名。它们有一个被称为 [Humble 独立包][12]的活动,其中打包提供了一批游戏,带有令人不可抗拒的限时优惠。关于 Humble 的另一件事是,当你购买时,你的购买金额的 10% 将捐给慈善机构。 -Humble 没有一些额外的客户端来下载它们的游戏, +Humble 不需要额外的客户端来下载它们的游戏。 -[Humble 商店][13] +- [Humble 商店][13] -#### 4. itch.io +#### 4. itch.io 商店 -itch.io 对于致力于独立视频游戏的独立数字创造者是一个开放市场。itch.io 有一些你能找到的最感兴趣的和独特的游戏。在 itch.io 的大多数游戏是 自由-DRM 。 +itch.io 是给独立数字创作者的一个开放市场,其致力于独立视频游戏。itch.io 有一些你能找到的最有趣、最独特的游戏。在 itch.io 的大多数游戏是免 DRM 的。 ![itch.io 商店][14] -现在,itch.io 在它们的商店中有9514款 Linux 平台可用游戏。 +现今,itch.io 在它的商店中有 9514 款 Linux 平台的游戏。 -itch.io 有它们自己的 [客户端][15] 来不费力地下载,安装,更新和玩它们的游戏。 +itch.io 有它自己的 [客户端][15],可以轻松地下载、安装、更新和玩它们的游戏。 -[itch.io 商店][16] +- [itch.io 商店][16] #### 5. LGDB -LGDB 是 Linux 游戏数据库的缩写。虽然技术上不是一个游戏商店,它有x大量的 Linux 游戏收藏,以及关于它们的各种各样的信息。每一款游戏被用你可以找到它们的链接记录。 +LGDB 是 Linux 游戏数据库Linux Game DataBase的缩写。虽然从技术上说它不是一个游戏商店,它收集有大量的 Linux 游戏,以及关于它们的各种各样的信息。每一款游戏都有你可以在哪里找到它们的链接。 ![Linux 游戏数据库][17] -从现在起,在数据库中有2046款游戏入口。[Emulators][18],[Tools][19] 和 [Game Engines][20]也有很长的列表 +如今,在该数据库中有 2046 款游戏。它们也有很长的关于 [模拟器][18]、[工具][19] 和 [游戏引擎][20] 的列表。 -[LGDB][21] +- [LGDB][21] -[令人讨厌的体验,每一个 Linux 游戏者从不想要!][27] +#### 6. Game Jolt 商店 -#### 6. Game Jolt +Game Jolt 有一个非常可观的集合,在它的库藏中大约有 5000 个 Linux 独立游戏。 -Game Jolt 有一个非常可观的收集,在 belt 的区域下大约有5000个 Linux 游戏。 +![Game Jolt 商店][22] -![GameJolt Store][22] +Game Jolt 有一个(预览版)[客户端][23],可用于轻松地下载、安装、更新和玩游戏。 -Game Jolt 有一个(预览版) [client][23] 用于轻松地下载,安装,更新和玩游戏。 - -[Game Jolt Store][24] +- [Game Jolt 商店][24] ### 其他 -这里有很多其他的卖 Linux 游戏的商店。这里也有很多你能找到免费游戏的地方。这是它们中的两个: +有很多其他的销售 Linux 游戏的商店。也有很多你能找到免费游戏的地方。这是它们中的两个: - * [**Bundle Stars**][25]: Bundle Stars 当前有814个 Linux 游戏和31个游戏包。 - * [**GamersGate**][26]: GamersGate 现在有595个 Linux 游戏。它们都是 DRM-free and non-DRM-free games. + * [Bundle Stars][25]:当前有 814 个 Linux 游戏和 31 个游戏包。 + * [GamersGate][26]:现在有 595 个 Linux 游戏。既有免 DRM 的,也有非免 DRM 的。 +#### 应用商店、软件中心 & 软件库 +Linux 发行版有它们自己的应用商店或软件库。尽管不是很多,但是在这里你也能找到各种各样的游戏。 -#### 应用商店,软件中心 & 存储库 - -Linux 发行版有它们自己的应用程序商店或存储库。尽管不是很多,但是在这里你也能找到各种各样的游戏。 - -今天到此为止。你知道这里有这么多 Linux 可用的游戏吗?你使用一些其他的网站来下载 Linux 游戏?与我们分享你的收藏。 +今天到此为止。你知道这里有这么多 Linux 上可玩的游戏吗?你使用一些其他的网站来下载 Linux 游戏吗?与我们分享你的收藏。 -------------------------------------------------------------------------------- @@ -106,12 +102,12 @@ via: https://itsfoss.com/download-linux-games/ 作者:[Munif Tanjim][a] 译者:[robsean](https://github.com/robsean) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://itsfoss.com/author/munif/ -[1]:https://itsfoss.com/linux-gaming-guide/ +[1]:https://linux.cn/article-7316-1.html [2]:https://itsfoss.com/wp-content/uploads/2017/05/download-linux-games-800x450.jpg [3]:http://store.steampowered.com/steamos/ [4]:https://itsfoss.com/linux-gaming-distributions/ From e1e937b5d74f9099a53fded629229608b4cce8fb Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 3 Jan 2019 14:38:30 +0800 Subject: [PATCH 182/322] PUB:20170523 Best Websites to Download Linux Games.md @robsean https://linux.cn/article-10411-1.html --- .../20170523 Best Websites to Download Linux Games.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20170523 Best Websites to Download Linux Games.md (100%) diff --git a/translated/tech/20170523 Best Websites to Download Linux Games.md b/published/20170523 Best Websites to Download Linux Games.md similarity index 100% rename from translated/tech/20170523 Best Websites to Download Linux Games.md rename to published/20170523 Best Websites to Download Linux Games.md From 3b9baabf04420b1466fb91687b3b3695198b53a6 Mon Sep 17 00:00:00 2001 From: lctt-bot Date: Thu, 3 Jan 2019 17:00:20 +0000 Subject: [PATCH 183/322] Revert "translating" This reverts commit 62899945549b1ec2a3a4937612989e96f85cd2ec. --- sources/talk/20170921 The Rise and Rise of JSON.md | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/sources/talk/20170921 The Rise and Rise of JSON.md b/sources/talk/20170921 The Rise and Rise of JSON.md index f6d54edfc9..84a594c89a 100644 --- a/sources/talk/20170921 The Rise and Rise of JSON.md +++ b/sources/talk/20170921 The Rise and Rise of JSON.md @@ -1,12 +1,3 @@ -[#]: collector: (lujun9972) -[#]: translator: (runningwater) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: subject: (The Rise and Rise of JSON) -[#]: via: ( https://twobithistory.org/2017/09/21/the-rise-and-rise-of-json.html) -[#]: author: (https://twobithistory.org) -[#]: url: ( ) - The Rise and Rise of JSON ====== JSON has taken over the world. Today, when any two applications communicate with each other across the internet, odds are they do so using JSON. It has been adopted by all the big players: Of the ten most popular web APIs, a list consisting mostly of APIs offered by major companies like Google, Facebook, and Twitter, only one API exposes data in XML rather than JSON. Twitter, to take an illustrative example from that list, supported XML until 2013, when it released a new version of its API that dropped XML in favor of using JSON exclusively. JSON has also been widely adopted by the programming rank and file: According to Stack Overflow, a question and answer site for programmers, more questions are now asked about JSON than about any other data interchange format. @@ -89,7 +80,7 @@ via: https://twobithistory.org/2017/09/21/the-rise-and-rise-of-json.html 作者:[Two-Bit History][a] 选题:[lujun9972][b] -译者:[runningwater](https://github.com/runningwater) +译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From e4457e89394be4bce3652cfb3a0b7d1ef8fc568d Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 4 Jan 2019 09:09:34 +0800 Subject: [PATCH 184/322] translated --- ...20181217 Working with tarballs on Linux.md | 100 ------------------ ...20181217 Working with tarballs on Linux.md | 100 ++++++++++++++++++ 2 files changed, 100 insertions(+), 100 deletions(-) delete mode 100644 sources/tech/20181217 Working with tarballs on Linux.md create mode 100644 translated/tech/20181217 Working with tarballs on Linux.md diff --git a/sources/tech/20181217 Working with tarballs on Linux.md b/sources/tech/20181217 Working with tarballs on Linux.md deleted file mode 100644 index 2c95f1038f..0000000000 --- a/sources/tech/20181217 Working with tarballs on Linux.md +++ /dev/null @@ -1,100 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Working with tarballs on Linux) -[#]: via: (https://www.networkworld.com/article/3328840/linux/working-with-tarballs-on-linux.html) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -Working with tarballs on Linux -====== -![](https://images.idgesg.net/images/article/2018/12/tarball-100783148-large.jpg) - -The word “tarball” is often used to describe the type of file used to back up a select group of files and join them into a single file. The name comes from the **.tar** file extension and the **tar** command that is used to group together the files into a single file that is then sometimes compressed to make it smaller for its move to another system. - -Tarballs are often used to back up personal or system files in place to create an archive, especially prior to making changes that might have to be reversed. Linux sysadmins, for example, will often create a tarball containing a series of configuration files before making changes to an application just in case they have to reverse those changes. Extracting the files from a tarball that’s sitting in place will generally be faster than having to retrieve the files from backups. - -### How to create a tarball on Linux - -You can create a tarball and compress it in a single step if you use a command like this one: - -``` -$ tar -cvzf PDFs.tar.gz *.pdf -``` - -The result in this case is a compressed (gzipped) file that contains all of the PDF files that are in the current directory. The compression is optional, of course. A slightly simpler command would just put all of the PDF files into an uncompressed tarball: - -``` -$ tar -cvf PDFs.tar *.pdf -``` - -Note that it’s the **z** in that list of options that causes the file to be compressed or “zipped”. The **c** specifies that you are creating the file and the **v** (verbose) indicates that you want some feedback while the command is running. Omit the **v** if you don't want to see the files listed. - -Another common naming convention is to give zipped tarballs the extension **.tgz** instead of the double extension **.tar.gz** as shown in this command: - -``` -$ tar cvzf MyPDFs.tgz *.pdf -``` - -### How to extract files from a tarball - -To extract all of the files from a gzipped tarball, you would use a command like this: - -``` -$ tar -xvzf file.tar.gz -``` - -If you use the .tgz naming convention, that command would look like this: - -``` -$ tar -xvzf MyPDFs.tgz -``` - -To extract an individual file from a gzipped tarball, you do almost the same thing but add the file name: - -``` -$ tar -xvzf PDFs.tar.gz ShenTix.pdf -ShenTix.pdf -ls -l ShenTix.pdf --rw-rw-r-- 1 shs shs 122057 Dec 14 14:43 ShenTix.pdf -``` - -You can even delete files from a tarball if the tarball is not compressed. For example, if we wanted to remove tile file that we extracted above from the PDFs.tar.gz file, we would do it like this: - -``` -$ gunzip PDFs.tar.gz -$ ls -l PDFs.tar --rw-rw-r-- 1 shs shs 10700800 Dec 15 11:51 PDFs.tar -$ tar -vf PDFs.tar --delete ShenTix.pdf -$ ls -l PDFs.tar --rw-rw-r-- 1 shs shs 10577920 Dec 15 11:45 PDFs.tar -``` - -Notice that we shaved a little space off the tar file while deleting the ShenTix.pdf file. We can then compress the file again if we want: - -``` -$ gzip -f PDFs.tar -ls -l PDFs.tar.gz --rw-rw-r-- 1 shs shs 10134499 Dec 15 11:51 PDFs.tar.gzFlickr / James St. John -``` - -The versatility of the command line options makes working with tarballs easy and very convenient. - -Join the Network World communities on [Facebook][1] and [LinkedIn][2] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3328840/linux/working-with-tarballs-on-linux.html - -作者:[Sandra Henry-Stocker][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ -[b]: https://github.com/lujun9972 -[1]: https://www.facebook.com/NetworkWorld/ -[2]: https://www.linkedin.com/company/network-world diff --git a/translated/tech/20181217 Working with tarballs on Linux.md b/translated/tech/20181217 Working with tarballs on Linux.md new file mode 100644 index 0000000000..2b2e493625 --- /dev/null +++ b/translated/tech/20181217 Working with tarballs on Linux.md @@ -0,0 +1,100 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Working with tarballs on Linux) +[#]: via: (https://www.networkworld.com/article/3328840/linux/working-with-tarballs-on-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +在 Linux 上使用 tarball +====== +![](https://images.idgesg.net/images/article/2018/12/tarball-100783148-large.jpg) + +“tarball” 一词通常用于描述备份一组选择的文件并将它们打包在一个文件中的一种文件格式。该名称来自 **.tar** 文件扩展名和 **tar** 命令,它用于将文件打包到一个文件中,然后压缩该文件,使其在移动到其他系统时更小。 + +tarballs 通常用于备份个人或系统文件来创建存档, 特别是在进行可能需要撤消的更改之前。例如,Linux 系统管理员通常会在更改应用之前创建包含一系列配置文件的 tarball,以防必须撤消这些更改。从 tarball 中解压文件通常比在备份中搜索文件快。 + +### 如何在 Linux 上创建 tarball + +使用如下命令,你可以在单条命令中创建并压缩文件。 + +``` +$ tar -cvzf PDFs.tar.gz *.pdf +``` + +这里最后是一个压缩文件 (gzip),其中包含了当前目录中的所有 PDF 文件。当然,压缩是可选的。一个稍微简单的只是将 PDF 文件打包成未压缩 tarball 的命令: + +``` +$ tar -cvf PDFs.tar *.pdf +``` + +注意,选项中的 **z** 将文件变成压缩的。 **c** 表明正在创建文件,**v** (详细)表示你在命令运行时需要一些反馈。如果你不想查看列出的文件,请忽略 **v**。 + +另一个常见的命名约定是给压缩的 tarball 命名成 **.tgz** 而不是双扩展名 **.tar.gz**,如下所示: + +``` +$ tar cvzf MyPDFs.tgz *.pdf +``` + +### 如何从 tarball 中解压文件 + +要从 gzip 压缩包中解压所有文件,你可以使用如下命令: + +``` +$ tar -xvzf file.tar.gz +``` + +如果使用 .tgz 命名约定,该命令将如下所示: + +``` +$ tar -xvzf MyPDFs.tgz +``` + +要从 gzip 包中解压单个文件,你可以执行几乎相同的操作,只需添加文件名: + +``` +$ tar -xvzf PDFs.tar.gz ShenTix.pdf +ShenTix.pdf +ls -l ShenTix.pdf +-rw-rw-r-- 1 shs shs 122057 Dec 14 14:43 ShenTix.pdf +``` + +如果未压缩 tarball,你甚至可以从 tarball 中删除文件。例如,如果我们想从 PDFs.tar.gz 中删除我们上面解压的文件,我们会这样做: + +``` +$ gunzip PDFs.tar.gz +$ ls -l PDFs.tar +-rw-rw-r-- 1 shs shs 10700800 Dec 15 11:51 PDFs.tar +$ tar -vf PDFs.tar --delete ShenTix.pdf +$ ls -l PDFs.tar +-rw-rw-r-- 1 shs shs 10577920 Dec 15 11:45 PDFs.tar +``` + +请注意,我们在删除 ShenTix.pdf 后,缩小了一点 tar 文件占用的空间。如果我们想要,我们可以再次压缩文件: + +``` +$ gzip -f PDFs.tar +ls -l PDFs.tar.gz +-rw-rw-r-- 1 shs shs 10134499 Dec 15 11:51 PDFs.tar.gzFlickr / James St. John +``` + +丰富的命令行选项使得 tarball 使用起来简单方便。 + +在 [Facebook][1] 和 [LinkedIn][2] 中加入 Network World 社区来评论主题。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3328840/linux/working-with-tarballs-on-linux.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.facebook.com/NetworkWorld/ +[2]: https://www.linkedin.com/company/network-world \ No newline at end of file From 196fed6ee2193b1db95636559877768b64b0f8fa Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 4 Jan 2019 09:19:43 +0800 Subject: [PATCH 185/322] translating --- ...181218 Use your Linux terminal to celebrate a banner year.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181218 Use your Linux terminal to celebrate a banner year.md b/sources/tech/20181218 Use your Linux terminal to celebrate a banner year.md index da3f36b00f..c02371d1ed 100644 --- a/sources/tech/20181218 Use your Linux terminal to celebrate a banner year.md +++ b/sources/tech/20181218 Use your Linux terminal to celebrate a banner year.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 9fa7e2770b746db0ac1841fc8fdb7bb238bf8781 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 4 Jan 2019 09:48:19 +0800 Subject: [PATCH 186/322] PRF:20181222 Watch YouTube videos at the Linux terminal.md @geekpi --- ...ch YouTube videos at the Linux terminal.md | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/translated/tech/20181222 Watch YouTube videos at the Linux terminal.md b/translated/tech/20181222 Watch YouTube videos at the Linux terminal.md index 201a911c5b..5a4f008a1e 100644 --- a/translated/tech/20181222 Watch YouTube videos at the Linux terminal.md +++ b/translated/tech/20181222 Watch YouTube videos at the Linux terminal.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Watch YouTube videos at the Linux terminal) @@ -9,20 +9,22 @@ 在 Linux 终端上观看 YouTube 视频 ====== -认为视频只能在 GUI 下看么?再想想。 + +> 视频只能在 GUI 下看么?再想想。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-youtube-dl.png?itok=HYR5vU2a) 我们即将结束为期 24 天的 Linux 命令行玩具日历。希望你一直在看,如果没有,请回到[这里][1]开始,自己试试。你会发现 Linux 终端有很多游戏,消遣和奇怪的东西。 虽然你之前可能已经看过我们日历中的一些玩具,但我们希望对每个人至少有一个新事物。 -今天我们要在昨天的玩具 [MPlayer][2] 上再加上一个 [**youtube-dl**][3]。 +今天我们要在昨天的玩具 [MPlayer][2] 上再加上一个 [youtube-dl][3]。 -正如其名称所暗示的那样,**youtube-dl** 是一个用于下载 YouTube 视频的命令行程序,但它也可以从其他许多站点下载视频,而且它是一个有着[丰富文档][4]的功能齐全的程序,从而使视频获取变得容易。注意:请勿在任何违反你所在司法辖区的版权法的情况下使用 **youtube-dl**。 +正如其名称所暗示的那样,`youtube-dl` 是一个用于下载 YouTube 视频的命令行程序,但它也可以从其他许多站点下载视频,而且它是一个有着[丰富文档][4]的功能齐全的程序,从而使视频获取变得容易。注意:请勿在任何违反你所在司法辖区的版权法的情况下使用 `youtube-dl`。 -**youtube-dl** 使用的是 [Unlicense][5] 这个公共领域许可,类似于 Creative Common 的 [CC0][6]。这里还有哪些公共领域贡献适用于开源领域的[法律意见][7],但它通常被认为与现有的开源许可证兼容,即使是不推荐使用它的组织也是如此。 +`youtube-dl` 使用的是 [Unlicense][5] 这个公共领域许可,类似于 Creative Common 的 [CC0][6]。这里还有哪些公共领域贡献适用于开源领域的[法律意见][7],但它通常被认为与现有的开源许可证兼容,即使是不推荐使用它的组织也是如此。 -最简单地,我们将使用 **youtube-dl** 来获取视频以便在终端中播放。首先,使用适用于你发行版的方法[安装][8]它。对我来说,在 Fedora 中,它被打包在我的仓库中,因此安装非常简单: +最简单地,我们将使用 `youtube-dl` 来获取视频以便在终端中播放。首先,使用适用于你发行版的方法[安装][8]它。对我来说,在 Fedora 中,它被打包在我的仓库中,因此安装非常简单: ``` $ sudo dnf install youtube-dl @@ -34,21 +36,22 @@ $ sudo dnf install youtube-dl $ youtube-dl pec8P5K4s8c -o fireplace.mp4 ``` -如果你昨天没有安装 [MPlayer][2],请继续安装好,如果你之前没有安装 **libcaca** 则需要安装它。如果你直接用 MPlayer 在命令行中播放视频 ( **$****mplayer fireplace.webm** ),它能够播放,但是会在一个自己的窗口中,这不是我们想要的。 +如果你昨天没有安装 [MPlayer][2],请继续安装好,如果你之前没有安装 libcaca 则需要安装它。如果你直接用 MPlayer 在命令行中播放视频 ( `$ mplayer fireplace.webm` ),它能够播放,但是会在一个自己的窗口中,这不是我们想要的。 -首先,我设置将 **libcaca** 强制使用 **ncurses** 作为显示驱动,使输出保持在我的终端: +首先,我设置将 libcaca 强制使用 ncurses 作为显示驱动,使输出保持在我的终端: ``` $ export CACA_DRIVER=ncurses ``` -然后,我放大了终端(“像素”越多越好),并使用以下命令播放文件(强制使用 **libcaca**并静默 MPlayer 的文本输出): +然后,我放大了终端(“像素”越多越好),并使用以下命令播放文件(强制使用 libcaca 并静默 MPlayer 的文本输出): ``` $ mplayer -really-quiet -vo caca fireplace.mp4 ``` 这就完成了! + ![](https://opensource.com/sites/default/files/uploads/linux-toy-youtube-dl.gif) 你有特别喜欢的命令行小玩具需要我介绍的吗?提交今年的建议有点晚了,但我们仍然希望在新的一年里有一些很酷的命令行玩具。请在下面的评论中告诉我,我会查看的。让我知道你对今天的玩具有何看法。 @@ -62,14 +65,14 @@ via: https://opensource.com/article/18/12/linux-toy-youtube-dl 作者:[Jason Baker][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://opensource.com/users/jason-baker [b]: https://github.com/lujun9972 [1]: https://opensource.com/article/18/12/linux-toy-boxes -[2]: https://opensource.com/article/18/12/linux-toy-mplayer +[2]: https://linux.cn/article-10393-1.html [3]: https://rg3.github.io/youtube-dl/ [4]: https://github.com/rg3/youtube-dl/blob/master/README.md#readme [5]: https://unlicense.org/ @@ -77,4 +80,4 @@ via: https://opensource.com/article/18/12/linux-toy-youtube-dl [7]: https://opensource.org/faq#public-domain [8]: https://github.com/rg3/youtube-dl/blob/master/README.md#installation [9]: https://www.youtube.com/watch?v=pec8P5K4s8c -[10]: https://www.youtube.com/channel/UCwwaepmpWZVDd605MIRC20A \ No newline at end of file +[10]: https://www.youtube.com/channel/UCwwaepmpWZVDd605MIRC20A From 80cf767b782036b4f7cf160391f97fa53d96a7cd Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 4 Jan 2019 09:50:29 +0800 Subject: [PATCH 187/322] PUB:20181222 Watch YouTube videos at the Linux terminal.md @geekpi https://linux.cn/article-10412-1.html --- .../20181222 Watch YouTube videos at the Linux terminal.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181222 Watch YouTube videos at the Linux terminal.md (98%) diff --git a/translated/tech/20181222 Watch YouTube videos at the Linux terminal.md b/published/20181222 Watch YouTube videos at the Linux terminal.md similarity index 98% rename from translated/tech/20181222 Watch YouTube videos at the Linux terminal.md rename to published/20181222 Watch YouTube videos at the Linux terminal.md index 5a4f008a1e..55e18d6c20 100644 --- a/translated/tech/20181222 Watch YouTube videos at the Linux terminal.md +++ b/published/20181222 Watch YouTube videos at the Linux terminal.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10412-1.html) [#]: subject: (Watch YouTube videos at the Linux terminal) [#]: via: (https://opensource.com/article/18/12/linux-toy-youtube-dl) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) From 6ebac7ec2ebcfd0f4fc6adb8b3fe4de88cd495a1 Mon Sep 17 00:00:00 2001 From: runningwater Date: Fri, 4 Jan 2019 09:55:19 +0800 Subject: [PATCH 188/322] =?UTF-8?q?=E9=87=8D=E6=96=B0=E7=94=B3=E9=A2=86?= =?UTF-8?q?=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/talk/20170921 The Rise and Rise of JSON.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20170921 The Rise and Rise of JSON.md b/sources/talk/20170921 The Rise and Rise of JSON.md index 84a594c89a..5603c7bacf 100644 --- a/sources/talk/20170921 The Rise and Rise of JSON.md +++ b/sources/talk/20170921 The Rise and Rise of JSON.md @@ -80,7 +80,7 @@ via: https://twobithistory.org/2017/09/21/the-rise-and-rise-of-json.html 作者:[Two-Bit History][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[runningwater](https://github.com/runningwater) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 8ed34440a0a71b04e109d2b23462a60530e379ed Mon Sep 17 00:00:00 2001 From: Bestony Date: Fri, 4 Jan 2019 11:41:38 +0800 Subject: [PATCH 189/322] =?UTF-8?q?docs=20=E7=BF=BB=E8=AF=91=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0 killer tools for the admin in a hurry.md | 72 +++++++------- ...0 killer tools for the admin in a hurry.md | 97 +++++++++++++++++++ 2 files changed, 136 insertions(+), 33 deletions(-) create mode 100644 translated/tech/20180703 10 killer tools for the admin in a hurry.md diff --git a/sources/tech/20180703 10 killer tools for the admin in a hurry.md b/sources/tech/20180703 10 killer tools for the admin in a hurry.md index 87e3e8b309..73fa91b9d4 100644 --- a/sources/tech/20180703 10 killer tools for the admin in a hurry.md +++ b/sources/tech/20180703 10 killer tools for the admin in a hurry.md @@ -1,69 +1,75 @@ -bestony translating - -10 killer tools for the admin in a hurry +10 个供管理员快速使用的杀手工具 ====== ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cloud_tools_hardware.png?itok=PGjJenqT) -Administering networks and systems can get very stressful when the workload piles up. Nobody really appreciates how long anything takes, and everyone wants their specific thing done yesterday. +当工作负载累加时,管理网络和系统变得富有压力。每个人都希望在昨天能够完成他们的具体事务,但没有人能真正意识到需要花费多长时间。 -So it's no wonder so many of us are drawn to the open source spirit of figuring out what works and sharing it with everyone. Because, when deadlines are looming, and there just aren't enough hours in the day, it really helps if you can just find free answers you can implement immediately. +所以难怪我们这么多人都被致力于找出有效的方法并与大家分享的开源精神所吸引。因为,当截止日期来临,并且当天没有足够多的时间时,如果你可以找到立刻施行的免费答案,那会非常有帮助。 -So, without further ado, here's my Swiss Army Knife of stuff to get you out of the office before dinner time. +因此,闲话少叙,下述是我的瑞士军刀,可以保证你在晚饭前离开办公室。 -### Server configuration and scripting +### 服务器配置和脚本 -Let's jump right in. +让我们看一看! **[NixCraft][1]** -Use the site's internal search function. With more than a decade of regular updates, there's gold to be found here—useful scripts and handy hints that can solve your problem straight away. This is often the second place I look after Google. +用于网站内部的搜索功能。经过十多年的定期更新,这里有黄金!有用的脚本和方便的提示可以立刻解决你的问题。这是我一般使用 Google 后的第二个选项。 **[Webmin][2]** -This gives you a nice web interface to remotely edit your configuration files. It cuts down on a lot of time spent having to juggle directory paths and `sudo nano`, which is handy when you're handling several customers. +它提供给你了一个很好的 Web 界面来帮助你远程编辑配置问卷。它减少了大量花费在处理目录路径和 `sudo nano` 上的时间,在你处理多个客户时,非常方便。 -**[Windows Subsystem for Linux][3]** -The reality of the modern workplace is that most employees are on Windows, while the grown-up gear in the server room is on Linux. So sometimes you find yourself trying to do admin tasks from (gasp) a Windows desktop. +**[Windows 下的 Linux 子系统][3]** -What do you do? Install a virtual machine? It's actually much faster and far less work to configure if you install the Windows Subsystem for Linux compatibility layer, now available at no cost on Windows 10. +现代工作场所的现实是大多数员工都运行着 Windows,而服务器机房中增长的设备则运行着 Linux 。因此,有些时候你会发现尝试在 Windows 桌面上执行管理任务。 -This gives you a Bash terminal in a window where you can run Bash scripts and Linux binaries on the local machine, have full access to both Windows and Linux filesystems, and mount network drives. It's available in Ubuntu, OpenSUSE, SLES, Debian, and Kali flavors. +你怎么做?装一个虚拟机?如果安装目前 Windows 10 中免费提供的 Linux 子系统的兼容层,实际上要快得多,配置文件要少的多。 + +这为你提供了一个 Bash 终端窗口,你可以在这个窗口中执行本地计算机上的 Bash 脚本和 Linux 二进制问卷,可以完全访问 Windows 和 Linux 问卷系统,以及安装网络驱动器。它包含 Ubuntu 、OpenSUSE、SLES、Debian和 Kali 发行版。 **[mRemoteNG][4]** -This is an excellent SSH and remote desktop client for when you have 100+ servers to manage. +当你有 100 + 服务器需要去管理时,这会是一个出色的 SSH 和远程桌面客户端。 -### Setting up a network so you don't have to do it again +### 设置网络,这样你就无需再这样做了。 -A poorly planned network is the sworn enemy of the admin who hates working overtime. +一个考虑不周的网络是厌恶加班的管理员的死敌。 -**[IP Addressing Schemes that Scale][5]** -The diabolical thing about running out of IP addresses is that, when it happens, the network's grown large enough that a new addressing scheme is an expensive, time-consuming pain in the proverbial. +**[可拓展的 IP 寻址方案][5]** -Ain't nobody got time for that! +IP 地址耗尽的可怕之处在于,当 IP 地址耗尽时,网络已经变的足够大,而新的寻址方案是众所周知的昂贵、令人痛苦的耗时。 -At some point, IPv6 will finally arrive to save the day. Until then, these one-size-fits-most IP addressing schemes should keep you going, no matter how many network-connected wearables, tablets, smart locks, lights, security cameras, VoIP headsets, and espresso machines the world throws at us. +没有人有时间做这件事! -**[Linux Chmod Permissions Cheat Sheet][6]** -A short but sweet cheat sheet of Bash commands to set permissions across the network. This is so when Bill from Customer Service falls for that ransomware scam, you're recovering just his files and not the entire company's. +到了某个时候,IPv6 终将到来,来拯救这世界。在那之前,无论世界向我们扔了多少可穿戴设备、平板电脑、智能锁、灯、安全摄像头、VoIP耳机和浓缩咖啡机,这些一刀切的IP 寻址方案都应该让我们继续前行。 -**[VLSM Subnet Calculator][7]** -Just put in the number of networks you want to create from an address space and the number of hosts you want per network, and it calculates what the subnet mask should be for everything. -### Single-purpose Linux distributions +**[Linux Chmod 权限备忘录][6]** -Need a Linux box that does just one thing? It helps if someone else has already sweated the small stuff on an operating system you can install and have ready immediately. +一个简短但是有用的 Bash 命令备忘录可以帮助你通过网络设置权限。所以,客户服务部的账单落入到勒索软件骗局时,你可以只恢复他们的文件,而不是整个公司的文件。 -Each of these has, at one point, made my work day so much easier. +**[VLSM 子网计算器][7]** + +只需要输入你想要从地址空间中创建的网络的数量,以及每个网络所需要的主机数量,它就可以计算出所有的子网掩码应该是什么。 + +### 单一用途的 Linux 发行版 + +需要一个只一件事的 Linux 容器?如果其他人已经在操作系统上花了很多钱,它可以帮助你快速安装并准备好一个操作系统。 + +下面这些每一个都使得我的工作变得轻松了许多。 **[Porteus Kiosk][8]** -This is for when you want a computer totally locked down to just a web browser. With a little tweaking, you can even lock the browser down to just one website. This is great for public access machines. It works with touchscreens or with a keyboard and mouse. +这个工具用来帮你在一台锁定的电脑上打开一个浏览器。通过稍稍一些调整,你甚至可以把浏览器锁定在一个特定的网站上。它对于公共访问机器来说非常方便。它可以与触摸屏或键盘鼠标配合使用。 **[Parted Magic][9]** -This is an operating system you can boot from a USB drive to partition hard drives, recover data, and run benchmarking tools. +这是一个你可以从 USB 驱动器启动的可以用来划分磁盘驱动器、恢复数据并运行基准测试工具的操作系统。 **[IPFire][10]** -Hahahaha, I still can't believe someone called a router/firewall/proxy combo "I pee fire." That's my second favorite thing about this Linux distribution. My favorite is that it's a seriously solid software suite. It's so easy to set up and configure, and there is a heap of plugins available to extend it. -So, how about you? What tools, resources, and cheat sheets have you found to make the workday easier? I'd love to know. Please share in the comments. +啊哈~我还是不敢相信有人吧路由器/防火墙/代理组合成为“我尿火”(译者注:IPFire 和 “I pee Fire“ 同音)。这是我在这个 Linux 发行版中第二喜欢的东西。我最喜欢的是它是一个非常可靠的软件套件,设置和配置十分容易,而且有一系列的插件可以拓展它。 + +那么,你呢?你发现了哪些工具、资源和备忘录可以让我们的工作日更加的轻松? + +我很高兴知道,请在评论中分享您的工具。 -------------------------------------------------------------------------------- @@ -71,7 +77,7 @@ via: https://opensource.com/article/18/7/tools-admin 作者:[Grant Hamono][a] 选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) +译者:[bestony](https://github.com/bestony) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/translated/tech/20180703 10 killer tools for the admin in a hurry.md b/translated/tech/20180703 10 killer tools for the admin in a hurry.md new file mode 100644 index 0000000000..8fc7d36474 --- /dev/null +++ b/translated/tech/20180703 10 killer tools for the admin in a hurry.md @@ -0,0 +1,97 @@ +10 个供管理员快速使用的杀手工具 +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cloud_tools_hardware.png?itok=PGjJenqT) + +当工作负载累计时,管理网络和系统变得富有压力。没有人能真正意识到需要花费多长时间,每个人都希望在昨天能够完成他们的具体事务。 + +所以难怪我们这么多人都被致力于找出有效的方法并与大家分享的开源精神所吸引。因为,当截止日期来临,并且当天没有足够多的时间时,如果你可以找到立刻施行的免费答案,那会非常有帮助。 + +So, without further ado, here's my Swiss Army Knife of stuff to get you out of the office before dinner time. + +因此,闲话少叙,下述是我的瑞士军刀,可以保证你在晚饭前离开办公室。 + +### 服务器配置和脚本 + +让我们看一看! + +**[NixCraft][1]** +用于网站内部的搜索功能。经过十多年的定期更新,这里有黄金!有用的脚本和方便的提示可以立刻解决你的问题。这是我一般使用 Google 后的第二个选项。 + +**[Webmin][2]** +它提供给你了一个很好的 Web 界面来帮助你远程编辑配置问卷。它减少了大量花费在处理目录路径和 `sudo nano` 上的时间,在你处理多个客户时,非常方便。 + +**[Windows 下的 Linux 子系统][3]** + +现代工作场所的现实是大多数员工都运行着 Windows,而服务器机房中增长的设备则运行着 Linux 。因此,有些时候你会发现尝试在 Windows 桌面上执行管理任务。 + +你怎么做?装一个虚拟机?如果安装目前 Windows 10 中免费提供的 Linux 子系统的兼容层,实际上要快得多,配置文件要少的多。 + +这为你提供了一个 Bash 终端窗口,你可以在这个窗口中执行本地计算机上的 Bash 脚本和 Linux 二进制问卷,可以完全访问 Windows 和 Linux 问卷系统,以及安装网络驱动器。它包含 Ubuntu 、OpenSUSE、SLES、Debian和 Kali 发行版。 + +**[mRemoteNG][4]** +当你有 100 + 服务器需要去管理时,这会是一个出色的 SSH 和远程桌面客户端。 + +### 设置网络,这样你就无需再这样做了。 + +一个考虑不周的网络是厌恶加班管理员的死敌。 + +**[可拓展的 IP 寻址方案][5]** + +IP 地址耗尽的可怕之处在于,当 IP 地址耗尽时,网络已经变的足够大,而新的寻址方案是众所周知的昂贵、令人痛苦的耗时。 + +没有人有时间做这件事! + +到了某个时候,IPv6 终将到来,来拯救这世界。在那之前,无论世界向我们扔了多少可穿戴设备、平板电脑、智能锁、灯、安全摄像头、VoIP耳机和浓缩咖啡机,这些一刀切的IP 寻址方案都应该让我们继续前行。 + + +**[Linux Chmod 权限备忘录][6]** + +一个简短但是有用的 Bash 命令备忘录可以帮助你通过网络设置权限。所以,客户服务部的账单落入到勒索软件骗局时,你可以只恢复他们的文件,而不是整个公司的文件。 + +**[VLSM 子网计算器][7]** + +只需要输入你想要从地址空间中创建的网络的数量,以及每个网络所需要的主机数量,它就可以计算出所有的子网掩码应该是什么。 + +### 单一用途的 Linux 发行版 + +需要一个只一件事的 Linux 容器?如果其他人已经在操作系统上花了很多钱,它可以帮助你快速安装并准备好一个操作系统。 + +下面这些每一个都使得我的工作变得轻松了许多。 + +**[Porteus Kiosk][8]** +这个工具用来帮你在一台锁定的电脑上打开一个浏览器。通过稍稍一些调整,你甚至可以把浏览器锁定在一个特定的网站上。它对于公共访问机器来说非常方便。它可以与触摸屏或键盘鼠标配合使用。 + +**[Parted Magic][9]** +这是一个你可以从 USB 驱动器启动的可以用来划分磁盘驱动器、恢复数据并运行基准测试工具的操作系统。 + +**[IPFire][10]** + +啊哈~我还是不敢相信有人吧路由器/防火墙/代理组合成为“我尿火”(译者注:IPFire 和 “I pee Fire“ 同音)。这是我在这个 Linux 发行版中第二喜欢的东西。我最喜欢的是它是一个非常可靠的软件套件,设置和配置十分容易,而且有一系列的插件可以拓展它。 + +那么,你呢?你发现了哪些工具、资源和备忘录可以让我们的工作日更加的轻松? + +我很高兴知道,请在评论中分享您的工具。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/7/tools-admin + +作者:[Grant Hamono][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[bestony](https://github.com/bestony) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/grantdxm +[1]:https://www.cyberciti.biz/ +[2]:http://www.webmin.com/ +[3]:http://wsl-guide.org/en/latest/ +[4]:https://mremoteng.org/ +[5]:https://blog.dxmtechsupport.com.au/ip-addressing-for-a-small-business-that-might-grow/ +[6]:https://isabelcastillo.com/linux-chmod-permissions-cheat-sheet +[7]:http://www.vlsm-calc.net/ +[8]:http://porteus-kiosk.org/ +[9]:https://partedmagic.com/ +[10]:https://www.ipfire.org/ From ec4940d3083f3f5728a0d432fbc0bf3a427445f8 Mon Sep 17 00:00:00 2001 From: Bestony Date: Fri, 4 Jan 2019 11:49:44 +0800 Subject: [PATCH 190/322] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0 killer tools for the admin in a hurry.md | 95 ------------------- 1 file changed, 95 deletions(-) delete mode 100644 sources/tech/20180703 10 killer tools for the admin in a hurry.md diff --git a/sources/tech/20180703 10 killer tools for the admin in a hurry.md b/sources/tech/20180703 10 killer tools for the admin in a hurry.md deleted file mode 100644 index 73fa91b9d4..0000000000 --- a/sources/tech/20180703 10 killer tools for the admin in a hurry.md +++ /dev/null @@ -1,95 +0,0 @@ -10 个供管理员快速使用的杀手工具 -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cloud_tools_hardware.png?itok=PGjJenqT) - -当工作负载累加时,管理网络和系统变得富有压力。每个人都希望在昨天能够完成他们的具体事务,但没有人能真正意识到需要花费多长时间。 - -所以难怪我们这么多人都被致力于找出有效的方法并与大家分享的开源精神所吸引。因为,当截止日期来临,并且当天没有足够多的时间时,如果你可以找到立刻施行的免费答案,那会非常有帮助。 - -因此,闲话少叙,下述是我的瑞士军刀,可以保证你在晚饭前离开办公室。 - -### 服务器配置和脚本 - -让我们看一看! - -**[NixCraft][1]** -用于网站内部的搜索功能。经过十多年的定期更新,这里有黄金!有用的脚本和方便的提示可以立刻解决你的问题。这是我一般使用 Google 后的第二个选项。 - -**[Webmin][2]** -它提供给你了一个很好的 Web 界面来帮助你远程编辑配置问卷。它减少了大量花费在处理目录路径和 `sudo nano` 上的时间,在你处理多个客户时,非常方便。 - -**[Windows 下的 Linux 子系统][3]** - -现代工作场所的现实是大多数员工都运行着 Windows,而服务器机房中增长的设备则运行着 Linux 。因此,有些时候你会发现尝试在 Windows 桌面上执行管理任务。 - -你怎么做?装一个虚拟机?如果安装目前 Windows 10 中免费提供的 Linux 子系统的兼容层,实际上要快得多,配置文件要少的多。 - -这为你提供了一个 Bash 终端窗口,你可以在这个窗口中执行本地计算机上的 Bash 脚本和 Linux 二进制问卷,可以完全访问 Windows 和 Linux 问卷系统,以及安装网络驱动器。它包含 Ubuntu 、OpenSUSE、SLES、Debian和 Kali 发行版。 - -**[mRemoteNG][4]** -当你有 100 + 服务器需要去管理时,这会是一个出色的 SSH 和远程桌面客户端。 - -### 设置网络,这样你就无需再这样做了。 - -一个考虑不周的网络是厌恶加班的管理员的死敌。 - -**[可拓展的 IP 寻址方案][5]** - -IP 地址耗尽的可怕之处在于,当 IP 地址耗尽时,网络已经变的足够大,而新的寻址方案是众所周知的昂贵、令人痛苦的耗时。 - -没有人有时间做这件事! - -到了某个时候,IPv6 终将到来,来拯救这世界。在那之前,无论世界向我们扔了多少可穿戴设备、平板电脑、智能锁、灯、安全摄像头、VoIP耳机和浓缩咖啡机,这些一刀切的IP 寻址方案都应该让我们继续前行。 - - -**[Linux Chmod 权限备忘录][6]** - -一个简短但是有用的 Bash 命令备忘录可以帮助你通过网络设置权限。所以,客户服务部的账单落入到勒索软件骗局时,你可以只恢复他们的文件,而不是整个公司的文件。 - -**[VLSM 子网计算器][7]** - -只需要输入你想要从地址空间中创建的网络的数量,以及每个网络所需要的主机数量,它就可以计算出所有的子网掩码应该是什么。 - -### 单一用途的 Linux 发行版 - -需要一个只一件事的 Linux 容器?如果其他人已经在操作系统上花了很多钱,它可以帮助你快速安装并准备好一个操作系统。 - -下面这些每一个都使得我的工作变得轻松了许多。 - -**[Porteus Kiosk][8]** -这个工具用来帮你在一台锁定的电脑上打开一个浏览器。通过稍稍一些调整,你甚至可以把浏览器锁定在一个特定的网站上。它对于公共访问机器来说非常方便。它可以与触摸屏或键盘鼠标配合使用。 - -**[Parted Magic][9]** -这是一个你可以从 USB 驱动器启动的可以用来划分磁盘驱动器、恢复数据并运行基准测试工具的操作系统。 - -**[IPFire][10]** - -啊哈~我还是不敢相信有人吧路由器/防火墙/代理组合成为“我尿火”(译者注:IPFire 和 “I pee Fire“ 同音)。这是我在这个 Linux 发行版中第二喜欢的东西。我最喜欢的是它是一个非常可靠的软件套件,设置和配置十分容易,而且有一系列的插件可以拓展它。 - -那么,你呢?你发现了哪些工具、资源和备忘录可以让我们的工作日更加的轻松? - -我很高兴知道,请在评论中分享您的工具。 - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/7/tools-admin - -作者:[Grant Hamono][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[bestony](https://github.com/bestony) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://opensource.com/users/grantdxm -[1]:https://www.cyberciti.biz/ -[2]:http://www.webmin.com/ -[3]:http://wsl-guide.org/en/latest/ -[4]:https://mremoteng.org/ -[5]:https://blog.dxmtechsupport.com.au/ip-addressing-for-a-small-business-that-might-grow/ -[6]:https://isabelcastillo.com/linux-chmod-permissions-cheat-sheet -[7]:http://www.vlsm-calc.net/ -[8]:http://porteus-kiosk.org/ -[9]:https://partedmagic.com/ -[10]:https://www.ipfire.org/ From b843a8fb1030c5cb2840a7ebf642c340852cb19c Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 4 Jan 2019 12:08:22 +0800 Subject: [PATCH 191/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20to=20create?= =?UTF-8?q?=20presentations=20with=20Beamer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...How to create presentations with Beamer.md | 138 ++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 sources/tech/20190103 How to create presentations with Beamer.md diff --git a/sources/tech/20190103 How to create presentations with Beamer.md b/sources/tech/20190103 How to create presentations with Beamer.md new file mode 100644 index 0000000000..68997a146d --- /dev/null +++ b/sources/tech/20190103 How to create presentations with Beamer.md @@ -0,0 +1,138 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to create presentations with Beamer) +[#]: via: (https://opensource.com/article/19/1/create-presentations-beamer) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +How to create presentations with Beamer +====== +Beamer brings LaTeX's powerful typesetting features and ecosystem to creating slides. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bus_presentation.png?itok=CQeyO61b) + +[Beamer][1] is a LaTeX package for generating presentation slide decks. One of its nicest features is that it can take advantage of LaTeX's powerful typesetting system and all the other packages in its ecosystem. For example, I often use LaTeX's [listings][2] package in Beamer presentations that include code. + +### Starting a presentation + +To begin a Beamer document, enter: + +``` +\documentclass{beamer} +``` + +As you would with any other LaTeX document, add any packages you want to use. For example, to use the **listings** package, enter: + +``` +\usepackage{listings} +``` + +Place all content inside the **document** environment: + +``` +\begin{document} +``` + +Beamer documents are usually a sequence of **frame** environments. Frames that contain code should be marked **fragile** : + +``` +\begin{frame}[fragile] +``` + +Begin your frames with a title: + +``` +\frametitle{Function to Do Stuff} +``` + +### Testing your code before you present it + +One of the worst feelings in the world is giving a talk and realizing, as you walk through the code, that there is a glaring bug in it—maybe a misspelled keyword or an unclosed brace. + +The solution is to test code that is presented. In most presentation environments, this means creating a separate file, writing tests, then copying and pasting. + +However, with Beamer, there is a better way. Imagine you have a file named **do_stuff.py** that contains code. You can write tests for the **do_stuff.py** code in a second file, which you call **test_do_stuff.py** , and can exercise it with, say, [pytest][3]. However, most of the lines in **do_stuff.py** lack pedagogic value, like defining helper functions. + +To simplify things for your audience, you can import just the lines you want to talk about into the frame in your presentation : + +``` +\lstinputlisting[ +    language=Python, +    firstline=8, +    lastline=15 +]{do_stuff.py} +``` + +Since you will be talking through those lines (from 8 to 15), you don't need any other content on the slide. Close the frame: + +``` +\end{frame} +``` + +On the next slide, you want to show a usage example for the **do_stuff()** function you just presented: + +``` +\begin{frame}[fragile] +\frametitle{Calling Function to Do Stuff} +\lstinputlisting[ +    language=Python, +    firstline=17, +    lastline=19 +]{do_stuff.py} +\end{frame} +``` + +You use the same file, but this time you show the lines that call the function. Finally, close the document: + +``` +\end{document} +``` + +Assuming you have an appropriate Python file in **do_stuff.py** , this will produce a short two-slide presentation. + +Beamer also supports necessary features such as progressive revelation, showing only one bullet at a time to prevent the audience from being distracted by reading ahead.": **\pause** inside a list will divide bullets into pages: + +``` +\begin{frame} +Remember: +\begin{itemize} +\item This will show up on the first slide. \pause +\item This will show up on the +      second slide, as well as the preceding point. \pause +\item Finally, on the third slide, +       all three bullets will show up. +\end{frame} +``` + +### Creating handouts + +My favorite feature in Beamer is that you can set it to ignore everything outside a frame with **\documentclass[ignorenonframetext]{beamer}**. When I prepare a presentation, I leave off the top (where the document class is declared) and auto-generate two versions of it: one with Beamer that ignores all text outside any frame, which I use for my presentation, and one with a header like: + +``` +\documentclass{article} +\usepackage{beamerarticle} +``` + +which generates a handout—a PDF that has all the frames and all the text between them. + +When a conference organizer asks me to publish my slides, I include the original slide deck as a reference, but the main thing I like people to have is the handout, which has all the explanatory text that I don't want to include on the slide deck itself. + +When creating presentation slides, people often wonder whether it's better to optimize their materials for the presentation or for people who want to read them afterward. Fortunately, Beamer provides the best of both worlds. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/create-presentations-beamer + +作者:[Moshe Zadka][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/moshez +[b]: https://github.com/lujun9972 +[1]: https://www.overleaf.com/learn/latex/Beamer +[2]: https://www.overleaf.com/learn/latex/Code_listing +[3]: https://docs.pytest.org/en/latest/ From 7a5ff89805b90c4dd533f2df1ca7f01af3342e26 Mon Sep 17 00:00:00 2001 From: Bestony <13283837+bestony@users.noreply.github.com> Date: Fri, 4 Jan 2019 12:10:46 +0800 Subject: [PATCH 192/322] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0181212 5 resolutions for open source project maintainers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20181212 5 resolutions for open source project maintainers.md b/sources/talk/20181212 5 resolutions for open source project maintainers.md index 122cc3f2d2..8004b05745 100644 --- a/sources/talk/20181212 5 resolutions for open source project maintainers.md +++ b/sources/talk/20181212 5 resolutions for open source project maintainers.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (bestony) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 05fe7c392607434546ac2f77e08474e1f94f2b09 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 4 Jan 2019 12:50:43 +0800 Subject: [PATCH 193/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Computer=20Labora?= =?UTF-8?q?tory=20=E2=80=93=20Raspberry=20Pi:=20Lesson=200=20Introduction?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...y - Raspberry Pi- Lesson 0 Introduction.md | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 sources/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md diff --git a/sources/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md b/sources/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md new file mode 100644 index 0000000000..f7d0af8187 --- /dev/null +++ b/sources/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md @@ -0,0 +1,53 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 0 Introduction) +[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html) +[#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) + +Computer Laboratory – Raspberry Pi: Lesson 0 Introduction +====== + +This introductory lesson does not contain a practical element, but exists to explain the basic concepts of what is an operating system, what is assembly code and other important basics. If you just want to get straight into practicals, it should be safe to skip this lesson. + +### 1 Operating Systems + +An operating system is just a very complicated program. It has the job of organising other programs on a computer, including sharing the computer's time, memory, hardware and other resources. Some big families of desktop operating systems that you may have heard of include GNU/Linux, Mac OS X and Microsoft Windows. Other devices also need operating systems such as phones, which may use operating systems such as Android, iOS and Windows Phone.[1] + +Since the operating system has to interact with the hardware on a computer system, it also has to have specific knowledge of the hardware on a system. To allow operating systems to be used on a variety of computers, the concept of **drivers** was invented. Drivers are small bits of code that can be added and removed from the operating system in order to allow the operating system to talk to a particular piece of hardware. In this course, we do not cover how to create such removable drivers, and instead focus on making specific ones for the Raspberry Pi. + +There are all kinds of different designs of operating systems, and this course can only just scratch the surface. In this course we will mainly focus on getting the operating system to interact with a variety of bits of hardware, as this is often the trickiest bit, and the part for which the least documentation and help exists online. + +### 2 Assembly Code + +``` +A processor can often perform millions of instructions per second, but they must be simple. +``` + +This course will be written almost exclusively in assembly code. Assembly code is code that is very close to what the computer understands. How a computer really works is that there is a small device called a processor which is capable of performing simple jobs like adding numbers, and there is a set of one or more microchips called the **RAM** which are capable of storing numbers. When a computer has power, the processor works through a sequence of instructions given to it by the programmer, which cause it to change numbers in the RAM, and interact with connected hardware. Assembly code is a translation into human readable text of those commands. + +When programming normally, the programmer writes code in a programming language such as C++, Java, C#, Basic, etc, and then a program called the compiler translates what the programmer wrote into assembly code, which is the further reduced into binary code[2]. Binary code is what the computer actually understands, but it is almost impossible for humans to read. Assembly code is much better, but it can be frustrating how few commands are possible. Remember that every command you write in assembly code is something that the processor understands directly, and so the commands are simple by design, as a physical circuit must process each one. + +![Compiler process][1] + +Just like with ordinary programming, there are many different assembly code languages, however unlike ordinary programming, the reason these exist is due to the fact that there exists many different processors, each designed to understand a different language. Thus a program written in assembly code for one machine, will not work on a different one. For most things, this would be a disaster as each program would have to be rewritten for every system it was used on, but for operating systems this isn't so much of a problem, as it would have to be rewritten anyway due to differing hardware. Nevertheless, most operating systems are written in C++ or C, so that they can be converted more easily, and only the sections that absolutely have to be written in assembly are. + +You're now ready to move on to the first lesson, [Lesson 1: OK01][2] + +-------------------------------------------------------------------------------- + +via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html + +作者:[Robert Mullins][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://www.cl.cam.ac.uk/~rdm34 +[b]: https://github.com/lujun9972 +[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/compiling.png +[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html From 83e0919b98337f22a9d6c6f625aa9a75f1a04dd5 Mon Sep 17 00:00:00 2001 From: Lintaov587 <35831750+Lintaov587@users.noreply.github.com> Date: Fri, 4 Jan 2019 15:01:01 +0800 Subject: [PATCH 194/322] =?UTF-8?q?=20=E7=94=B3=E9=A2=86=E5=8E=9F=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 申领原文 --- ...8 How to create a free baby monitoring system with Gonimo.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20170928 How to create a free baby monitoring system with Gonimo.md b/sources/tech/20170928 How to create a free baby monitoring system with Gonimo.md index 0b68b7967a..a224e8d4f3 100644 --- a/sources/tech/20170928 How to create a free baby monitoring system with Gonimo.md +++ b/sources/tech/20170928 How to create a free baby monitoring system with Gonimo.md @@ -1,3 +1,5 @@ +lintaov587 is translating + How to create a free baby monitoring system with Gonimo ====== ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/baby.png?itok=7jyDs9vE) From 7b7341fe1911f23da02c939495000c02293d07fc Mon Sep 17 00:00:00 2001 From: Lintaov587 <35831750+Lintaov587@users.noreply.github.com> Date: Fri, 4 Jan 2019 15:06:13 +0800 Subject: [PATCH 195/322] Update 20170928 How to create a free baby monitoring system with Gonimo.md --- ...free baby monitoring system with Gonimo.md | 82 +++++++++---------- 1 file changed, 39 insertions(+), 43 deletions(-) diff --git a/sources/tech/20170928 How to create a free baby monitoring system with Gonimo.md b/sources/tech/20170928 How to create a free baby monitoring system with Gonimo.md index a224e8d4f3..3f52c8be4a 100644 --- a/sources/tech/20170928 How to create a free baby monitoring system with Gonimo.md +++ b/sources/tech/20170928 How to create a free baby monitoring system with Gonimo.md @@ -1,119 +1,115 @@ -lintaov587 is translating - -How to create a free baby monitoring system with Gonimo +如何用Gonimo创建一个免费的婴儿监视系统 ====== ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/baby.png?itok=7jyDs9vE) -New and expecting parents quickly learn that there is a long--and expensive--list of equipment that a new baby needs. High on that list is a baby monitor, so they can keep an eye (and an ear) on their infant while they're doing other things. But this is one piece of equipment that doesn't have to eat into your baby fund; Gonimo is a free and open source solution that turns existing devices into a baby monitoring system, freeing up some of your baby budget for any of the thousands of other must-have or trendy items lining the aisles of the nearby big-box baby store. +新父母和准父母很快就会知道将会有一个长且昂贵的新生儿所需设备的清单,清单中的首位是一个婴儿监视器,借此他们可以在做其他事情时照看自己的婴儿,但这儿有一件不必消耗你的婴儿经费的设备,Gonimo 是一个可以将现有的设备转换成婴儿监控系统的免费的开源解决方案,为附近大型婴儿用品商店的过道中数以千计的其他必备或时尚物品中的任何一个腾出一些婴儿的预算。 -Gonimo was born when its developer, an open source fan, had twins and found problems with the existing options: +Gonimo诞生时,它的开发者,一个有双胞胎的开源粉丝,发现现有选择存在问题: - * Status-quo hardware baby monitors are expensive, have limited range, and require you to carry extra devices. - * There are mobile monitoring apps, but most of the existing iOS/Android baby monitoring apps are unreliable and unsecure, with no obvious open source product in sight. - * If you have two young children (e.g., twins), you'll need two monitors, doubling your costs. + * 现有硬件婴儿监视器价格昂贵,范围有限,需要您携带额外的设备。 + * 虽然有移动监控应用程序,但大多数现有的iOS / Android婴儿监控应用程序都不可靠且不安全,没有明显的开源产品。 + * 如果您有两个小孩(例如双胞胎),您将需要两台监视器,使您的成本翻倍。 -Gonimo was created as an open source solution to the shortcomings of typical monitors: +Gonimo是作为一个典型监视器缺点的开源解决方案而创建的: - * Expensive? Nope, it is free! - * Limited range? No, it works with internet/WiFi, wherever you are. - * Download and install apps? Uh-uh, it works in your existing web browser. - * Buy new devices? No way, you can use any laptop, mobile phone, or tablet with a web browser and a microphone and/or camera. + * 昂贵? 不,它是免费的! + * 范围有限? 不,它适用于互联网/ WiFi,无论您身在何处。 + * 下载并安装应用程序? 噢不,它适用于您现有的网络浏览器。 + * 购买新设备? 不用,你可以使用任何笔记本电脑,手机或平板电脑与网络浏览器和麦克风和/或相机。 -(Note: Apple iOS devices are unfortunately not yet supported, but that's expected to change very soon--read on for how you can help make that happen.) +(注意:遗憾的是,Apple iOS设备尚不支持,但预计很快就会发生变化 - 请继续阅读,了解如何帮助实现这一目标。) -### Get started +### 开始 -Transforming your devices into a baby monitor is easy. From your device's browser (ideally Chrome), visit [gonimo.com][1] and click Start baby monitor to get to the web app. +将您的设备转换为婴儿监视器很容易。 从您设备的浏览器(理想情况下为Chrome),访问 [gonimo.com] [1]并单击启动婴儿监视器以访问Web应用程序。 - 1. **Create family:** On the first-time startup screen, you will see a cute rabbit running on the globe. This is where you create a new family. Hit the **+** button and either accept the randomly generated family name or type in your own choice. + 1. **创建家庭:** 在第一次启动屏幕上,你会看到一只可爱的兔子在地球上奔跑。 这是您创建新家庭的地方。 单击 **+** 按钮并接受随机生成的姓氏或键入您自己的选择。 ![Start screen][3] -Create a new family from the start screen +从开始屏幕创建一个新家庭 - 1. **Invite devices:** After you've set up your family, the next screen directs you to invite another device to join your Gonimo family. There is a one-time invitation link that you can directly send via email or copy and paste into a message. From the other device, simply open the link and accept the invitation. Repeat this process for any other devices you'd like to invite to your family. Your devices are now in the same family, ready to cooperate as a fully working baby monitor system. + 1. **邀请设备:** 建立完家庭以后,下个屏幕将指示您邀请其他设备加入你的Gonimo家庭。您可以通过电子邮件直接发送一次性邀请链接,也可以将其复制并粘贴到邮件中。对其他设备,只需打开链接并接受邀请。对您要邀请的任何其他设备重复此过程。 您的设备现在属于同一家庭,可以作为一个完全正常工作的婴儿监视器系统进行配合。 ![Invite screen][5] -Invite family members +邀请家庭成员 - 1. **Start baby station stream:** Next, choose which device will stream the baby's audio and video to the parent station by going to the [Gonimo home screen][6], clicking on the button with the pacifier, and giving the web browser permission to access the device's microphone and camera. Adjust the camera to point at your baby's bed, or turn it off to save device battery (audio will still be streamed). Hit Start. The stream is now active. + 1. **启动婴儿工作站流:** 接下来,通过转到 [Gonimo home screen][6],点击带有奶嘴的按钮,并允许网络浏览器访问设备的麦克风和摄像头,选择将婴儿的音频和视频流式传输到父母的设备。 调整相机以指向宝宝的床,或关闭它以节省设备电池(音频仍将流式传输)。 点击开始。 该流现在处于活动状态。 ![Select baby station][8] -Select the baby station +选择婴儿站 ![Press Start][10] -Press Start to stream video. - - 1. **Connect to parent station stream:** To view the baby station stream, go to another device in your Gonimo family --this is the parent station. Hit the "parent" button on the Gonimo home screen. You will see a list of all the devices in the family; next to the one with the active baby station will be a pulsing Connect button. Select Connect, and you can see and hear your baby over a peer-to-peer audio/video stream. A volume bar provides visualization for the transmitted audio stream. +按“Start”开始以流式传输视频 + 1. **连接到双亲站流:** 要查看婴儿站流,请转到Gonimo家族中的其他设备 - 这是双亲站。 点击Gonimo主屏幕上的“Parent”按钮。 您将看到该系列中所有设备的列表; 旁边有一个活跃的婴儿站将是一个短时连接按钮。 选择连接,您可以通过点对点音频/视频流看到和听到您的宝宝。 音量条为传输的音频流提供可视化。 ![Select parent station][12] -Select parent station +选择双亲站 ![Press Connect][14] -Press Connect to start viewing the baby stream. +按下“Connect”开始观看婴儿流。 - 1. **Congratulations!** You have successfully transformed your devices into a baby monitor directly over a web browser without downloading or installing any apps! + 1. **恭喜!** 您已成功将设备直接通过网络浏览器转换为婴儿监视器,无需下载或安装任何应用程序! -For more information and detailed descriptions about renaming devices, removing devices from a family, or deleting a family, check out the [video tutorial][15] at gonimo.com. +有关重命名设备,从系列中删除设备或删除系列的详细信息和详细说明,请查看 [video tutorial][15] 在 gonimo.com。 -### Flexibility of the family system +### 家庭系统的灵活性 -One of Gonimo's strengths is its family-based system, which offers enormous flexibility for different kinds of situations that aren't available even in commercial Android or iOS apps. To dive into these features, let's assume that you have created a family that consists of three devices. +Gonimo的优势之一是其基于家庭的系统,它为即使在商业Android或iOS应用中也无法提供的各种情况提供了极大的灵活性。 要深入了解这些功能,我们假设您创建了一个由三个设备组成的系列。 - * **Multi-baby:** What if you want to keep an eye on your two young children who sleep in separate rooms? Put a device in each child's room and set them as baby stations. The third device will act as the parent station, on which you can connect to both streams and see your toddlers via split screen. You can even extend this use case to more than two baby stations by inviting more devices to your family and setting them up as baby stations. As soon as your parent station is connected to the first baby station, return to the Device Overview screen by clicking the back arrow in the top left corner. Now you can connect to the second (and, in turn, the third, and fourth, and fifth, and so on) device, and the split screen will be established automatically. Voila! + * **多婴儿:** 如果你想留意你在两个不同房间睡觉的两个小孩怎么办? 将设备放在每个孩子的房间,并将其设置为婴儿站。 第三个设备将充当双亲站,您可以在其上连接到两个流并通过分屏查看您的幼儿。 您甚至可以通过向家人提供更多设备并将其设置为婴儿站来将此用例扩展到两个以上的婴儿站。 只要您的父母站连接到第一个婴儿站,请单击左上角的后退箭头返回“设备概述”屏幕。 现在您可以连接到第二个(以及依次为第三个,第四个,第五个和第五个等)设备,并自动建立分屏。酷! - * **Multi-parent:** What if daddy wants to watch the children while he's at work? Just invite a fourth device (e.g., his office PC) to the family and set it up as a parent station. Both parents can check in on their children simultaneously from their own devices, even independently choosing to which stream(s) they wish to connect. + * **多亲:** 如果爸爸想在他上班的时候看孩子怎么办? 只需邀请第四个设备(例如,他的办公室PC)到家庭并将其设置为父母站。 父母双方都可以通过他们自己的设备同时检查他们的孩子,甚至可以独立地选择他们希望连接的孩子。 - * **Multi-family:** A single device can also be part of several families. This is very useful when your baby station is something that's always with you, such as a tablet, and you frequently visit relatives or friends. Create another family for "Granny's house" or "Uncle John's house," which consists of your baby station device paired with Granny's or Uncle John's devices. You can switch the baby station device among those families, whenever you want, from the baby station device's Gonimo home screen. + * **多户:** 单个设备也可以是几个系列的一部分。 当您的婴儿站与您一起时,如平板电脑,您经常访问亲戚或朋友时,这非常有用。 为“奶奶的房子”或“约翰叔叔的房子”创建另一个家庭,其中包括您的婴儿站设备与Granny's或Uncle John的设备配对。 您可以随时通过婴儿站设备的Gonimo主屏幕在这些家庭中切换婴儿站设备。 -### Want to participate? +### 想要参加吗? -The Gonimo team loves open source. Code from the community, for the community. Gonimo's users are very important to us, but they are only one part of the Gonimo story. Creative brains behind the scenes are the key to creating a great baby monitor experience. +Gonimo团队喜欢开源。 社区代码,社区代码。 Gonimo的用户对我们非常重要,但它们只是Gonimo故事的一部分。 幕后有创意的大脑是创造出色婴儿监视器体验的关键。 -Currently we especially need help from people who are willing to be iOS 11 testers, as Apple's support of WebRTC in iOS 11 means we will finally be able to support iOS devices. If you can, please help us realize this awesome milestone. +目前我们特别需要那些愿意成为iOS 11测试者的人的帮助,因为Apple在iOS 11中对WebRTC的支持意味着我们最终将能够支持iOS设备。 如果可以,请帮助我们实现这个令人敬畏的里程碑。 -If you know Haskell or want to learn it, you can check out [our code at GitHub][16]. Pull requests, code reviews, and issues are all welcome. +如果您了解Haskell或想要了解它,您可以查看 [our code at GitHub][16]. 欢迎拉取请求,审查代码以及提出问题。 +最后,请通过向新父母和开源世界宣传Gonimo婴儿监视器是易于使用并且便携的。 -And, finally, please help by spreading the word to new parents and the open source world that the Gonimo baby monitor is simple to use and already in your pocket. - -### About The Author -Robert Klotzner;I Am Father Of Twins;A Programmer. Once I Heard That Ordinary People Can Actually Program Computers;I Bought A Page Book About C;Started Learning;I Was Fifteen Back Then. I Sticked With C;For Quite A While;Learned Java;Went Back To C +### 关于作者 +Robert Klotzner;我是双胞胎的父亲;一个程序员。当我听到普通人可以给计算机编程时;我买了一本关于C的书页;开始学习;我当时十五岁。我坚持用C;相当长的一段时间;学习了java;回归到C -------------------------------------------------------------------------------- via: https://opensource.com/article/17/9/gonimo 作者:[Robert Klotzner][a] -译者:[译者ID](https://github.com/译者ID) +译者:[lintaov587](https://github.com/lintaov587) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 8952ebafa98a13f1e32eff99b5575d6d895a2d2a Mon Sep 17 00:00:00 2001 From: Lintaov587 <35831750+Lintaov587@users.noreply.github.com> Date: Fri, 4 Jan 2019 15:08:36 +0800 Subject: [PATCH 196/322] Rename sources/tech/20170928 How to create a free baby monitoring system with Gonimo.md to translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md --- ...928 How to create a free baby monitoring system with Gonimo.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20170928 How to create a free baby monitoring system with Gonimo.md (100%) diff --git a/sources/tech/20170928 How to create a free baby monitoring system with Gonimo.md b/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md similarity index 100% rename from sources/tech/20170928 How to create a free baby monitoring system with Gonimo.md rename to translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md From cea16301088ee2aae4818a7ca7145c7aedc5e2f3 Mon Sep 17 00:00:00 2001 From: Lintaov587 <35831750+Lintaov587@users.noreply.github.com> Date: Fri, 4 Jan 2019 21:28:55 +0800 Subject: [PATCH 197/322] Update 20170928 How to create a free baby monitoring system with Gonimo.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更改排版 --- ...free baby monitoring system with Gonimo.md | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md b/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md index 3f52c8be4a..06b972ed7d 100644 --- a/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md +++ b/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md @@ -1,33 +1,33 @@ -如何用Gonimo创建一个免费的婴儿监视系统 +如何用 Gonimo 创建一个免费的婴儿监视系统 ====== ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/baby.png?itok=7jyDs9vE) 新父母和准父母很快就会知道将会有一个长且昂贵的新生儿所需设备的清单,清单中的首位是一个婴儿监视器,借此他们可以在做其他事情时照看自己的婴儿,但这儿有一件不必消耗你的婴儿经费的设备,Gonimo 是一个可以将现有的设备转换成婴儿监控系统的免费的开源解决方案,为附近大型婴儿用品商店的过道中数以千计的其他必备或时尚物品中的任何一个腾出一些婴儿的预算。 -Gonimo诞生时,它的开发者,一个有双胞胎的开源粉丝,发现现有选择存在问题: +Gonimo 诞生时,它的开发者,一个有双胞胎的开源粉丝,发现现有选择存在问题: * 现有硬件婴儿监视器价格昂贵,范围有限,需要您携带额外的设备。 - * 虽然有移动监控应用程序,但大多数现有的iOS / Android婴儿监控应用程序都不可靠且不安全,没有明显的开源产品。 + * 虽然有移动监控应用程序,但大多数现有的 iOS / Android 婴儿监控应用程序都不可靠且不安全,没有明显的开源产品。 * 如果您有两个小孩(例如双胞胎),您将需要两台监视器,使您的成本翻倍。 Gonimo是作为一个典型监视器缺点的开源解决方案而创建的: - * 昂贵? 不,它是免费的! - * 范围有限? 不,它适用于互联网/ WiFi,无论您身在何处。 - * 下载并安装应用程序? 噢不,它适用于您现有的网络浏览器。 - * 购买新设备? 不用,你可以使用任何笔记本电脑,手机或平板电脑与网络浏览器和麦克风和/或相机。 + * 昂贵?不,它是免费的! + * 范围有限?不,它适用于互联网 / WiFi,无论您身在何处。 + * 下载并安装应用程序?噢不,它适用于您现有的网络浏览器。 + * 购买新设备?不用,你可以使用任何笔记本电脑,手机或平板电脑与网络浏览器和麦克风和/或相机。 -(注意:遗憾的是,Apple iOS设备尚不支持,但预计很快就会发生变化 - 请继续阅读,了解如何帮助实现这一目标。) +(注意:遗憾的是,Apple iOS 设备尚不支持,但预计很快就会发生变化 - 请继续阅读,了解如何帮实现这一目标助。) ### 开始 -将您的设备转换为婴儿监视器很容易。 从您设备的浏览器(理想情况下为Chrome),访问 [gonimo.com] [1]并单击启动婴儿监视器以访问Web应用程序。 +将您的设备转换为婴儿监视器很容易。从您设备的浏览器(理想情况下为 Chrome ),访问 [gonimo.com] [1]并单击启动婴儿监视器以访问 Web 应用程序。 - 1. **创建家庭:** 在第一次启动屏幕上,你会看到一只可爱的兔子在地球上奔跑。 这是您创建新家庭的地方。 单击 **+** 按钮并接受随机生成的姓氏或键入您自己的选择。 + 1. **创建家庭:** 在第一次启动屏幕上,你会看到一只可爱的兔子在地球上奔跑。这是您创建新家庭的地方。单击 **+** 按钮并接受随机生成的姓氏或键入您自己的选择。 @@ -36,7 +36,7 @@ Gonimo是作为一个典型监视器缺点的开源解决方案而创建的: 从开始屏幕创建一个新家庭 - 1. **邀请设备:** 建立完家庭以后,下个屏幕将指示您邀请其他设备加入你的Gonimo家庭。您可以通过电子邮件直接发送一次性邀请链接,也可以将其复制并粘贴到邮件中。对其他设备,只需打开链接并接受邀请。对您要邀请的任何其他设备重复此过程。 您的设备现在属于同一家庭,可以作为一个完全正常工作的婴儿监视器系统进行配合。 + 1. **邀请设备:** 建立完家庭以后,下个屏幕将指示您邀请其他设备加入你的 Gonimo 家庭。您可以通过电子邮件直接发送一次性邀请链接,也可以将其复制并粘贴到邮件中。对其他设备,只需打开链接并接受邀请。对您要邀请的任何其他设备重复此过程。您的设备现在属于同一家庭,可以作为一个完全正常工作的婴儿监视器系统进行配合。 @@ -45,7 +45,7 @@ Gonimo是作为一个典型监视器缺点的开源解决方案而创建的: 邀请家庭成员 - 1. **启动婴儿工作站流:** 接下来,通过转到 [Gonimo home screen][6],点击带有奶嘴的按钮,并允许网络浏览器访问设备的麦克风和摄像头,选择将婴儿的音频和视频流式传输到父母的设备。 调整相机以指向宝宝的床,或关闭它以节省设备电池(音频仍将流式传输)。 点击开始。 该流现在处于活动状态。 + 1. **启动婴儿站流:** 接下来,通过转到 [Gonimo home screen][6],点击带有奶嘴的按钮,并允许网络浏览器访问设备的麦克风和摄像头,选择将婴儿的音频和视频流式传输到父母的设备。调整相机以指向宝宝的床,或关闭它以节省设备电池(音频仍将流式传输)。点击开始。该流现在处于活动状态。 @@ -59,7 +59,7 @@ Gonimo是作为一个典型监视器缺点的开源解决方案而创建的: 按“Start”开始以流式传输视频 - 1. **连接到双亲站流:** 要查看婴儿站流,请转到Gonimo家族中的其他设备 - 这是双亲站。 点击Gonimo主屏幕上的“Parent”按钮。 您将看到该系列中所有设备的列表; 旁边有一个活跃的婴儿站将是一个短时连接按钮。 选择连接,您可以通过点对点音频/视频流看到和听到您的宝宝。 音量条为传输的音频流提供可视化。 + 1. **连接到双亲站流:** 要查看婴儿站流,请转到 Gonimo 家族中的其他设备 - 这是双亲站。点击 Gonimo 主屏幕上的 “Parent” 按钮。您将看到该系列中所有设备的列表;旁边有一个活跃的婴儿站将是一个短时连接按钮。选择连接,您可以通过点对点音频/视频流看到和听到您的宝宝。音量条为传输的音频流提供可视化。 ![Select parent station][12] @@ -80,29 +80,29 @@ Gonimo是作为一个典型监视器缺点的开源解决方案而创建的: ### 家庭系统的灵活性 -Gonimo的优势之一是其基于家庭的系统,它为即使在商业Android或iOS应用中也无法提供的各种情况提供了极大的灵活性。 要深入了解这些功能,我们假设您创建了一个由三个设备组成的系列。 + Gonimo 的优势之一是其基于家庭的系统,它为即使在商业 Android 或 iOS 应用中也无法提供的各种情况提供了极大的灵活性。要深入了解这些功能,我们假设您创建了一个由三个设备组成的系列。 - * **多婴儿:** 如果你想留意你在两个不同房间睡觉的两个小孩怎么办? 将设备放在每个孩子的房间,并将其设置为婴儿站。 第三个设备将充当双亲站,您可以在其上连接到两个流并通过分屏查看您的幼儿。 您甚至可以通过向家人提供更多设备并将其设置为婴儿站来将此用例扩展到两个以上的婴儿站。 只要您的父母站连接到第一个婴儿站,请单击左上角的后退箭头返回“设备概述”屏幕。 现在您可以连接到第二个(以及依次为第三个,第四个,第五个和第五个等)设备,并自动建立分屏。酷! + * **多婴儿:** 如果你想留意你在两个不同房间睡觉的两个小孩怎么办? 将设备放在每个孩子的房间,并将其设置为婴儿站。第三个设备将充当双亲站,您可以在其上连接到两个流并通过分屏查看您的幼儿。您甚至可以通过向家人提供更多设备并将其设置为婴儿站来将此用例扩展到两个以上的婴儿站。只要您的父母站连接到第一个婴儿站,请单击左上角的后退箭头返回“设备概述”屏幕。现在您可以连接到第二个(以及依次为第三个,第四个,第五个和第五个等)设备,并自动建立分屏。酷! - * **多亲:** 如果爸爸想在他上班的时候看孩子怎么办? 只需邀请第四个设备(例如,他的办公室PC)到家庭并将其设置为父母站。 父母双方都可以通过他们自己的设备同时检查他们的孩子,甚至可以独立地选择他们希望连接的孩子。 + * **多亲:** 如果爸爸想在他上班的时候看孩子怎么办?只需邀请第四个设备(例如,他的办公室 PC )到家庭并将其设置为父母站。父母双方都可以通过他们自己的设备同时检查他们的孩子,甚至可以独立地选择他们希望连接的孩子。 - * **多户:** 单个设备也可以是几个系列的一部分。 当您的婴儿站与您一起时,如平板电脑,您经常访问亲戚或朋友时,这非常有用。 为“奶奶的房子”或“约翰叔叔的房子”创建另一个家庭,其中包括您的婴儿站设备与Granny's或Uncle John的设备配对。 您可以随时通过婴儿站设备的Gonimo主屏幕在这些家庭中切换婴儿站设备。 + * **多户:** 单个设备也可以是几个系列的一部分。当您的婴儿站与您一起时,如平板电脑,您经常访问亲戚或朋友时,这非常有用。为“奶奶的房子”或“约翰叔叔的房子”创建另一个家庭,其中包括您的婴儿站设备与 Granny's 或 Uncle John 的设备配对。您可以随时通过婴儿站设备的 Gonimo 主屏幕在这些家庭中切换婴儿站设备。 ### 想要参加吗? -Gonimo团队喜欢开源。 社区代码,社区代码。 Gonimo的用户对我们非常重要,但它们只是Gonimo故事的一部分。 幕后有创意的大脑是创造出色婴儿监视器体验的关键。 +Gonimo 团队喜欢开源。社区代码,社区代码。Gonimo 的用户对我们非常重要,但它们只是 Gonimo 故事的一部分。幕后有创意的大脑是创造出色婴儿监视器体验的关键。 -目前我们特别需要那些愿意成为iOS 11测试者的人的帮助,因为Apple在iOS 11中对WebRTC的支持意味着我们最终将能够支持iOS设备。 如果可以,请帮助我们实现这个令人敬畏的里程碑。 +目前我们特别需要那些愿意成为 iOS 11 测试者的人的帮助,因为 Apple 在 iOS 11 中对 WebRTC 的支持意味着我们最终将能够支持 iOS 设备。如果可以,请帮助我们实现这个令人敬畏的里程碑。 -如果您了解Haskell或想要了解它,您可以查看 [our code at GitHub][16]. 欢迎拉取请求,审查代码以及提出问题。 -最后,请通过向新父母和开源世界宣传Gonimo婴儿监视器是易于使用并且便携的。 +如果您了解 Haskell 或想要了解它,您可以查看 [our code at GitHub][16]. 欢迎拉取请求,审查代码以及提出问题。 +最后,请通过向新父母和开源世界宣传 Gonimo 婴儿监视器是易于使用并且便携的。 ### 关于作者 -Robert Klotzner;我是双胞胎的父亲;一个程序员。当我听到普通人可以给计算机编程时;我买了一本关于C的书页;开始学习;我当时十五岁。我坚持用C;相当长的一段时间;学习了java;回归到C +Robert Klotzner;我是双胞胎的父亲;一个程序员。当我听到普通人可以给计算机编程时;我买了一本关于 C 的书页;开始学习;我当时十五岁。我坚持用 C ;相当长的一段时间;学习了 Java ;回归到 C -------------------------------------------------------------------------------- From 55991857dcb2efb1f12e76f9110e8e60b98e8f8b Mon Sep 17 00:00:00 2001 From: Lintaov587 <35831750+Lintaov587@users.noreply.github.com> Date: Fri, 4 Jan 2019 21:30:07 +0800 Subject: [PATCH 198/322] Update 20170928 How to create a free baby monitoring system with Gonimo.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更改排版 --- ...8 How to create a free baby monitoring system with Gonimo.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md b/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md index 06b972ed7d..809074a10c 100644 --- a/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md +++ b/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md @@ -72,7 +72,7 @@ Gonimo是作为一个典型监视器缺点的开源解决方案而创建的: 按下“Connect”开始观看婴儿流。 - 1. **恭喜!** 您已成功将设备直接通过网络浏览器转换为婴儿监视器,无需下载或安装任何应用程序! + 1. **恭喜!** 您已成功将设备直接通过网络浏览器转换为婴儿监视器,无需下载或安装任何应用程序! From fef29d834efcbe57581fc400b8d94ec97faaf4d0 Mon Sep 17 00:00:00 2001 From: Lintaov587 <35831750+Lintaov587@users.noreply.github.com> Date: Fri, 4 Jan 2019 21:36:08 +0800 Subject: [PATCH 199/322] Update 20170928 How to create a free baby monitoring system with Gonimo.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更改排版,更改标点符号 --- ... free baby monitoring system with Gonimo.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md b/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md index 809074a10c..95c495e814 100644 --- a/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md +++ b/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md @@ -4,7 +4,7 @@ 新父母和准父母很快就会知道将会有一个长且昂贵的新生儿所需设备的清单,清单中的首位是一个婴儿监视器,借此他们可以在做其他事情时照看自己的婴儿,但这儿有一件不必消耗你的婴儿经费的设备,Gonimo 是一个可以将现有的设备转换成婴儿监控系统的免费的开源解决方案,为附近大型婴儿用品商店的过道中数以千计的其他必备或时尚物品中的任何一个腾出一些婴儿的预算。 -Gonimo 诞生时,它的开发者,一个有双胞胎的开源粉丝,发现现有选择存在问题: +Gonimo 诞生时,它的开发者,一个有双胞胎的开源粉丝,发现现有选择存在问题: * 现有硬件婴儿监视器价格昂贵,范围有限,需要您携带额外的设备。 * 虽然有移动监控应用程序,但大多数现有的 iOS / Android 婴儿监控应用程序都不可靠且不安全,没有明显的开源产品。 @@ -27,7 +27,7 @@ Gonimo是作为一个典型监视器缺点的开源解决方案而创建的: 将您的设备转换为婴儿监视器很容易。从您设备的浏览器(理想情况下为 Chrome ),访问 [gonimo.com] [1]并单击启动婴儿监视器以访问 Web 应用程序。 - 1. **创建家庭:** 在第一次启动屏幕上,你会看到一只可爱的兔子在地球上奔跑。这是您创建新家庭的地方。单击 **+** 按钮并接受随机生成的姓氏或键入您自己的选择。 + 1. **创建家庭:** 在第一次启动屏幕上,你会看到一只可爱的兔子在地球上奔跑。这是您创建新家庭的地方。单击 **+** 按钮并接受随机生成的姓氏或键入您自己的选择。 @@ -36,7 +36,7 @@ Gonimo是作为一个典型监视器缺点的开源解决方案而创建的: 从开始屏幕创建一个新家庭 - 1. **邀请设备:** 建立完家庭以后,下个屏幕将指示您邀请其他设备加入你的 Gonimo 家庭。您可以通过电子邮件直接发送一次性邀请链接,也可以将其复制并粘贴到邮件中。对其他设备,只需打开链接并接受邀请。对您要邀请的任何其他设备重复此过程。您的设备现在属于同一家庭,可以作为一个完全正常工作的婴儿监视器系统进行配合。 + 1. **邀请设备:** 建立完家庭以后,下个屏幕将指示您邀请其他设备加入你的 Gonimo 家庭。您可以通过电子邮件直接发送一次性邀请链接,也可以将其复制并粘贴到邮件中。对其他设备,只需打开链接并接受邀请。对您要邀请的任何其他设备重复此过程。您的设备现在属于同一家庭,可以作为一个完全正常工作的婴儿监视器系统进行配合。 @@ -45,7 +45,7 @@ Gonimo是作为一个典型监视器缺点的开源解决方案而创建的: 邀请家庭成员 - 1. **启动婴儿站流:** 接下来,通过转到 [Gonimo home screen][6],点击带有奶嘴的按钮,并允许网络浏览器访问设备的麦克风和摄像头,选择将婴儿的音频和视频流式传输到父母的设备。调整相机以指向宝宝的床,或关闭它以节省设备电池(音频仍将流式传输)。点击开始。该流现在处于活动状态。 + 1. **启动婴儿站流:** 接下来,通过转到 [Gonimo home screen][6],点击带有奶嘴的按钮,并允许网络浏览器访问设备的麦克风和摄像头,选择将婴儿的音频和视频流式传输到父母的设备。调整相机以指向宝宝的床,或关闭它以节省设备电池(音频仍将流式传输)。点击开始。该流现在处于活动状态。 @@ -59,7 +59,7 @@ Gonimo是作为一个典型监视器缺点的开源解决方案而创建的: 按“Start”开始以流式传输视频 - 1. **连接到双亲站流:** 要查看婴儿站流,请转到 Gonimo 家族中的其他设备 - 这是双亲站。点击 Gonimo 主屏幕上的 “Parent” 按钮。您将看到该系列中所有设备的列表;旁边有一个活跃的婴儿站将是一个短时连接按钮。选择连接,您可以通过点对点音频/视频流看到和听到您的宝宝。音量条为传输的音频流提供可视化。 + 1. **连接到双亲站流:** 要查看婴儿站流,请转到 Gonimo 家族中的其他设备 - 这是双亲站。点击 Gonimo 主屏幕上的 “Parent” 按钮。您将看到该系列中所有设备的列表;旁边有一个活跃的婴儿站将是一个短时连接按钮。选择连接,您可以通过点对点音频/视频流看到和听到您的宝宝。音量条为传输的音频流提供可视化。 ![Select parent station][12] @@ -82,17 +82,17 @@ Gonimo是作为一个典型监视器缺点的开源解决方案而创建的: Gonimo 的优势之一是其基于家庭的系统,它为即使在商业 Android 或 iOS 应用中也无法提供的各种情况提供了极大的灵活性。要深入了解这些功能,我们假设您创建了一个由三个设备组成的系列。 - * **多婴儿:** 如果你想留意你在两个不同房间睡觉的两个小孩怎么办? 将设备放在每个孩子的房间,并将其设置为婴儿站。第三个设备将充当双亲站,您可以在其上连接到两个流并通过分屏查看您的幼儿。您甚至可以通过向家人提供更多设备并将其设置为婴儿站来将此用例扩展到两个以上的婴儿站。只要您的父母站连接到第一个婴儿站,请单击左上角的后退箭头返回“设备概述”屏幕。现在您可以连接到第二个(以及依次为第三个,第四个,第五个和第五个等)设备,并自动建立分屏。酷! + * **多婴儿:** 如果你想留意你在两个不同房间睡觉的两个小孩怎么办? 将设备放在每个孩子的房间,并将其设置为婴儿站。第三个设备将充当双亲站,您可以在其上连接到两个流并通过分屏查看您的幼儿。您甚至可以通过向家人提供更多设备并将其设置为婴儿站来将此用例扩展到两个以上的婴儿站。只要您的父母站连接到第一个婴儿站,请单击左上角的后退箭头返回“设备概述”屏幕。现在您可以连接到第二个(以及依次为第三个,第四个,第五个和第五个等)设备,并自动建立分屏。酷! - * **多亲:** 如果爸爸想在他上班的时候看孩子怎么办?只需邀请第四个设备(例如,他的办公室 PC )到家庭并将其设置为父母站。父母双方都可以通过他们自己的设备同时检查他们的孩子,甚至可以独立地选择他们希望连接的孩子。 + * **多亲:** 如果爸爸想在他上班的时候看孩子怎么办?只需邀请第四个设备(例如,他的办公室 PC )到家庭并将其设置为父母站。父母双方都可以通过他们自己的设备同时检查他们的孩子,甚至可以独立地选择他们希望连接的孩子。 - * **多户:** 单个设备也可以是几个系列的一部分。当您的婴儿站与您一起时,如平板电脑,您经常访问亲戚或朋友时,这非常有用。为“奶奶的房子”或“约翰叔叔的房子”创建另一个家庭,其中包括您的婴儿站设备与 Granny's 或 Uncle John 的设备配对。您可以随时通过婴儿站设备的 Gonimo 主屏幕在这些家庭中切换婴儿站设备。 + * **多户:** 单个设备也可以是几个系列的一部分。当您的婴儿站与您一起时,如平板电脑,您经常访问亲戚或朋友时,这非常有用。为“奶奶的房子”或“约翰叔叔的房子”创建另一个家庭,其中包括您的婴儿站设备与 Granny's 或 Uncle John 的设备配对。您可以随时通过婴儿站设备的 Gonimo 主屏幕在这些家庭中切换婴儿站设备。 -### 想要参加吗? +### 想要参加吗? Gonimo 团队喜欢开源。社区代码,社区代码。Gonimo 的用户对我们非常重要,但它们只是 Gonimo 故事的一部分。幕后有创意的大脑是创造出色婴儿监视器体验的关键。 From 10e1a2e233ff51c0fdb4c9a099fd16fc464c5cbc Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 4 Jan 2019 22:47:58 +0800 Subject: [PATCH 200/322] PRF:20180625 8 reasons to use the Xfce Linux desktop environment.md @WangYueScream --- ... use the Xfce Linux desktop environment.md | 60 ++++++++----------- 1 file changed, 24 insertions(+), 36 deletions(-) diff --git a/translated/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md b/translated/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md index e625f12f5c..d2695cefb1 100644 --- a/translated/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md +++ b/translated/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md @@ -1,78 +1,66 @@ - - 使用 Xfce Linux 桌面环境的 8 个理由 ============================ +> 这个 Linux 桌面环境简洁而快速,十分优雅,可以很容易地弄清楚如何做事。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_penguin_green.png?itok=ENdVzW22) - 由于某些原因(也包括好奇),几周前我开始使用 [Xfce][1] 作为我的 Linux 桌面。促使我更换 Linux 桌面环境的原因之一是桌面相关的守护进程占据了我的性能非常强大的主工作站的绝大部分 CPU 资源和 I/O 带宽。当然,有些不稳定性可能是因为我删除了提供这些守护进程的 RPM 包。然而,事实是在我删除这些 RPM 包之前,KDE 就已经很不稳定了而且还导致了一系列其他方面的性能和稳定性问题。所以我需要换一个桌面来避免这些问题。 - 在回顾了我为 Linux 桌面所写的一系列文章后我才意识到我忽略了 Xfce。这篇文章也是力图能够纠正弥补这个疏忽。我非常喜欢 Xfce 也很享受它所带给我超乎预期的快速、轻量的体验。 - -作为研究的一部分,我有尝试过在 Google 上查询 Xfce 对应什么意思。有个历史参考是它对应着 XForms Common Environment,但 Xfce 早已不在使用 XForms 工具。几年前,我找到另一个参考是 "Xtra fine computing environment" 而且我也很喜欢这个解释。我将会用它作为 Xfce 的全称(尽管再也找不到这个参考页面)。 - +作为研究的一部分,我有尝试过在 Google 上查询 Xfce 对应什么意思。有个历史参考是它对应着 “XForms Common Environment”,但 Xfce 早已不在使用 XForms 工具。几年前,我找到另一个参考是 “Xtra fine computing environment” 而且我也很喜欢这个解释。我将会用它作为 Xfce 的全称(尽管再也找不到这个参考页面)。 ### 推荐 Xfce 的 8 个理由 - -#### 1\. 轻量级架构 +#### 1、轻量级架构 Xfce 相对于其他的桌面如 KDE 和 GNOME,不管是内存还是 CPU 的占用率都非常小。在我的系统中,组成 Xfce 桌面的程序仅占用了少量内存就构成一个如此强大的桌面。超低的 CPU 占用率也是 Xfce 桌面的一个特点。了解到 Xfce 内存占用特别低后,我对它的 CPU 占用率也非常低这个特性自然而言也就不感到奇怪了。 -#### 2\. 简洁 +#### 2、简洁 -Xfce 桌面很简单就像绒毛整洁的动物让人一目了然赏心悦目。基础的桌面有两个面板和一条在左边垂直的图标行。面板 0 是在底部并由一些基础的应用启动程序和能访问到系统里对应程序的图标组成。面板 1 是在顶部由一个应用程序启动器和一个能够允许用户在多个工作区之间来回切换的工作区切换器组成。面板可以通过补充项自定义修改比如增加个新的应用启动器或者更改它们的宽高。 +Xfce 桌面很简单,就像绒毛整洁的动物让人一目了然、赏心悦目。基础的桌面有两个面板和一条在左边垂直的图标行。面板 0 在底部,并由一些基础的应用启动程序和能访问到系统里对应程序的图标组成。面板 1 在顶部,由一个应用程序启动器和一个能够允许用户在多个工作区之间来回切换的工作区切换器组成。面板可以通过补充项自定义修改,比如增加个新的应用启动器或者更改它们的宽高。 -桌面左侧的图标对应是家目录和垃圾桶。它也可以显示其他的图标如完整的文件系统目录树和任意已连接上系统的可插拔的 USB 存储设备。这些图标可以用来挂载和卸载设备也可以用来打开默认的文件管理器。如果你愿意,它们都可以被隐藏同时文件系统,垃圾箱,家目录对应的图标都可以逐个控制管理。所有的可移动设备也可以被隐藏或作为一个组显示。 +桌面左侧的图标对应是家目录和垃圾桶。它也可以显示其他的图标,如完整的文件系统目录树和已连接上系统的可插拔的任意 USB 存储设备。这些图标可以用来挂载和卸载设备,也可以用来打开默认的文件管理器。如果你愿意,它们都可以被隐藏,同时文件系统、垃圾箱、家目录对应的图标都可以逐个控制管理。所有的可移动设备也可以被隐藏或作为一个组显示。 -#### 3\. 文件管理 +#### 3、文件管理 -作为 Xfce 的默认文件管理器 Thunar,它很简单,既易于使用和配置也非常容易学习。尽管它并不像其他的文件管理器比如 Konqueror 或者 Dolphin 那样效果华丽,但它很强大也很快。Thunar 并不能在一个窗口里面打开并产生多个窗口但它提供了选项卡来支持多个目录的同时打开。Thunar 也有一个非常漂亮的侧边栏就像桌面那样能够显示完整的文件系统目录树和所有已连接的 USB 存储设备。设备能够被挂载和卸载,可移动媒介如 CD 也能够被弹出。Thunar 也可以使用类似 Ark 这种帮助软件来在你点击归档文件的时候打开它们。比如 ZIP,TAR,RPM 这种归档文件都可以被浏览也可以从中复制单个文件。 +作为 Xfce 的默认文件管理器 Thunar,它很简单,既易于使用和配置也非常容易学习。尽管它并不像其他的文件管理器比如 Konqueror 或者 Dolphin 那样效果华丽,但它很强大也很快。Thunar 并不能在一个窗口里面打开多个面板,但它提供了选项卡来支持多个目录的同时打开。Thunar 也有一个非常漂亮的侧边栏,其上同样的图标就像桌面那样能够显示完整的文件系统目录树和所有已连接的 USB 存储设备。设备能够被挂载和卸载,可移动媒介如 CD 也能够被弹出。Thunar 也可以使用类似 Ark 这种帮助软件来在你点击归档文件的时候打开它们。比如 ZIP、TAR、RPM 这种归档文件都可以被浏览也可以从中复制单个文件。 ![Xfce desktop][3] -Xfce 桌面及 Thunar 和 Xfce 下的终端模拟器。 +*Xfce 桌面及 Thunar 和 Xfce 下的终端模拟器。* -在我的[文件管理器系列][4]一文中,我已经使用体验过很多不同的文件管理器软件,我不得不说 Thunar 的简单易用让你无法不喜欢上它。它很容易帮助你通过使用侧边栏来浏览文件系统。 +在我的[文件管理器系列][4]文章中,我已经使用体验过很多不同的文件管理器软件,我不得不说 Thunar 的简单易用让你无法不喜欢上它。它可以让你通过使用侧边栏来很容易地浏览文件系统。 +#### 4、稳定 -#### 4\. 稳定 +Xfce 桌面非常稳定。新版本的发布周期似乎是三年,但也会根据需要发布相关更新。最新的版本是于 2015 年 2 月发布的 4.12。在使用 KDE 遇到一系列问题后,稳如磐石的 Xfce 桌面环境显得让人格外放心。在我使用 Xfce 的过程中,它从来没有崩溃过,也不会产生额外的守护进程占据过多的系统资源。这正是我想要的:它安安静静地工作,不会给你带来额外的困扰。 -Xfce 桌面非常稳定。新版本的发布周期似乎是三年,但也会根据需要发布相关更新。最新的版本是于 2015 年 2 月发布的 4.12。在使用 KDE 遇到一系列问题后稳如磐石的 Xfce 桌面环境显得让人格外放心。在我使用 Xfce 的过程中,它从来没有崩溃过,也不会产生额外的守护进程占据过多的系统资源。这正是我想要的—它安安静静地工作,不会给你带来额外的困扰。 +#### 5、优雅 +Xfce 简单优雅。在我的今年秋天将面世的新书《系统管理员的 Linux 哲学》中我谈到了关于简单的一系列好处,包括简单事实上也是优雅的诸多标志之一。很明确能够确定的就是 Xfce 及相关组件程序的开发者和维护者也是极力推崇简单至上。这种简单特性很可能也是 Xfce 如此稳定的主要原因,但它也给用户带来了一个整洁的桌面外观,一个反应灵敏的操作界面,一个会让人感觉很自然也很易用的导航结构,而且 Xfce 整体上的优雅特性也会让用户的使用过程中充满愉悦感。 -#### 5\. 优雅 +#### 6、终端仿真程序 -Xfce 简单优雅。在我的新书,The Linux Philosophy for SysAdmins 中我谈到了关于简单的一系列好处包括事实上简单也是优雅的诸多标志之一。很明确能够确定的就是 Xfce 及相关组件程序的开发者和维护者也是极力推崇简单至上。这种简单特性很可能也是 Xfce 如此稳定的主要原因,但它也用户带来了一个整洁的桌面外观,一个反应灵敏的操作界面,一个会让人感觉很自然也很易用的导航结构,而且 Xfce 整体上的优雅特性也会让用户的使用过程中充满愉悦感。 - - -#### 6\. 终端仿真程序 - -Xfce4 的终端仿真程序非常强大而且和其他很多终端仿真程序一样可以允许你使用多个选项卡来让多个终端在一个单独窗口里共存。尽管它与 Tilix,Terminator,Konsole 这种终端仿真程序比起来相对简陋,但它也能很好的完成工作。选项卡的名字可以更改,而且选项卡也可以通过拖放或者工具栏的箭头图标或者菜单栏的选项重新排列。我特别喜欢 Xfce 的终端仿真程序的一点就是不管你连接了多少主机,相对应的选项卡都会显示对应的主机名,比如 `host1==>host2==>host3==>host4` 准确地在选项卡显示了 `host4`。但其他的终端仿真程序最多也就显示 `host2`。 +Xfce4 的终端仿真程序非常强大,而且和其他很多终端仿真程序一样可以允许你使用多个选项卡来让多个终端在一个单独窗口里共存。尽管它与 Tilix、Terminator、Konsole 这种终端仿真程序比起来相对简陋,但它也能很好的完成工作。选项卡的名字可以更改,而且选项卡也可以通过拖放或者工具栏的箭头图标或者菜单栏的选项重新排列。我特别喜欢 Xfce 的终端仿真程序的一点就是不管你连接了多少主机,相对应的选项卡都会显示对应的主机名,比如,从 host1==>host2==>host3==>host4,会准确地在选项卡显示了 “host4”。但其他的终端仿真程序最多也就显示 “host2”。 至于这个终端仿真程序功能和外观的其他方面都可以根据你的需要很容易配置成你想要的。当然同 Xfce 的其他组件一样,这款终端仿真程序占用了系统资源的很少一部分。 +#### 7、可配置性 -#### 7\. 可配置性 +Xfce 能够配置的范围极大。虽然 Xfce 桌面的可配置性比不上 KDE,但依旧远超 GNOME,而且比它更容易配置。比如,我发现设置管理器是 Xfce 配置一切的入口。虽然每个配置程序都可以单独使用,但是设置管理器把他们都放在一个窗口里以便快速访问。关于 Xfce 桌面很多重要的部分都可以通过配置来满足我的需求。 -Xfce 能够配置的范围极大。虽然 Xfce 桌面的可配置性比不上 KDE,但依旧远超 GNOME 了而且比它更容易配置。比如,我发现设置管理器是 Xfce 配置一切的入口。虽然每个配置程序都可以单独使用,但是设置管理器把他们都放在一个窗口里以便快速访问。关于 Xfce 桌面很多重要的部分都可以通过配置来满足我的需求。 +#### 8、模块化 +Xfce 是由一系列单个的项目组成的整体,而且在你的 Linux 桌面发行版中也未必安装了 Xfce 的所有组件。[Xfce 项目][5] 的主页列出了主要的项目,所以你可以根据需要安装你想安装的附加组件。比如在我的 Fedora 28 workstation 版本上我安装的 Xfce 组时就没有 [Xfce 项目][5] 主页最下面的说明的一些程序。 -#### 8\. 模块化 - -Xfce 是由一系列单个的项目组成的整体,而且在你的 Linux 桌面发行版中也未必安装了 Xfce 的所有组件。[Xfce's projects][5] 的主页列出了主要的项目,所以你可以根据需要安装你想安装的额外组件。比如在我的 Fedora 28 workstation 版本上我安装的 Xfce 桌面就没有 [Xfce's projects][5] 页最下面的说明的一些程序。 - -这里还有个关于 Xfce 的 [documentation page][6] 和 一个被称为 [Xfce Goodies Project][7] 的 wiki 列举了其他的 Xfce 相关的项目,它们为 Xfce 的面板 及 Thunar 提供了很多不错的应用程序,精美的插图,好用的插件。 - +这里还有个关于 Xfce 的 [文档页面][6] 和 一个被称为 [Xfce 超值项目][7] 的 wiki 列举了其他的 Xfce 相关的项目,它们为 Xfce 的面板及 Thunar 提供了很多不错的应用程序、精美的插图、好用的插件。 ### 总结 -整体上很优雅的 Xfce 桌面所具备的足够轻巧和快速的特性能够让它很容易清楚如何做好一件事。它的轻量级的结构也节省了大量的 CPU 和 内存资源。这也使得 Xfce 非常适合那种由于硬件有限无法分配给桌面太多资源的旧主机。然而,Xfce 又是足够的灵活和强大能够满足高级用户的需要。 +整体上很优雅的 Xfce 桌面所具备的足够轻巧和快速的特性能够让它很容易清楚如何做好一件事。它的轻量级的结构也节省了大量的 CPU 和内存资源。这也使得 Xfce 非常适合那种由于硬件有限而无法分配给桌面太多资源的旧主机。然而,Xfce 又是足够的灵活和强大的,能够满足高级用户的需要。 -我已经了解到更换到一个新的 Linux 桌面环境需要你自己按照你想要的做些对应的自定义设置—比如面板上显示你最爱用的程序对应的启动器,设置下你最喜欢的桌面背景壁纸等一系列工作。这些年来我已经在切换到新桌面环境或更新旧桌面环境折腾很多次了。这需要时间也需要耐心。 +我知道,更换到一个新的 Linux 桌面环境需要你自己按照你想要的做些对应的自定义设置:比如面板上显示你最爱用的程序对应的启动器,设置下你最喜欢的桌面背景壁纸等一系列工作。这些年来我已经在切换到新桌面环境或更新旧桌面环境折腾很多次了。这需要时间也需要耐心。 我觉得切换 Linux 的桌面环境就像我在工作中换个办公工位或者办公室一样。别人把我的东西装箱从旧办公室搬到新办公室,然后我在我的新办公室里组装连接好我的电脑,打开箱子再把里面的东西放在合适的位置。而切换到 Xfce 桌面大概就是我做过的最简单省事容易的桌面环境更换了。 @@ -84,7 +72,7 @@ via: https://opensource.com/article/18/6/xfce-desktop 作者:[David Both][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[WangYueScream](https://github.com/WangYueScream) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 2e691e9617c3aaa86e5c5d903ab37102c755d94a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 4 Jan 2019 22:50:35 +0800 Subject: [PATCH 201/322] PUB:20180625 8 reasons to use the Xfce Linux desktop environment.md @WangYueScream https://linux.cn/article-10413-1.html --- ...625 8 reasons to use the Xfce Linux desktop environment.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20180625 8 reasons to use the Xfce Linux desktop environment.md (95%) diff --git a/translated/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md b/published/20180625 8 reasons to use the Xfce Linux desktop environment.md similarity index 95% rename from translated/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md rename to published/20180625 8 reasons to use the Xfce Linux desktop environment.md index d2695cefb1..a208e10d90 100644 --- a/translated/talk/20180625 8 reasons to use the Xfce Linux desktop environment.md +++ b/published/20180625 8 reasons to use the Xfce Linux desktop environment.md @@ -1,6 +1,6 @@ 使用 Xfce Linux 桌面环境的 8 个理由 ============================ -> 这个 Linux 桌面环境简洁而快速,十分优雅,可以很容易地弄清楚如何做事。 +> 整体上很优雅的 Xfce 桌面所具备的足够轻巧和快速的特性能够让它很容易地知道如何做好一件事。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_penguin_green.png?itok=ENdVzW22) @@ -58,7 +58,7 @@ Xfce 是由一系列单个的项目组成的整体,而且在你的 Linux 桌 ### 总结 -整体上很优雅的 Xfce 桌面所具备的足够轻巧和快速的特性能够让它很容易清楚如何做好一件事。它的轻量级的结构也节省了大量的 CPU 和内存资源。这也使得 Xfce 非常适合那种由于硬件有限而无法分配给桌面太多资源的旧主机。然而,Xfce 又是足够的灵活和强大的,能够满足高级用户的需要。 +整体上很优雅的 Xfce 桌面所具备的足够轻巧和快速的特性能够让它很容易地知道如何做好一件事。它的轻量级的结构也节省了大量的 CPU 和内存资源。这也使得 Xfce 非常适合那种由于硬件有限而无法分配给桌面太多资源的旧主机。然而,Xfce 又是足够的灵活和强大的,能够满足高级用户的需要。 我知道,更换到一个新的 Linux 桌面环境需要你自己按照你想要的做些对应的自定义设置:比如面板上显示你最爱用的程序对应的启动器,设置下你最喜欢的桌面背景壁纸等一系列工作。这些年来我已经在切换到新桌面环境或更新旧桌面环境折腾很多次了。这需要时间也需要耐心。 From f2301723c535be0998d9715e68c54c37d01ca568 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 4 Jan 2019 22:51:45 +0800 Subject: [PATCH 202/322] PRF:20180625 8 reasons to use the Xfce Linux desktop environment.md --- ...80625 8 reasons to use the Xfce Linux desktop environment.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20180625 8 reasons to use the Xfce Linux desktop environment.md b/published/20180625 8 reasons to use the Xfce Linux desktop environment.md index a208e10d90..bec72ea941 100644 --- a/published/20180625 8 reasons to use the Xfce Linux desktop environment.md +++ b/published/20180625 8 reasons to use the Xfce Linux desktop environment.md @@ -42,7 +42,7 @@ Xfce 简单优雅。在我的今年秋天将面世的新书《系统管理员的 #### 6、终端仿真程序 -Xfce4 的终端仿真程序非常强大,而且和其他很多终端仿真程序一样可以允许你使用多个选项卡来让多个终端在一个单独窗口里共存。尽管它与 Tilix、Terminator、Konsole 这种终端仿真程序比起来相对简陋,但它也能很好的完成工作。选项卡的名字可以更改,而且选项卡也可以通过拖放或者工具栏的箭头图标或者菜单栏的选项重新排列。我特别喜欢 Xfce 的终端仿真程序的一点就是不管你连接了多少主机,相对应的选项卡都会显示对应的主机名,比如,从 host1==>host2==>host3==>host4,会准确地在选项卡显示了 “host4”。但其他的终端仿真程序最多也就显示 “host2”。 +Xfce4 的终端仿真程序非常强大,而且和其他很多终端仿真程序一样可以允许你使用多个选项卡来让多个终端在一个单独窗口里共存。尽管它与 Tilix、Terminator、Konsole 这种终端仿真程序比起来相对简陋,但它也能很好的完成工作。选项卡的名字可以更改,而且选项卡也可以通过拖放或者工具栏的箭头图标或者菜单栏的选项重新排列。我特别喜欢 Xfce 的终端仿真程序的一点就是不管你连接了多少主机,相对应的选项卡都会显示对应的主机名,比如,从 host1=>host2=>host3=>host4,会准确地在选项卡显示了 “host4”。但其他的终端仿真程序最多也就显示 “host2”。 至于这个终端仿真程序功能和外观的其他方面都可以根据你的需要很容易配置成你想要的。当然同 Xfce 的其他组件一样,这款终端仿真程序占用了系统资源的很少一部分。 From 99e08016023233f09b58f607728c6d868113cbbc Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 4 Jan 2019 23:24:41 +0800 Subject: [PATCH 203/322] =?UTF-8?q?PRF:20181210=20McFly=20-=20A=20Replacem?= =?UTF-8?q?ent=20To=20=E2=80=98Ctrl-R-=20Bash=20History=20Search=20Feature?= =?UTF-8?q?.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @FSSlc --- ...To ‘Ctrl-R- Bash History Search Feature.md | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/translated/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md b/translated/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md index 5031edc985..a880ef1cf3 100644 --- a/translated/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md +++ b/translated/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md @@ -1,19 +1,20 @@ [#]: collector: (lujun9972) [#]: translator: (FSSlc) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (McFly – A Replacement To ‘Ctrl+R’ Bash History Search Feature) [#]: via: (https://www.ostechnix.com/mcfly-a-replacement-to-ctrlr-bash-history-search-feature/) [#]: author: (SK https://www.ostechnix.com/author/sk/) -McFly – Bash 历史命令搜索特性的一个替代品 +McFly:利用神经网络为 Bash 提供历史命令搜索功能 ====== + ![](https://www.ostechnix.com/wp-content/uploads/2018/12/mcfly-720x340.png) -假如你在命令行模式下花费过很长时间,那么你必定使用过或者听说过 BASH 的 **反向搜索** 功能,在 Bash 中执行反向搜索功能的快捷键是 **Ctrl+r**。通过使用这个特性,我们可以找到我们执行过的命令而无需再次输入它们。当然,你可以使用上下键来搜索你的 bash 命令记录,但使用 Ctrl+r 快捷键可以让这个搜索过程更简单快速。今天我找寻到了 Bash 历史命令搜索特性 ‘Ctrl+r’ 的一个替代品,它就是 **“McFly”**。McFly 是一个使用 **Rust** 编程语言写就的简洁工具,自带一个智能的搜索引擎,用来替换默认的 Ctrl+r 这个 Bash 历史命令搜索特性。 McFly 提供的命令建议都是通过一个小巧的 **神经网络** 来实时排序给出的。 +假如你在命令行模式下渡过了很长时间,那么你必定使用过或者听说过 BASH 的 **反向搜索** 功能,在 Bash 中执行反向搜索功能的快捷键是 `Ctrl+r`。通过使用这个特性,我们可以找到我们执行过的命令而无需再次输入它们。当然,你可以使用上下键来搜索你的 bash 命令记录,但使用 `Ctrl+r` 快捷键可以让这个搜索过程更简单快速。今天我找寻到了 Bash 历史命令搜索特性 `Ctrl+r` 的一个替代品,它就是 McFly。McFly 是一个使用 Rust 编程语言写就的简洁工具,自带一个智能的搜索引擎,用来替换默认的 `Ctrl+r` 这个 Bash 历史命令搜索功能。 McFly 提供的命令建议都是通过一个小巧的 **神经网络** 来实时排序给出的。 -McFly 重新绑定了 Ctrl+r 快捷键,可以从你的 Bash 历史命令中找到所有最近执行过的命令。它通过追溯下面的信息来增强你的 shell 历史命令搜索特性: +McFly 重新绑定了 `Ctrl+r` 快捷键,可以从你的 Bash 历史命令中找到所有最近执行过的命令。它通过追溯下面的信息来增强你的 shell 历史命令搜索特性: * 命令结束状态 * 当你运行命令时的时间戳 @@ -34,9 +35,9 @@ McFly 维护着你的默认 Bash 历史文件,所以你可以随时停止使 ### 安装 McFly -在 Linux 中,McFly 可以使用 Linuxbrew 来安装。如若你还没有安装过 Linuxbrew,那么你可以参考下面的这个链接。(译者注:从其github 主页了解到也可以下载其二进制来使用。) +在 Linux 中,McFly 可以使用 Linuxbrew 来安装。如若你还没有安装过 Linuxbrew,那么你可以参考下面的这个链接。(LCTT 译注:从其 [GitHub 主页](https://github.com/cantino/mcfly)了解到也可以下载其二进制来使用。) -[Linuxbrew —— 一个使用 Linux 和 Mac OS X 的通用包管理][1] +- [Linuxbrew:一个用于 Linux 和 Mac OS X 的通用包管理][1] 一旦安装好了 Linuxbrew,运行下面的命令来安装 McFly: @@ -62,9 +63,10 @@ fi ``` ![](https://www.ostechnix.com/wp-content/uploads/2018/12/install-mcfly.png) + 正如你上面看到的那样,在使用 McFly 之前我们需要再做一些配置。 -将下面几行添加到你的 **~/.bashrc** 文件中: +将下面几行添加到你的 `~/.bashrc` 文件中: ``` if [ -f $(brew --prefix)/opt/mcfly/mcfly.bash ]; then @@ -88,7 +90,7 @@ McFly: Importing Bash history for the first time. This may take a minute or two. ### 使用方法 -要在你的命令中执行搜索,只需要键入 ‘mcfly search’ 再加上命令名的一部分,最后敲击 ENTER 键即可。Mcfly 将会基于你刚才键入的搜索查询语句给出命令建议。 +要在你的命令历史中执行搜索,只需要键入 `mcfly search` 再加上命令名的一部分,最后敲击回车键即可。Mcfly 将会基于你刚才键入的搜索查询语句给出命令建议。 ``` $ mcfly search @@ -104,7 +106,7 @@ $ mcfly search mk ![](https://www.ostechnix.com/wp-content/uploads/2018/12/mcfly-command-1.png) -如你所见,我已经使用过 'mkdir' 这个命令两次。假如你想从这些命令建议中执行其中之一,只需使用上下键来选择它,然后敲击 ENTER 键来执行它就可以了。假如你想编辑其中一个命令,则需要先选择它,然后敲 **TAB** 键将这个命令放置到终端中,最后在运行它之前更改它就行了。要从历史中删除已经选择的命令,按 **F2** 即可。 +如你所见,我已经使用过 `mkdir` 这个命令两次。假如你想从这些命令建议中执行其中之一,只需使用上下键来选择它,然后敲击**回车键**来执行它就可以了。假如你想编辑其中一个命令,则需要先选择它,然后敲 `TAB` 键将这个命令放置到终端中,最后在运行它之前更改它就行了。要从历史中删除已经选择的命令,按 `F2` 即可。 或者,输入下面的命令来打开历史搜索,然后输入任意一个命令或者命令的一部分来从你的历史命令中查看它提供的建议。 @@ -115,6 +117,7 @@ $ mcfly search 在你输入的同时, McFly 将会展示命令的提示。 下面是一个介绍 McFly 的简短演示视频: + ![](https://www.ostechnix.com/wp-content/uploads/2018/12/mcfly-demo.gif) 你还可以使用下面的命令来查看帮助: @@ -133,11 +136,11 @@ $ brew uninstall mcfly $ brew untap cantino/mcfly ``` -最后,移除先前添加到 **~/.bashrc** 文件中的几行命令。 +最后,移除先前添加到 `~/.bashrc` 文件中的几行命令。 好了,这些就是所有了,更多精彩内容敬请期待,请保存关注! -Cheers! +干杯! -------------------------------------------------------------------------------- @@ -146,7 +149,7 @@ via: https://www.ostechnix.com/mcfly-a-replacement-to-ctrlr-bash-history-search- 作者:[SK][a] 选题:[lujun9972][b] 译者:[FSSlc](https://github.com/FSSlc) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 4d08819ef9519fd9a95aa47fc42834251b0d244b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 4 Jan 2019 23:25:50 +0800 Subject: [PATCH 204/322] =?UTF-8?q?PUB:20181210=20McFly=20-=20A=20Replacem?= =?UTF-8?q?ent=20To=20=E2=80=98Ctrl-R-=20Bash=20History=20Search=20Feature?= =?UTF-8?q?.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @FSSlc https://linux.cn/article-10414-1.html --- ...- A Replacement To ‘Ctrl-R- Bash History Search Feature.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md (98%) diff --git a/translated/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md b/published/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md similarity index 98% rename from translated/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md rename to published/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md index a880ef1cf3..86f4e297c3 100644 --- a/translated/tech/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md +++ b/published/20181210 McFly - A Replacement To ‘Ctrl-R- Bash History Search Feature.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (FSSlc) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10414-1.html) [#]: subject: (McFly – A Replacement To ‘Ctrl+R’ Bash History Search Feature) [#]: via: (https://www.ostechnix.com/mcfly-a-replacement-to-ctrlr-bash-history-search-feature/) [#]: author: (SK https://www.ostechnix.com/author/sk/) From cae0218d113ef647625d772b297a872539c691ff Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 5 Jan 2019 00:15:14 +0800 Subject: [PATCH 205/322] PRF:20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md @qhwdw --- ... 5- Moving Subkeys to a Hardware Device.md | 173 ++++++++---------- 1 file changed, 77 insertions(+), 96 deletions(-) diff --git a/translated/tech/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md b/translated/tech/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md index 8dadad1193..cd72ae600a 100644 --- a/translated/tech/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md +++ b/translated/tech/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md @@ -1,159 +1,141 @@ 用 PGP 保护代码完整性(五):将子密钥移到一个硬件设备中 ====== +> 在这个系列教材中,将为你提供使用 PGP 和保护你的私钥的最佳体验。 + ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/pgp-keys.jpg?itok=aS6IWGpq) 在本系列教程中,我们将提供一个使用 PGP 的实用指南。如果你没有看过前面的文章,你可以通过下面的链接去查看。在这篇文章中,我们将继续讨论如何保护你的密钥,谈一谈将你的子密钥移到一个专门的硬件设备中的一些技巧。 -[第一部分:基本概念和工具][1] +- [第一部分:基本概念和工具][1] +- [第二部分:生成你的主密钥][2] +- [第三部分:生成 PGP 子密钥][3] +- [第四部分:将主密钥移到离线存储中][4] -[第二部分:生成你的主密钥][2] - -[第三部分:生成 PGP 子密钥][3] - -[第四部分:将主密钥移到离线存储中][4] - -### 清单 +#### 清单 * 取得一个 GnuPG 兼容的硬件设备(必要) - * 配置 GnuPG 在设备上工作(必要) - - * 设置 user 和 admin 的 PIN(必要) - + * 设置用户和管理员的 PIN(必要) * 移动子密钥到设备中(必要) +#### 考虑事项 - - -### 考虑事项 - -虽然现在主密钥已经不用担心泄露或失窃了,但子密钥仍然在你的 Home 目录中。任何得到它的人都能够解密你的通讯或假冒你的签名(如果他们知道密钥的密码)。并且,每次执行一个 GnuPG 操作都要将密钥加载到操作系统内存中,这将使一些更高级的恶意软件有机会得到你的密钥(想想 Meltdown 和 Spectre)。 +虽然现在主密钥已经不用担心泄露或失窃了,但子密钥仍然在你的家目录中。任何得到它的人都能够解密你的通讯或假冒你的签名(如果他们知道密钥的密码)。并且,每次执行一个 GnuPG 操作都要将密钥加载到操作系统内存中,这将使一些更高级的恶意软件有机会得到你的密钥(想想 Meltdown 和 Spectre)。 完全保护密钥的最好方式就是,将它移到一个专门的硬件设备中,这种硬件设备是一个可操作的智能卡。 -#### 智能卡的好处 +##### 智能卡的好处 一个智能卡包含一个加密芯片,它能够存储私钥,并且直接在智能卡内部执行秘密操作。因为密钥内容从来没有离开过智能卡,计算机操作系统并不能检索你插入的智能卡上的私钥。这与前面用于备份目的的加密 USB 存储是不同的 —— 虽然 USB 设备也是插入并解密的,但操作系统是能够去访问私钥内容的。使用外置的加密 USB 介质并不能代替智能卡设备的功能。 智能卡的一些其它好处: * 它们很便宜且易于获得 - * 它们小巧且易于携带 - * 它们可以用于多种设备上 - * 它们中的很多都具有防篡改功能(取决于制造商) - - - #### 可用的智能卡设备 -智能卡最初是嵌入到真实钱包大小的卡中,故而得名智能卡。你总是可以买到并使用 GnuPG 功能的智能卡,并且它们是你能得到的最便宜的可用设备之一。但是,事实上智能卡有一个很重要的缺点:它们需要一个智能卡读卡器,只有极小数的笔记本电脑上有这种读卡器。 +智能卡最初是嵌入到真实钱包大小的卡中,故而得名智能卡。你肯定可以买到并使用 GnuPG 功能的智能卡,并且它们是你能得到的最便宜的可用设备之一。但是,事实上智能卡有一个很重要的缺点:它们需要一个智能卡读卡器,只有极小数的笔记本电脑上有这种读卡器。 由于这个原因,制造商开始推出小型 USB 设备,它的大小和 U 盘类似,内置有微型智能卡,并且在芯片上简单地实现了智能卡协议特性。下面推荐几个这样的设备: * [Nitrokey Start][5]:开源硬件和自由软件,可用于 GnuPG 的最便宜的选择之一,但是额外的安全特性很少。 - * [Nitrokey Pro][6]:类似于 Nitrokey Start,它提供防篡改及更多的安全特性(但没有 U2F,具体查看指南的 U2F 节)。 - * [Yubikey 4][7]:专利硬件和软件,但比 Nitrokey Pro 便宜,并且可以用在最新的笔记本电脑上的 USB-C 接口;也提供像 U2F 这样的额外的安全特性。 - - - 我们推荐选一个同时具备智能卡功能和 U2F 的设备,在写这篇文章时,只能选择 Yubikey 4。 #### 配置智能卡设备 你的智能卡设备插入任何一台现代的 Linux 或 Mac 工作站上都应该能正常工作。你可以通过运行如下的命令去验证它: + ``` $ gpg --card-status - ``` 如果你没有收到错误,有一个完整的卡列表,就表示一切正常。不幸的是,排除为什么设备不能正常工作的所有可能原因,已经超出了本指南的范围。如果你的智能卡使用 GnuPG 时有问题,请通过你的操作系统的常见支持通道寻求支持。 ##### PIN 不一定是数字 -注意,尽管名为 “PIN”(暗示你它必须是一个“数字”),不论是 user PIN 还是 admin PIN 都不必非要是数字。 +注意,尽管名为 “PIN”(暗示你它必须是一个“数字”),不论是用户 PIN 还是管理员 PIN 都不必非要是数字。 -当你收到一个新设备时,它可能设置有一个默认的 user 和 admin PIN,对于 Yubikeys,它分别是 123456 和 12345678。如果它们的 PIN 不是默认的,请查看设备附带的说明书。 +当你收到一个新设备时,它可能设置有一个默认的用户和管理员 PIN,对于 Yubikey,它分别是 `123456` 和 `12345678`。如果它们的 PIN 不是默认的,请查看设备附带的说明书。 ##### 快速设置 为配置你的智能卡,你需要使用 GnuPG 菜单系统,因此这里并没有更方便的命令行开关: + ``` $ gpg --card-edit [...omitted...] gpg/card> admin Admin commands are allowed gpg/card> passwd - ``` -你应该去设置 user PIN (1)、admin PIN (3)、和 Reset Code (4)。请确保把它们记录并保存到一个安全的地方 —— 尤其是 Admin PIN 和 Reset Code(它允许你去擦除整个智能卡内容)。你很少使用到 Admin PIN,因此如果你不记录下来,很可能会忘掉它。 +你应该去设置用户 PIN (1)、管理员 PIN (3)、和重置码 (4)。请确保把它们记录并保存到一个安全的地方 —— 尤其是管理员 PIN 和重置码(它允许你去擦除整个智能卡内容)。你很少使用到管理员 PIN,因此如果你不记录下来,很可能会忘掉它。 返回到智能卡主菜单,你也可以设置其它值(比如名字、性别、登入日期、等等),但是这些都不是必需的,一旦你的智能卡丢失了,将导致额外的信息泄露。 #### 将子密钥移到你的智能卡中 -退出卡菜单(使用 “q” 命令)保存所有更改。接下来,我们将你的子密钥移到智能卡中。将需要用到你的 PGP 密钥的密码,在大多数的智能卡操作中都将用到 admin PIN。记住,那个 [fpr] 表示你的密钥的完整的 40 个字符的指纹。 +退出卡菜单(使用 `q` 命令)保存所有更改。接下来,我们将你的子密钥移到智能卡中。将需要用到你的 PGP 密钥的密码,在大多数的智能卡操作中都将用到管理员 PIN。记住,那个 `[fpr]` 表示你的密钥的完整的 40 个字符的指纹。 + ``` $ gpg --edit-key [fpr] Secret subkeys are available. -pub rsa4096/AAAABBBBCCCCDDDD - created: 2017-12-07 expires: 2019-12-07 usage: C - trust: ultimate validity: ultimate -ssb rsa2048/1111222233334444 - created: 2017-12-07 expires: never usage: E -ssb rsa2048/5555666677778888 - created: 2017-12-07 expires: never usage: S +pub rsa4096/AAAABBBBCCCCDDDD + created: 2017-12-07 expires: 2019-12-07 usage: C + trust: ultimate validity: ultimate +ssb rsa2048/1111222233334444 + created: 2017-12-07 expires: never usage: E +ssb rsa2048/5555666677778888 + created: 2017-12-07 expires: never usage: S [ultimate] (1). Alice Engineer -[ultimate] (2) Alice Engineer +[ultimate] (2) Alice Engineer gpg> - ``` -使用 --edit-key 再次进入到菜单模式,你将注意到那个密钥清单有一点小差别。从现在开始,所有的命令都是在这个菜单模式下运行,它用 gpg> 提示符来表示。 +使用 `--edit-key` 再次进入到菜单模式,你将注意到那个密钥清单有一点小差别。从现在开始,所有的命令都是在这个菜单模式下运行,它用 `gpg>` 提示符来表示。 首先,我们来选择移到智能卡中的密钥 —— 你可以通过键入 `key 1`(它表示选择清单中的第一个密钥)来实现: + ``` gpg> key 1 - ``` 这个输出会有一点细微的差别: + ``` -pub rsa4096/AAAABBBBCCCCDDDD - created: 2017-12-07 expires: 2019-12-07 usage: C - trust: ultimate validity: ultimate +pub rsa4096/AAAABBBBCCCCDDDD + created: 2017-12-07 expires: 2019-12-07 usage: C + trust: ultimate validity: ultimate ssb* rsa2048/1111222233334444 - created: 2017-12-07 expires: never usage: E -ssb rsa2048/5555666677778888 - created: 2017-12-07 expires: never usage: S + created: 2017-12-07 expires: never usage: E +ssb rsa2048/5555666677778888 + created: 2017-12-07 expires: never usage: S [ultimate] (1). Alice Engineer -[ultimate] (2) Alice Engineer - +[ultimate] (2) Alice Engineer ``` -注意与密钥对应的 ssb 行旁边的 `*` —— 它表示这是当前选定的密钥。它是可切换的,意味着如果你再次输入 `key 1`,这个 `*` 将消失,这个密钥将不再被选中。 +注意与密钥对应的 `ssb` 行旁边的 `*` —— 它表示这是当前选定的密钥。它是可切换的,意味着如果你再次输入 `key 1`,这个 `*` 将消失,这个密钥将不再被选中。 现在,我们来将密钥移到智能卡中: + ``` gpg> keytocard Please select where to store the key: - (2) Encryption key + (2) Encryption key Your selection? 2 - ``` -由于它是我们的 [E] 密钥,把它移到加密区中是有很有意义的。当你提交了你的选择之后,将会被提示输入你的 PGP 密钥的保护密码,接下来输入智能卡的 admin PIN。如果命令没有返回错误,表示你的密钥已经被移到智能卡中了。 +由于它是我们的 [E] 密钥,把它移到加密区中是有很有意义的。当你提交了你的选择之后,将会被提示输入你的 PGP 密钥的保护密码,接下来输入智能卡的管理员 PIN。如果命令没有返回错误,表示你的密钥已经被移到智能卡中了。 **重要:** 现在再次输入 `key 1` 去取消选中第一个密钥,并输入 `key 2` 去选择 [S] 密钥: @@ -162,42 +144,41 @@ gpg> key 1 gpg> key 2 gpg> keytocard Please select where to store the key: - (1) Signature key - (3) Authentication key + (1) Signature key + (3) Authentication key Your selection? 1 - ``` -你可以使用 [S] 密钥同时做签名和验证,但是我们希望确保它在签名区,因此,我们选择 (1)。完成后,如果你的命令没有返回错误,表示操作已成功。 +你可以使用 [S] 密钥同时做签名和验证,但是我们希望确保它在签名区,因此,我们选择 (`1`)。完成后,如果你的命令没有返回错误,表示操作已成功。 + +最后,如果你创建了一个 [A] 密钥,你也可以将它移到智能卡中,但是你需要先取消选中 `key 2`。完成后,选择 `q`: -最后,如果你创建了一个 [A] 密钥,你也可以将它移到智能卡中,但是你需要先取消选中 `key 2`。完成后,选择 “q": ``` gpg> q Save changes? (y/N) y - ``` -保存变更将把你的子密钥移到智能卡后,把你的 Home 目录中的相应子密钥删除(没有关系,因为我们的备份中还有,如果更换了智能卡,你需要再做一遍)。 +保存变更将把你的子密钥移到智能卡后,把你的家目录中的相应子密钥删除(没有关系,因为我们的备份中还有,如果更换了智能卡,你需要再做一遍)。 ##### 验证移动后的密钥 现在,如果你执行一个` --list-secret-keys` 操作,你将看到一个稍有不同的输出: + ``` $ gpg --list-secret-keys -sec# rsa4096 2017-12-06 [C] [expires: 2019-12-06] - 111122223333444455556666AAAABBBBCCCCDDDD -uid [ultimate] Alice Engineer -uid [ultimate] Alice Engineer -ssb> rsa2048 2017-12-06 [E] -ssb> rsa2048 2017-12-06 [S] - +sec# rsa4096 2017-12-06 [C] [expires: 2019-12-06] + 111122223333444455556666AAAABBBBCCCCDDDD +uid [ultimate] Alice Engineer +uid [ultimate] Alice Engineer +ssb> rsa2048 2017-12-06 [E] +ssb> rsa2048 2017-12-06 [S] ``` -在 ssb> 的输出中的 `>` 表示子密钥仅在智能卡上有效。如果你进入到你的密钥目录中,查看目录的内容,你将会看到那个 `.key` 文件已经被存根替换: +在 `ssb>` 的输出中的 `>` 表示子密钥仅在智能卡上有效。如果你进入到你的密钥目录中,查看目录的内容,你将会看到那个 `.key` 文件已经被存根替换: + ``` $ cd ~/.gnupg/private-keys-v1.d $ strings *.key - ``` 这个输出将包含一个影子私钥,它表示那个文件仅是个存根,真正的内容在智能卡中。 @@ -205,29 +186,29 @@ $ strings *.key #### 验证智能卡的功能 验证智能卡能否如期正常运行,你可以通过创建一个签名来验证: + ``` $ echo "Hello world" | gpg --clearsign > /tmp/test.asc $ gpg --verify /tmp/test.asc - ``` -首次运行这个命令时将询问你智能卡的 PIN,在你运行 `gpg —verify` 之后,它将显示 "Good signature”。 +首次运行这个命令时将询问你智能卡的 PIN,在你运行 `gpg —verify` 之后,它将显示 “Good signature”。 祝贺你,你已经成功将窃取你的开发者数字身份变得更加困难了! -### 其它常见 GnuPG 操作 +#### 其它常见 GnuPG 操作 下面是使用你的 PGP 密钥需要做的一些常见操作的快速指南。 -在下面的所有命令中,[fpr] 表示你的密钥指纹。 +在下面的所有命令中,`[fpr]` 表示你的密钥指纹。 -#### 挂载主密钥离线存储 +##### 挂载主密钥离线存储 + +下面的一些操作将需要你的主密钥,因此首先需要去挂载你的主密钥离线存储,并告诉 GnuPG 去使用它。首先,找出介质挂载路径,可以通过查看 `mount` 命令的输出找到它。接着,设置你的 GnuPG 目录为你的介质上备份的目录,并告诉 GnuPG 将那个目录做为它的家目录: -下面的一些操作将需要你的主密钥,因此首先需要去挂载你的主密钥离线存储,并告诉 GnuPG 去使用它。首先,找出介质挂载路径,可以通过查看 mount 命令的输出找到它。接着,设置你的 GnuPG 目录为你的介质上备份的目录,并告诉 GnuPG 将那个目录做为它的 Home: ``` $ export GNUPGHOME=/media/disk/name/gnupg-backup $ gpg --list-secret-keys - ``` 确保你在输出中看到的是 `sec` 而不是 `sec#`(这个 `#` 表示密钥不可用,仍然使用的是惯常的那个 Home 目录)。 @@ -235,53 +216,53 @@ $ gpg --list-secret-keys ##### 更新你惯常使用的那个 GnuPG 工作目录 在你的离线存储上做了任何更改之后,你应该将这些更改同步应用到你惯常使用的工作目录中: + ``` $ gpg --export | gpg --homedir ~/.gnupg --import $ unset GNUPGHOME - ``` -#### 延长密钥过期日期 +##### 延长密钥过期日期 我们创建的主密钥的默认过期日期是自创建之日起两年后。这样做都是为安全考虑,这样将使淘汰密钥最终从密钥服务器上消失。 延长你的密钥过期日期,从当前日期延长一年,只需要运行如下命令: + ``` $ gpg --quick-set-expire [fpr] 1y - ``` 如果为了好记住,你也可以使用一个特定日期(比如,你的生日、1 月 1 日、或加拿大国庆日): + ``` $ gpg --quick-set-expire [fpr] 2020-07-01 - ``` 记得将更新后的密钥发送到密钥服务器: + ``` $ gpg --send-key [fpr] - ``` -#### 吊销身份 +##### 吊销身份 如果你需要吊销一个身份(比如,你换了雇主并且旧的邮件地址不再有效了),你可以使用一行命令搞定: + ``` $ gpg --quick-revoke-uid [fpr] 'Alice Engineer ' - ``` 你也可以通过使用 `gpg --edit-key [fpr]` 在菜单模式下完成同样的事情。 完成后,记得将更新后的密钥发送到密钥服务器上: + ``` $ gpg --send-key [fpr] - ``` 下一篇文章中,我们将谈谈 Git 如何支持 PGP 的多级别集成。 -通过来自 Linux 基金会和 edX 的免费课程 [“Linux 入门" ][8]学习更多 Linux 知识。 +通过来自 Linux 基金会和 edX 的免费课程 [“Linux 入门”][8]学习更多 Linux 知识。 -------------------------------------------------------------------------------- @@ -289,15 +270,15 @@ via: https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-p 作者:[KONSTANTIN RYABITSEV][a] 译者:[qhwdw](https://github.com/qhwdw) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]:https://www.linux.com/users/mricon -[1]:https://www.linux.com/blog/learn/2018/2/protecting-code-integrity-pgp-part-1-basic-pgp-concepts-and-tools -[2]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-2-generating-and-protecting-your-master-pgp-key -[3]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-3-generating-pgp-subkeys -[4]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-4-moving-your-master-key-offline-storage +[1]:https://linux.cn/article-9524-1.html +[2]:https://linux.cn/article-9529-1.html +[3]:https://linux.cn/article-9607-1.html +[4]:https://linux.cn/article-10402-1.html [5]:https://shop.nitrokey.com/shop/product/nitrokey-start-6 [6]:https://shop.nitrokey.com/shop/product/nitrokey-pro-3 [7]:https://www.yubico.com/product/yubikey-4-series/ From 7b6aa3850c0d229239efcc33fdeae733b2b6734b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 5 Jan 2019 00:15:33 +0800 Subject: [PATCH 206/322] PUB:20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md @qhwdw https://linux.cn/article-10415-1.html --- ...rity with PGP - Part 5- Moving Subkeys to a Hardware Device.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md (100%) diff --git a/translated/tech/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md b/published/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md similarity index 100% rename from translated/tech/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md rename to published/20180314 Protecting Code Integrity with PGP - Part 5- Moving Subkeys to a Hardware Device.md From 96c37b5d79250855be0329d0c82fe3821947a7ef Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Sat, 5 Jan 2019 10:22:02 +0800 Subject: [PATCH 207/322] Translating by qhwdw --- ...Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md b/sources/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md index f7d0af8187..a7a0707466 100644 --- a/sources/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md +++ b/sources/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (qhwdw) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 9fc0d49c7e55500736b52846acd42bfa15e836d9 Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Sat, 5 Jan 2019 11:38:07 +0800 Subject: [PATCH 208/322] Translated by qhwdw --- ...y - Raspberry Pi- Lesson 0 Introduction.md | 53 ------------------- ...y - Raspberry Pi- Lesson 0 Introduction.md | 53 +++++++++++++++++++ 2 files changed, 53 insertions(+), 53 deletions(-) delete mode 100644 sources/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md create mode 100644 translated/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md diff --git a/sources/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md b/sources/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md deleted file mode 100644 index a7a0707466..0000000000 --- a/sources/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md +++ /dev/null @@ -1,53 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (qhwdw) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 0 Introduction) -[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html) -[#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) - -Computer Laboratory – Raspberry Pi: Lesson 0 Introduction -====== - -This introductory lesson does not contain a practical element, but exists to explain the basic concepts of what is an operating system, what is assembly code and other important basics. If you just want to get straight into practicals, it should be safe to skip this lesson. - -### 1 Operating Systems - -An operating system is just a very complicated program. It has the job of organising other programs on a computer, including sharing the computer's time, memory, hardware and other resources. Some big families of desktop operating systems that you may have heard of include GNU/Linux, Mac OS X and Microsoft Windows. Other devices also need operating systems such as phones, which may use operating systems such as Android, iOS and Windows Phone.[1] - -Since the operating system has to interact with the hardware on a computer system, it also has to have specific knowledge of the hardware on a system. To allow operating systems to be used on a variety of computers, the concept of **drivers** was invented. Drivers are small bits of code that can be added and removed from the operating system in order to allow the operating system to talk to a particular piece of hardware. In this course, we do not cover how to create such removable drivers, and instead focus on making specific ones for the Raspberry Pi. - -There are all kinds of different designs of operating systems, and this course can only just scratch the surface. In this course we will mainly focus on getting the operating system to interact with a variety of bits of hardware, as this is often the trickiest bit, and the part for which the least documentation and help exists online. - -### 2 Assembly Code - -``` -A processor can often perform millions of instructions per second, but they must be simple. -``` - -This course will be written almost exclusively in assembly code. Assembly code is code that is very close to what the computer understands. How a computer really works is that there is a small device called a processor which is capable of performing simple jobs like adding numbers, and there is a set of one or more microchips called the **RAM** which are capable of storing numbers. When a computer has power, the processor works through a sequence of instructions given to it by the programmer, which cause it to change numbers in the RAM, and interact with connected hardware. Assembly code is a translation into human readable text of those commands. - -When programming normally, the programmer writes code in a programming language such as C++, Java, C#, Basic, etc, and then a program called the compiler translates what the programmer wrote into assembly code, which is the further reduced into binary code[2]. Binary code is what the computer actually understands, but it is almost impossible for humans to read. Assembly code is much better, but it can be frustrating how few commands are possible. Remember that every command you write in assembly code is something that the processor understands directly, and so the commands are simple by design, as a physical circuit must process each one. - -![Compiler process][1] - -Just like with ordinary programming, there are many different assembly code languages, however unlike ordinary programming, the reason these exist is due to the fact that there exists many different processors, each designed to understand a different language. Thus a program written in assembly code for one machine, will not work on a different one. For most things, this would be a disaster as each program would have to be rewritten for every system it was used on, but for operating systems this isn't so much of a problem, as it would have to be rewritten anyway due to differing hardware. Nevertheless, most operating systems are written in C++ or C, so that they can be converted more easily, and only the sections that absolutely have to be written in assembly are. - -You're now ready to move on to the first lesson, [Lesson 1: OK01][2] - --------------------------------------------------------------------------------- - -via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html - -作者:[Robert Mullins][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: http://www.cl.cam.ac.uk/~rdm34 -[b]: https://github.com/lujun9972 -[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/compiling.png -[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html diff --git a/translated/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md b/translated/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md new file mode 100644 index 0000000000..8f4f6a4bcc --- /dev/null +++ b/translated/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md @@ -0,0 +1,53 @@ +[#]: collector: (lujun9972) +[#]: translator: (qhwdw) +[#]: reviewer: () +[#]: publisher: () +[#]: url: () +[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 0 Introduction) +[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html) +[#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) + +计算机实验室 – 树莓派:课程 0:简介 +====== + +这个课程简介不包含实践内容,但它解释了一个操作系统的基本概念、汇编代码、和其它很重要的一些基本原理。如果你想直接进入实践环节,跳过本课程并不会有什么问题。 + +### 1、操作系统 + +一个操作系统就是一个非常复杂的程序。它的任务就是组织安排计算机上的其它程序,包括共享计算机的时间、内存、硬件和其它资源。你可能听说过的一些比较大的桌面操作系统家族有 GNU/Linux、Mac OS X 和 Microsoft Windows。其它的设备比如电话,也需要操作系统,它可能使用的操作系统是 Android、iOS 和 [Windows Phone][https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html#note1] + +由于操作系统是用来与计算机系统上的硬件进行交互的,所以它必须有系统上硬件专有的内容。为了能让操作系统适用于各种类型的计算机,发明了 **驱动程序** 的概念。驱动程序是为了能够让操作系统与特定的硬件进行交互而添加(并可删除)到操作系统上的一小部分代码。在本课程中,我们并不涉及如何创建可删除的驱动程序,而是专注于特定的一个硬件:树莓派。 + +操作系统有各种不同的设计方式,在本课程中,我们只触及操作系统设计的皮毛。本课程中,我们主要专注于操作系统与各种硬件的交互部分,因为这经常是比较棘手的部分,并且也是在网络上文档和帮助最少的部分。 + +### 2、汇编代码 + +``` +一个处理器每秒可以执行上百万的指令,但是这些指令必须要简单。 +``` + +本课程几乎要完全靠汇编代码来写。汇编代码非常接近计算机的底层。计算机其实是靠一个叫处理器的设备来工作的,处理器能够执行像加法这样的简单任务,还有一组叫做 **RAM** 的芯片,它能够用来保存数字。当计算机通电后,处理器执行程序员给定的一系列指令,这将导致内存中的数字发生变化,以及与连接的硬件进行交互。汇编代码只是将这些机器命令转换为人类可读的文本。 + +常规的编程就是,程序员使用编程语言,比如 C++、Java、C#、Basic、等等来写代码,然后一个叫编译器的程序将程序员写的代码转换成汇编代码,然后进一步转换为[二进制代码][https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html#note2]。二进制代码才是计算机真正能够理解的东西,但它是人类无法读取的东西。汇编代码比二进制代码好一点,至少它的命令是人类可读的,但它仍然让人很沮丧。请记住,你用汇编代码写的每个命令都是处理器可以直接认识的,因此这些命令设计的很简单,因为物理电路必须能够处理每个命令。 + +![Compiler process][1] + +和普通编程一样,也有很多不同的汇编代码编程语言,但与普通编程不一样的是,每个汇编编程语言是面对不同的处理器的,每种处理器设计为去理解不同的语言。因此,用一个针对某种机器设计的汇编语言所写的汇编代码,是不能在其它种类的机器上运行的。很多情况下,这都是一个大灾难,因此每个程序都必须在使用它的不同种类的机器上重写一遍,但对于操作系统,这不是个问题,因为在不同的硬件上它必须得重写。尽管如此,大多数操作系统都是用 C++ 或 C 来写的,这样它们就可以很容易地在不同种类的硬件上使用,只需要重写那些必须用汇编代码来实现的部分即可。 + +现在,你已经准备好进入第一节课了,它是 [课程 1:OK01][2] + +-------------------------------------------------------------------------------- + +via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html + +作者:[Robert Mullins][a] +选题:[lujun9972][b] +译者:[qhwdw](https://github.com/qhwdw) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://www.cl.cam.ac.uk/~rdm34 +[b]: https://github.com/lujun9972 +[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/compiling.png +[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html From 54537c1db23f165a3097835f482892a4be4a54a4 Mon Sep 17 00:00:00 2001 From: runningwater Date: Sat, 5 Jan 2019 15:11:59 +0800 Subject: [PATCH 209/322] Update 20170921 The Rise and Rise of JSON.md --- sources/talk/20170921 The Rise and Rise of JSON.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sources/talk/20170921 The Rise and Rise of JSON.md b/sources/talk/20170921 The Rise and Rise of JSON.md index 5603c7bacf..f6d54edfc9 100644 --- a/sources/talk/20170921 The Rise and Rise of JSON.md +++ b/sources/talk/20170921 The Rise and Rise of JSON.md @@ -1,3 +1,12 @@ +[#]: collector: (lujun9972) +[#]: translator: (runningwater) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (The Rise and Rise of JSON) +[#]: via: ( https://twobithistory.org/2017/09/21/the-rise-and-rise-of-json.html) +[#]: author: (https://twobithistory.org) +[#]: url: ( ) + The Rise and Rise of JSON ====== JSON has taken over the world. Today, when any two applications communicate with each other across the internet, odds are they do so using JSON. It has been adopted by all the big players: Of the ten most popular web APIs, a list consisting mostly of APIs offered by major companies like Google, Facebook, and Twitter, only one API exposes data in XML rather than JSON. Twitter, to take an illustrative example from that list, supported XML until 2013, when it released a new version of its API that dropped XML in favor of using JSON exclusively. JSON has also been widely adopted by the programming rank and file: According to Stack Overflow, a question and answer site for programmers, more questions are now asked about JSON than about any other data interchange format. From 811f4483dbe0c45cef3a97e5d3838cf5674baf99 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 5 Jan 2019 15:41:17 +0800 Subject: [PATCH 210/322] PRF:20181220 Let your Linux terminal speak its mind.md @zhs852 --- ...1220 Let your Linux terminal speak its mind.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/translated/tech/20181220 Let your Linux terminal speak its mind.md b/translated/tech/20181220 Let your Linux terminal speak its mind.md index cbf61034a6..b58a9cd2a2 100644 --- a/translated/tech/20181220 Let your Linux terminal speak its mind.md +++ b/translated/tech/20181220 Let your Linux terminal speak its mind.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (zhs852) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Let your Linux terminal speak its mind) @@ -9,11 +9,12 @@ 让 Linux 终端说出它的想法 ====== + > eSpeak 是一个可在 Linux 命令行中使用的开源的 TTS 合成器。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-cava.png?itok=4EWYL8uZ) -欢迎回到《24 天介绍 Linux 命令行小玩具》。如果这是你首次阅读本系列文章,你大概连什么是 Linux 命令行小玩具都不知道。无需担心,你只需要边看边体会。通常来说,它有可能是游戏或其它能让你在终端中娱乐的小程序。 +欢迎回到《24 天介绍 Linux 命令行小玩具》。如果这是你首次阅读本系列文章,你可能不知道什么是 Linux 命令行小玩具。无需担心,你只需要边看边体会。通常来说,它有可能是游戏或其它能让你在终端中娱乐的小程序。 或许你已经对一些玩具有了解了,不过我们相信,在本系列文章中总有那么几个你没见过的玩意。 @@ -21,17 +22,17 @@ 我们也许永远不会忘记来自 [2001 太空漫游][1] 中与机组人员交流的 HAL 9000。但是在 1960 年代到今天的时间里,是存在着许多能说话的计算机的。它们有些很出色,也有些不那么出色。 -其中一个我最爱的是一个叫做 [eSpeak][2] 的开源项目。它以多种形式被发布,比如可以嵌入你自己项目中的库。与此同时,它也提供了可供你安装的命令行版本。在我所用的发行版中,安装十分简单,只需使用: +其中一个我最爱的是一个叫做 [eSpeak][2] 的开源项目。它以多种形式发布,比如可以嵌入你自己项目中的库。与此同时,它也提供了可供你安装的命令行版本。在我所用的发行版中,安装十分简单,只需使用: ``` $ sudo dnf install espeak ``` -你既可以与 eSpeak 交互,也可以用它来输出其它程序的信息,甚至通过简单的 echo 命令来使用它。[这里][3] 有一些可供 eSpeak 使用的声音文件,你可以在无聊时切换他们。甚者你可以制作一个属于你自己的声音。 +你既可以与 eSpeak 交互,也可以用它来输出其它程序的信息,甚至通过简单的 `echo` 命令来使用它。[这里][3] 有一些可供 eSpeak 使用的声音文件,你可以在无聊时切换他们。甚者你可以制作一个属于你自己的声音。 -在 2015 年,一些希望继续 eSpeak 开发的开发者创建了一个名为 eSpeak NG (即 "Next Generation",“下一代”的意思)的项目。eSpeak 目前在 GPL v3 许可证下开源,你可以在 [SourceForge][2] 上详细了解这个项目或下载源代码。 +在 2015 年,一些希望继续 eSpeak 开发的开发者创建了一个名为 eSpeak NG (即 “Next Generation”,“下一代”的意思)的项目。eSpeak 目前在 GPL v3 许可证下开源,你可以在 [SourceForge][2] 上详细了解这个项目或下载源代码。 -别急,我今天还会介绍一个额外的小程序,它叫 [cava][4]。我经常希望用一张独一无二的截图作为我文章的头图,更何况今天的玩具主要是关于声音的,导致图片更少了。因此,我需要一些东西来填补这些空白。Cava 是 "console-based audio visualizer for ALSA" (译注:基于 ALSA 的命令行音频可视化工具)(尽管它现在支持的比 ALSA 更多)的简写,它是一个优秀的命令行音频可视化工具,并且它正以 MIT 许可证开源。下面是一个将 eSpeak 输出可视化的命令: +别急,我今天还会介绍一个额外的小程序,它叫 [cava][4]。我经常希望用一张独一无二的截图作为我文章的头图,更何况今天的玩具主要是关于声音的,这就图片更少了。因此,我需要一些东西来填补这些空白。Cava 是基于 ALSA 的命令行音频可视化工具console-based audio visualizer for ALSA的简写(尽管它现在支持的比 ALSA 更多),它是一个优秀的命令行音频可视化工具,并且它正以 MIT 许可证开源。下面是一个将 eSpeak 输出可视化的命令: ``` $ echo "Rudolph, the red-nosed reindeer, had a very shiny nose." | espeak @@ -50,7 +51,7 @@ via: https://opensource.com/article/18/12/linux-toy-espeak 作者:[Jason Baker][a] 选题:[lujun9972][b] 译者:[zhs852](https://github.com/zhs852) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 238f9506b64d183ae220f6354db902121812bce1 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 5 Jan 2019 15:42:25 +0800 Subject: [PATCH 211/322] PUB:20181220 Let your Linux terminal speak its mind.md @zhs852 https://linux.cn/article-10416-1.html --- .../20181220 Let your Linux terminal speak its mind.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181220 Let your Linux terminal speak its mind.md (98%) diff --git a/translated/tech/20181220 Let your Linux terminal speak its mind.md b/published/20181220 Let your Linux terminal speak its mind.md similarity index 98% rename from translated/tech/20181220 Let your Linux terminal speak its mind.md rename to published/20181220 Let your Linux terminal speak its mind.md index b58a9cd2a2..6a49dde11f 100644 --- a/translated/tech/20181220 Let your Linux terminal speak its mind.md +++ b/published/20181220 Let your Linux terminal speak its mind.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (zhs852) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10416-1.html) [#]: subject: (Let your Linux terminal speak its mind) [#]: via: (https://opensource.com/article/18/12/linux-toy-espeak) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) From 5069157b50bdfcdd7e3ac37902b3890035424ba8 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 5 Jan 2019 20:42:34 +0800 Subject: [PATCH 212/322] PRF:20170928 How to create a free baby monitoring system with Gonimo.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @lintaov587 恭喜你,完成了第一篇翻译。 --- ...free baby monitoring system with Gonimo.md | 87 +++++++------------ 1 file changed, 33 insertions(+), 54 deletions(-) diff --git a/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md b/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md index 95c495e814..f45bc72e28 100644 --- a/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md +++ b/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md @@ -1,108 +1,87 @@ 如何用 Gonimo 创建一个免费的婴儿监视系统 ====== +> 当你可以用两个设备、浏览器和网络连接就能免费搭建一个婴儿监视器时,谁还会花钱去买呢? + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/baby.png?itok=7jyDs9vE) -新父母和准父母很快就会知道将会有一个长且昂贵的新生儿所需设备的清单,清单中的首位是一个婴儿监视器,借此他们可以在做其他事情时照看自己的婴儿,但这儿有一件不必消耗你的婴儿经费的设备,Gonimo 是一个可以将现有的设备转换成婴儿监控系统的免费的开源解决方案,为附近大型婴儿用品商店的过道中数以千计的其他必备或时尚物品中的任何一个腾出一些婴儿的预算。 +新父母和准父母很快就会知道将会有一个既长且昂贵的新生儿所需设备的清单,清单中的首位是一个婴儿监视器,借此他们可以在做其他事情时照看自己的婴儿,但这儿有一件不必消耗你的婴儿经费的设备,Gonimo 是一个可以将现有的设备转换成婴儿监控系统的自由开源解决方案,附近大型婴儿用品商店的过道中有数以千计的其他必备或时尚物品,就可以为其中某一个腾出一些婴儿的预算。 Gonimo 诞生时,它的开发者,一个有双胞胎的开源粉丝,发现现有选择存在问题: - * 现有硬件婴儿监视器价格昂贵,范围有限,需要您携带额外的设备。 - * 虽然有移动监控应用程序,但大多数现有的 iOS / Android 婴儿监控应用程序都不可靠且不安全,没有明显的开源产品。 + * 现有硬件婴儿监视器价格昂贵,使用范围有限,需要您带着额外的设备。 + * 虽然有移动监控应用程序,但大多数现有的 iOS / Android 婴儿监控应用程序都不可靠且不安全,不太容易找到开源产品。 * 如果您有两个小孩(例如双胞胎),您将需要两台监视器,使您的成本翻倍。 - - -Gonimo是作为一个典型监视器缺点的开源解决方案而创建的: +Gonimo 是作为一个解决典型的监视器的缺点的开源解决方案而创建的: * 昂贵?不,它是免费的! - * 范围有限?不,它适用于互联网 / WiFi,无论您身在何处。 + * 使用范围有限?不,它适用于互联网 / WiFi,无论您身在何处。 * 下载并安装应用程序?噢不,它适用于您现有的网络浏览器。 - * 购买新设备?不用,你可以使用任何笔记本电脑,手机或平板电脑与网络浏览器和麦克风和/或相机。 + * 购买新设备?不用,你可以使用任何笔记本电脑、手机或平板电脑与网络浏览器和麦克风和/或相机。 - - -(注意:遗憾的是,Apple iOS 设备尚不支持,但预计很快就会发生变化 - 请继续阅读,了解如何帮实现这一目标助。) +(注意:遗憾的是,Apple iOS 设备尚不支持,但预计很快就会发生变化 —— 请继续阅读,了解如何帮实现这一目标。) ### 开始 -将您的设备转换为婴儿监视器很容易。从您设备的浏览器(理想情况下为 Chrome ),访问 [gonimo.com] [1]并单击启动婴儿监视器以访问 Web 应用程序。 - - 1. **创建家庭:** 在第一次启动屏幕上,你会看到一只可爱的兔子在地球上奔跑。这是您创建新家庭的地方。单击 **+** 按钮并接受随机生成的姓氏或键入您自己的选择。 - +将您的设备转换为婴儿监视器很容易。从您设备的浏览器(理想情况下为 Chrome),访问 [gonimo.com][1] 并单击 “Start baby monitor” 以访问该 Web 应用程序。 +1、创建家庭:在首次启动的屏幕上,你会看到一只可爱的兔子在地球上奔跑。这是您创建新家庭的地方。单击 “+” 按钮并接受随机生成的姓氏或键入您自己的选择。 ![Start screen][3] +*从开始屏幕创建一个新家庭* -从开始屏幕创建一个新家庭 - - 1. **邀请设备:** 建立完家庭以后,下个屏幕将指示您邀请其他设备加入你的 Gonimo 家庭。您可以通过电子邮件直接发送一次性邀请链接,也可以将其复制并粘贴到邮件中。对其他设备,只需打开链接并接受邀请。对您要邀请的任何其他设备重复此过程。您的设备现在属于同一家庭,可以作为一个完全正常工作的婴儿监视器系统进行配合。 - - +2、邀请设备:建立完家庭以后,下个屏幕将指示您邀请其他设备加入你的 Gonimo 家庭。您可以通过电子邮件直接发送一次性邀请链接,也可以将其复制并粘贴到消息中。对其他设备,只需打开该链接并接受邀请。对您要邀请的任何其他设备重复此过程。您的设备现在属于同一家庭,可以作为一个完全正常工作的婴儿监视器系统进行配合。 ![Invite screen][5] +*邀请家庭成员* -邀请家庭成员 - - 1. **启动婴儿站流:** 接下来,通过转到 [Gonimo home screen][6],点击带有奶嘴的按钮,并允许网络浏览器访问设备的麦克风和摄像头,选择将婴儿的音频和视频流式传输到父母的设备。调整相机以指向宝宝的床,或关闭它以节省设备电池(音频仍将流式传输)。点击开始。该流现在处于活动状态。 - - +3、启动婴儿站流:接下来,通过转到 [Gonimo 主屏][6],点击带有奶嘴的按钮,并允许网络浏览器访问设备的麦克风和摄像头,选择将婴儿的音频和视频流式传输到父母的设备。调整相机以指向宝宝的床,或关闭它以节省设备电池(音频仍将流式传输)。点击“Start”。该流现在处于活动状态。 ![Select baby station][8] - -选择婴儿站 +*选择婴儿站* ![Press Start][10] +*按“Start”开始以流式传输视频* -按“Start”开始以流式传输视频 - - 1. **连接到双亲站流:** 要查看婴儿站流,请转到 Gonimo 家族中的其他设备 - 这是双亲站。点击 Gonimo 主屏幕上的 “Parent” 按钮。您将看到该系列中所有设备的列表;旁边有一个活跃的婴儿站将是一个短时连接按钮。选择连接,您可以通过点对点音频/视频流看到和听到您的宝宝。音量条为传输的音频流提供可视化。 - +4、连接到父母站流:要查看婴儿站流,请转到 Gonimo 家族中的另外的设备 —— 即父母站。点击 Gonimo 主屏幕上的 “Parent” 按钮。您将看到该系列中所有设备的列表;旁边有一个闪动的“Connect”按钮的是活跃的婴儿站。选择“Connect”,您可以通过点对点音频/视频流看到和听到您的宝宝。音量条为传输的音频流提供可视化。 ![Select parent station][12] - -选择双亲站 +*选择父母站* ![Press Connect][14] +*按下“Connect”开始观看婴儿流。* -按下“Connect”开始观看婴儿流。 +5、恭喜!您已成功将设备直接通过网络浏览器转换为婴儿监视器,无需下载或安装任何应用程序! - 1. **恭喜!** 您已成功将设备直接通过网络浏览器转换为婴儿监视器,无需下载或安装任何应用程序! - - - -有关重命名设备,从系列中删除设备或删除系列的详细信息和详细说明,请查看 [video tutorial][15] 在 gonimo.com。 +有关重命名设备,从系列中删除设备或删除系列的详细信息和详细说明,请查看 gonimo.com 的[视频教程][15]。 ### 家庭系统的灵活性 - Gonimo 的优势之一是其基于家庭的系统,它为即使在商业 Android 或 iOS 应用中也无法提供的各种情况提供了极大的灵活性。要深入了解这些功能,我们假设您创建了一个由三个设备组成的系列。 - - * **多婴儿:** 如果你想留意你在两个不同房间睡觉的两个小孩怎么办? 将设备放在每个孩子的房间,并将其设置为婴儿站。第三个设备将充当双亲站,您可以在其上连接到两个流并通过分屏查看您的幼儿。您甚至可以通过向家人提供更多设备并将其设置为婴儿站来将此用例扩展到两个以上的婴儿站。只要您的父母站连接到第一个婴儿站,请单击左上角的后退箭头返回“设备概述”屏幕。现在您可以连接到第二个(以及依次为第三个,第四个,第五个和第五个等)设备,并自动建立分屏。酷! - - - * **多亲:** 如果爸爸想在他上班的时候看孩子怎么办?只需邀请第四个设备(例如,他的办公室 PC )到家庭并将其设置为父母站。父母双方都可以通过他们自己的设备同时检查他们的孩子,甚至可以独立地选择他们希望连接的孩子。 - - - * **多户:** 单个设备也可以是几个系列的一部分。当您的婴儿站与您一起时,如平板电脑,您经常访问亲戚或朋友时,这非常有用。为“奶奶的房子”或“约翰叔叔的房子”创建另一个家庭,其中包括您的婴儿站设备与 Granny's 或 Uncle John 的设备配对。您可以随时通过婴儿站设备的 Gonimo 主屏幕在这些家庭中切换婴儿站设备。 - +Gonimo 的优势之一是其基于家庭的系统,它为即使在商业 Android 或 iOS 应用中也无法提供的各种情况提供了极大的灵活性。要深入了解这些功能,我们假设您创建了一个由三个设备组成的家庭系统。 +* 多婴儿:如果你想留意你在两个不同房间睡觉的两个小孩怎么办?在每个孩子的房间放一个设备,并将其设置为婴儿站。第三个设备将充当父母站,您可以在其上连接到两个流并通过分屏查看您的幼儿。您甚至可以通过向该家庭系统提供更多设备,并将其设置为婴儿站来将此用例扩展到两个以上的婴儿站。只要您的父母站连接到第一个婴儿站,请单击左上角的后退箭头返回“设备概述”屏幕。现在您可以连接到第二个(以及依次为第三个、第四个、第五个和第五个等)设备,并自动建立分屏。酷! +* 多父母:如果爸爸想在他上班的时候看孩子怎么办?只需邀请第四个设备(例如,他的办公室 PC )到家庭并将其设置为父母站。父母双方都可以通过他们自己的设备同时检查他们的孩子,甚至可以独立地选择他们希望连接的孩子。 +* 多家庭:单个设备也可以是几个家庭系统的一部分。当您的婴儿站与您一起时,如平板电脑,您经常访问亲戚或朋友时,这非常有用。为“奶奶的房子”或“约翰叔叔的房子”创建另一个家庭,其中包括您的婴儿站设备与奶奶或约翰叔叔的设备配对。您可以随时通过婴儿站设备的 Gonimo 主屏幕在这些家庭中切换婴儿站设备。 ### 想要参加吗? -Gonimo 团队喜欢开源。社区代码,社区代码。Gonimo 的用户对我们非常重要,但它们只是 Gonimo 故事的一部分。幕后有创意的大脑是创造出色婴儿监视器体验的关键。 +Gonimo 团队喜欢开源。代码来自社区,代码用于社区。Gonimo 的用户对我们非常重要,但它们只是 Gonimo 故事的一部分。幕后有创意的大脑是创造出色婴儿监视器体验的关键。 -目前我们特别需要那些愿意成为 iOS 11 测试者的人的帮助,因为 Apple 在 iOS 11 中对 WebRTC 的支持意味着我们最终将能够支持 iOS 设备。如果可以,请帮助我们实现这个令人敬畏的里程碑。 +目前我们特别需要那些愿意成为 iOS 11 测试者的人的帮助,因为 Apple 在 iOS 11 中对 WebRTC 的支持意味着我们最终将能够支持 iOS 设备。如果可以,请帮助我们实现这个令人赞叹的里程碑。 + +如果您了解 Haskell 或想要了解它,您可以查看 [GitHub 上我们的代码][16]。欢迎发起拉取请求、审查代码以及提出问题。 -如果您了解 Haskell 或想要了解它,您可以查看 [our code at GitHub][16]. 欢迎拉取请求,审查代码以及提出问题。 最后,请通过向新父母和开源世界宣传 Gonimo 婴儿监视器是易于使用并且便携的。 ### 关于作者 -Robert Klotzner;我是双胞胎的父亲;一个程序员。当我听到普通人可以给计算机编程时;我买了一本关于 C 的书页;开始学习;我当时十五岁。我坚持用 C ;相当长的一段时间;学习了 Java ;回归到 C + +Robert Klotzner:我是双胞胎的父亲,一个程序员。当我听到普通人可以给计算机编程时,我买了一本 1200 页的关于 C++ 的书开始学习,我当时才十五岁。我坚持用 C++ 相当长的一段时间,学习了 Java 又回归到 C++,学习了 D、Python 等等,最终学习了 Haskell。我喜欢 Haskell 是因为它丰富的类型系统,这几乎可以避免我书写错误的代码。强壮的静态类型和性能让我爱上了 C++…… -------------------------------------------------------------------------------- @@ -110,7 +89,7 @@ via: https://opensource.com/article/17/9/gonimo 作者:[Robert Klotzner][a] 译者:[lintaov587](https://github.com/lintaov587) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 61f58dc8abb349c5ea4645096bdb2355e3d309a5 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 5 Jan 2019 20:43:55 +0800 Subject: [PATCH 213/322] PUB:20170928 How to create a free baby monitoring system with Gonimo.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @lintaov587 本文首发地址: https://linux.cn/article-10417-1.html 您的 LCTT 专页: https://linux.cn/lctt/lintaov587 请注册领取LCCN: https://lctt.linux.cn/ --- ...928 How to create a free baby monitoring system with Gonimo.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20170928 How to create a free baby monitoring system with Gonimo.md (100%) diff --git a/translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md b/published/20170928 How to create a free baby monitoring system with Gonimo.md similarity index 100% rename from translated/tech/20170928 How to create a free baby monitoring system with Gonimo.md rename to published/20170928 How to create a free baby monitoring system with Gonimo.md From 9bd4f430901b6bbcc784617a73bc5a860e1f3018 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 5 Jan 2019 21:52:30 +0800 Subject: [PATCH 214/322] PRF:20181217 Working with tarballs on Linux.md @geekpi --- ...20181217 Working with tarballs on Linux.md | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/translated/tech/20181217 Working with tarballs on Linux.md b/translated/tech/20181217 Working with tarballs on Linux.md index 2b2e493625..7399f1c421 100644 --- a/translated/tech/20181217 Working with tarballs on Linux.md +++ b/translated/tech/20181217 Working with tarballs on Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Working with tarballs on Linux) @@ -9,29 +9,32 @@ 在 Linux 上使用 tarball ====== + +> Tarball 提供了一种在 Linux 系统上备份和管理一组文件的通用方法。请按照以下提示了解如何创建它们,以及从中提取和删除单个文件。 + ![](https://images.idgesg.net/images/article/2018/12/tarball-100783148-large.jpg) -“tarball” 一词通常用于描述备份一组选择的文件并将它们打包在一个文件中的一种文件格式。该名称来自 **.tar** 文件扩展名和 **tar** 命令,它用于将文件打包到一个文件中,然后压缩该文件,使其在移动到其他系统时更小。 +“tarball” (LCTT 译注:国内也常称为“tar 包”)一词通常用于描述备份一组选择的文件并将它们打包在一个文件中的一种文件格式。该名称来自 .tar 文件扩展名和 `tar` 命令,它用于将文件打包到一个文件中,有时还会压缩该文件,使其在移动到其它系统时更小。 -tarballs 通常用于备份个人或系统文件来创建存档, 特别是在进行可能需要撤消的更改之前。例如,Linux 系统管理员通常会在更改应用之前创建包含一系列配置文件的 tarball,以防必须撤消这些更改。从 tarball 中解压文件通常比在备份中搜索文件快。 +tarball 通常用于备份个人或系统文件来创建存档,特别是在进行可能需要撤消的更改之前。例如,Linux 系统管理员通常会在更改应用之前创建包含一系列配置文件的 tarball,以防必须撤消这些更改。从 tarball 中解压文件通常比在备份中搜索文件快。 ### 如何在 Linux 上创建 tarball -使用如下命令,你可以在单条命令中创建并压缩文件。 +使用如下命令,你可以在单条命令中创建 tarball 并压缩它。 ``` $ tar -cvzf PDFs.tar.gz *.pdf ``` -这里最后是一个压缩文件 (gzip),其中包含了当前目录中的所有 PDF 文件。当然,压缩是可选的。一个稍微简单的只是将 PDF 文件打包成未压缩 tarball 的命令: +其结果是一个压缩文件(gzip 压缩的),其中包含了当前目录中的所有 PDF 文件。当然,压缩是可选的。一个稍微简单的只是将 PDF 文件打包成未压缩 tarball 的命令: ``` $ tar -cvf PDFs.tar *.pdf ``` -注意,选项中的 **z** 将文件变成压缩的。 **c** 表明正在创建文件,**v** (详细)表示你在命令运行时需要一些反馈。如果你不想查看列出的文件,请忽略 **v**。 +注意,选项中的 `z` 将文件变成压缩的。 `c` 表明创建文件,`v`(详细)表示你在命令运行时需要一些反馈。如果你不想查看列出的文件,请忽略 `v`。 -另一个常见的命名约定是给压缩的 tarball 命名成 **.tgz** 而不是双扩展名 **.tar.gz**,如下所示: +另一个常见的命名约定是给压缩的 tarball 命名成 .tgz 而不是双扩展名 .tar.gz,如下所示: ``` $ tar cvzf MyPDFs.tgz *.pdf @@ -60,7 +63,7 @@ ls -l ShenTix.pdf -rw-rw-r-- 1 shs shs 122057 Dec 14 14:43 ShenTix.pdf ``` -如果未压缩 tarball,你甚至可以从 tarball 中删除文件。例如,如果我们想从 PDFs.tar.gz 中删除我们上面解压的文件,我们会这样做: +如果未压缩 tarball,你甚至可以从 tarball 中删除文件。例如,如果我们想从 PDFs.tar.gz 中删除我们上面解压过的文件,我们会这样做: ``` $ gunzip PDFs.tar.gz @@ -71,7 +74,7 @@ $ ls -l PDFs.tar -rw-rw-r-- 1 shs shs 10577920 Dec 15 11:45 PDFs.tar ``` -请注意,我们在删除 ShenTix.pdf 后,缩小了一点 tar 文件占用的空间。如果我们想要,我们可以再次压缩文件: +请注意,我们在删除 ShenTix.pdf 后,缩小了一点 tarball 文件占用的空间。如果我们想要,我们可以再次压缩文件: ``` $ gzip -f PDFs.tar @@ -81,8 +84,6 @@ ls -l PDFs.tar.gz 丰富的命令行选项使得 tarball 使用起来简单方便。 -在 [Facebook][1] 和 [LinkedIn][2] 中加入 Network World 社区来评论主题。 - -------------------------------------------------------------------------------- via: https://www.networkworld.com/article/3328840/linux/working-with-tarballs-on-linux.html @@ -90,11 +91,11 @@ via: https://www.networkworld.com/article/3328840/linux/working-with-tarballs-on 作者:[Sandra Henry-Stocker][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ [b]: https://github.com/lujun9972 [1]: https://www.facebook.com/NetworkWorld/ -[2]: https://www.linkedin.com/company/network-world \ No newline at end of file +[2]: https://www.linkedin.com/company/network-world From e8203ef0b7916a94fda988aaf79d94bb27699021 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 5 Jan 2019 21:53:15 +0800 Subject: [PATCH 215/322] PUB:20181217 Working with tarballs on Linux.md @geekpi https://linux.cn/article-10418-1.html --- .../20181217 Working with tarballs on Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181217 Working with tarballs on Linux.md (98%) diff --git a/translated/tech/20181217 Working with tarballs on Linux.md b/published/20181217 Working with tarballs on Linux.md similarity index 98% rename from translated/tech/20181217 Working with tarballs on Linux.md rename to published/20181217 Working with tarballs on Linux.md index 7399f1c421..0d6e827bb4 100644 --- a/translated/tech/20181217 Working with tarballs on Linux.md +++ b/published/20181217 Working with tarballs on Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10418-1.html) [#]: subject: (Working with tarballs on Linux) [#]: via: (https://www.networkworld.com/article/3328840/linux/working-with-tarballs-on-linux.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) From ba492475852a013844adef36bd26b07216a1eb82 Mon Sep 17 00:00:00 2001 From: zgj Date: Sat, 5 Jan 2019 23:33:41 +0800 Subject: [PATCH 216/322] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E5=88=9D=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 觉得翻译有点不够流畅 --- .../20180731 How to be the lazy sysadmin.md | 106 +++++++++++++++++- 1 file changed, 103 insertions(+), 3 deletions(-) rename {sources => translated}/talk/20180731 How to be the lazy sysadmin.md (51%) diff --git a/sources/talk/20180731 How to be the lazy sysadmin.md b/translated/talk/20180731 How to be the lazy sysadmin.md similarity index 51% rename from sources/talk/20180731 How to be the lazy sysadmin.md rename to translated/talk/20180731 How to be the lazy sysadmin.md index 52491e397c..7a5860ed7c 100644 --- a/sources/talk/20180731 How to be the lazy sysadmin.md +++ b/translated/talk/20180731 How to be the lazy sysadmin.md @@ -1,4 +1,3 @@ -zgj1024 is translating How to be the lazy sysadmin ====== ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cat-yawn-vm.png?itok=0c_zy6aQ) @@ -93,13 +92,114 @@ It is actually quite a lot of work being the Lazy SysAdmin. But we work smart, r There are many other ways to be the Lazy SysAdmin besides the few described here. I'm sure you have some of your own; please share them with the rest of us in the comments. + + +如何成为一名懒惰的系统管理员 +--- + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cat-yawn-vm.png?itok=0c_zy6aQ) + +Linux 的系统管理员的工作总是复杂的,并且总是伴随这各种陷阱和障碍。从没有足够时间做任何事情,当你想完成那个半秃头老板(PHB)给的任务的时候,他(只会)不停在你的后面.盯着,而最核心的服务器总是在最不合时宜的时间点崩溃,问题和挑战比比皆是。 + +(译者注:半秃头老板 [PHB](https://en.wikipedia.org/wiki/Pointy-haired_Boss),译者:那是[呆伯特漫画](https://zh.wikipedia.org/wiki/%E5%91%86%E4%BC%AF%E7%89%B9)中的角色,缺乏一般知识常识及其职位所应具有的管理能力,爱说大话且富有向物理显示挑战的精神,大概长成这样) + +![](https://cdn-images-1.medium.com/max/1600/1*qu5upg6tgVSXx4KqL-4gZw.jpeg) + +我在即将出版的新书 《 The Linux Philosophy for SysAdmins 》(译者注:暂叫《系统管理员的 Liunx 哲学》 ) 中更详细地讨论如何成为一个懒惰的系统管理员,那书预计会在9月出版。这本的部分内容摘录自该书,特别是第九章,「成为一名懒惰的系统管理员」。在我们讨论如何做到这点前,让我们简单了解一下成为一个名懒惰的系统管理员意味着什么。 + +### 真实生产力vs.虚假生产力 +#### 虚假生产力 + +在我工作的地方,半秃头老板相信的管理风格叫「走动式管理」( management by walking around )。假设某人不在他的键盘上输入东西,或者至少检查他们显示的东西,判断他们的工作是否有效率的。这是一个糟糕的工作场所。它的各部门间有道很高的行政墙,这会造就了许多小型沟通壁垒,大量无用的文书工作,以及获得任何事情的许可都要等待漫长的时间。因为这些或者其他原因,不可能高效地做任何事情 ——如果真的是这样——所以我们是非常低效。为了看起来很忙,我们都有自己的一套 Look Busy 工具包( Look Busy Kits, LBKs ),可能是一些短小的、用来显示一些行为行为活动的 Bash 脚本,或者是 `top`,`htop`,`iotop` 之类的程序,或者是一些持续显示某些行为活动的监控工具。这个工作场所的风气让人不可能真正高效, 我讨厌这个地方, 也讨厌那个几乎不可能完成任何有价值的事情的事实。 + +这糟糕场所对真实的系统管理员来讲是场噩梦。我们中没有人会感到快乐。(在那里)花费四五月才能完成的事,在其他地方只需的一个早晨。我们没有什么实际工作要做,却要花大量的时间干活来(让自己)看起来很忙。我们有一个无言竞赛,创造最好的 LBK( Look Busy Kits) ,这就是我们花费最多时间的地方了。那份工作我只做了几个月,但好像已经过完一生。如果你看到的这个监狱的表面,你可能会说我们是很懒,因为我们只完成了几乎为 0 的实际工作。 + +这是个极端的例子,它完全与我所说的“我是一个懒惰的系统管理员”的意思相反,做一个懒惰的系统管理是件好事。 + +#### 真实生产力 + +我很幸运,曾为一些真正的经理工作——他们明白,系统管理员的生产力并不是以每天花多少小时敲键盘来衡量。毕竟,即使一只猴子能敲击他们的键盘,但也不能说明结果的价值。 + +正如我书中所言 + +> 「我是一个懒惰的系统管理员,同时我也是一个高效的系统管理员。这两者看似矛盾的说法不是相互排斥的,而是会以一种非常积极的方式相辅相成。。。 +> +> 「一个系统管理员在思考的时候是最高效的——思考关于如何解决现有问题和避免未来的问题;思考怎样监控 Linux 计算机,以便找到预测和预示这些未来的问题的线索;思考如何让他们的工作更有效率;思考如何自动化所有这些要执行的任务, 无论是每天还是每年一次的任务。 +> +> 「系统管理员冥思苦想的那一面是不会被非系统管理员所熟知的,那些人包括很多掌管着系统管理员的人,比如那个半秃头老板。系统管理员都会以不同的方式解决他们工作中苦思的部分。一些我认识的系统管理员会在沙滩、骑自行车、参加马拉松或者攀岩时找到最好的想法。另一些人会认为静坐或听音乐的时候思考得最好。还有一些会在阅读小说、学习不相关的学科、甚至在学习 Linux 系统的时候会想得最好。关键是我们都有不同的方式激发我们的创造力,而这些创造力的推进器中很多并不涉及键盘上的一个按键。我们真正的生产力对于系统管理员周围的人来说可能是完全看不见的。」 + +成为懒惰的系统管理员有一些简单的秘诀——系统管理员要完成一切需要完成的事,而且更多的是,当所有人都处于恐慌的状态时要保持冷静和镇定。(秘诀的)一部分是高效工作,另一部分是把预防问题放在首位。 + +### 成为懒惰系统管理员的方法 + +#### 多思考 + +我相信关于懒惰系统管理员最重要的秘诀在于思考。正如上面的摘录所言,优秀的系统管理员会花大量的时候思考这些事情,如何更有效率地工作,在异常成为问题前如何定位,更聪明地工作,做其他所有东西的同时会考虑如何完成这些的事等等。 + +例如,现在——除了撰写本文之外——我正在想一个项目,我打算在新部件从亚马逊和本地计算机商店到达时才开始。 我不那么重要的计算机上的主板坏了,最近它的崩溃更频率。 但我旧的和最小的服务器——处理我的电子邮件和外部网站,以及为我的网络的其余部分提供 DHCP 和 DNS 服务——并没有出现故障,但必须处理由于各种外部攻击而导致的间歇性过载。 + +我一开始想,我只要替换故障单元中的主板及其直接部件——内存、CPU,可能还有电源。但是在考虑了一段时间之后,我决定将新部件放到服务器中,并将旧的(但仍然可用的)部件从服务器移到故障系统中。可以这样做的,只需一、两个小时就可以从服务器上移除旧部件并安装新的。然后我就可以花时间更换出故障的电脑里的部件了。太好了。所以我开始在脑海中列出要完成的任务。 + +然而,当我查看列表时,我意识到服务器中唯一不能替换的部件是机箱和硬盘驱动器,这两台计算机的机箱几乎完全相同。在有了这个小小的发现之后,我开始考虑用新的部件替换出故障的计算机的部件,并将之作为我的服务器。经过一些测试之后,我只需从当前的服务器移除硬盘,并将它安装到新的组件中,改下网络配置项,再更改 KVM 交换机端口上的主机名,并更改主机名标签,就可以了。这将大大减少服务器停机时间,大大减少我的压力。此外,如果出现故障,我可以简单地将硬盘移回原来的服务器,直到我可以用新服务器解决问题为止。 + +所以,现在我在脑海中已经创建了一个我需要做的任务清单,以完成这项工作。而且——我希望你能仔细观察——当我脑子里想着这一切的时候,我的手指从来没有碰过键盘。我新的心理行动计划风险很低,与我最初的计划相比,涉及的服务器停机时间要少得多。 + +当我在 IBM 工作的时候,我经常看到很多语言中都有写着“思考”的标语。思考可以节省时间和压力,是懒散的系统管理员的主要标志。 + +#### 做预防性维护 + +在 1970 年代中期,我被 IBM 聘为客户工程师,我的领地由相当多的穿孔卡片设备组成。这也就是说,它们是处理打孔卡的重型机械设备—— 一些可以追溯到20世纪30年代。因为这些机器主要是机械的,所以它们的部件经常磨损或失调。我的部分工作是在他们损坏时修复这些他们。我工作的主要部分——最重要的部分 ——首先要防止它们。预防性维护的目的是在磨损部件损坏之前进行更换,并对还在运行的部件进行润滑和调整,以确保它们工作正常。 + + +正如我在《系统管理员的 Linux哲学》( The Linux Philosophy for SysAdmins)中所言: + +>「我在 IBM 的经理们明白这只是冰山一角;他们——和我——都是我的工作是让顾客满意。虽然这通常意味着修复损坏的硬件,但也意味着减少硬件损坏的次数。这对客户来说是好事,因为他们的机器在工作时工作效率更高。这对我有好处,因为我从那些快乐的客户那里接到的电话要少得多。我也睡了更多的觉,因为这样做的结果是更少的非工作时间的紧急电话。我是个懒惰的(客户工程师)。通过提前做额外的工作,从长远来看,我需要做的工作要少得多。 +> +>「这一原则已成为系统管理员的 Linux 哲学的功能原则之一。作为系统管理员,我们的时间最好用在最大限度地减少未来工作量的任务上。」 + +在 Linux 计算机中查找要解决的问题相当于项目管理。我检查系统日志,寻找以后可能会变得非常危险的问题的暗示。如果出现了一些小问题,或者我注意到我的工作站、服务器没有做出该有的响应,或者如果日志显示了一些不寻常的东西——所有这些都可以暗示出潜在的问题,而对于用户或半秃头老板来说,这些问题并没有产生明显的症状。 + +我经常检查 `/var/log/` 中的文件,特别是 messages 和 security 文件。我最常见的问题之一是许多脚本小子在我的防火墙系统上尝试各种类型的攻击。而且,不,我不依赖 ISP(Internet Service Provider,网络服务提供者)提供的调制解调器/路由器中的所谓的防火墙。这些日志包含了大量关于企图攻击来源的信息,非常有价值。但是要扫描不同主机上的日志并将解决方案部署到位,需要做大量的工作。所以我转向自动化。 + +#### 自动化 + +我发现我的工作有很大一部分可以通过某种形式的自动化来完成。系统管理员的 Linux 哲学的原则之一是 「自动化一切」,这包括每天扫描日志文件等枯燥乏味的任务。 + +像是 [Logwatch][3] 这类的程序能够监控你的日志文件中的异常条目,并在异常条目发生时通知您。Logwatch通常作为 cron jobs(译者注,Linux/Unix 中周期作业程序)每天运行一次,并向本地主机上的 root 用户发送电子邮件。你可以从命令行运行 Logwatch,并立即在显示器上查看结果。现在我只需要每天查看 Logwatch 的电子邮件通知。 + +但现实是,仅仅收到通知是不够的,因为我们不能坐以待毙。有时需要立即作出反应。我喜欢的另一个程序是——它能为我做所有事——(让大家看到,这就是懒惰的管理员)——它就是[Fail2ban][4]。Fail2Ban 会扫描指定的日志文件,查找各种类型的黑客攻击和入侵尝试,如果它发现某个 IP 地址在做特定类型的持续活动够了,它会向防火墙添加一个条目,在指定的时间内阻止来自该 IP 地址的任何进一步的黑客尝试。默认值通常在 10 分钟左右,但我喜欢为大多数类型的攻击指定为 12 或 24 小时。每种类型的黑客攻击都是单独配置的,例如尝试通过 SSH 登录和那些 Web 服务器的攻击。 + +#### 写脚本 + +自动化是哲学的关键组成部分之一。一切可以自动化的东西都应该自动化的,其余的尽可能地自动化。所以,我也写了很多脚本来解决问题,也就说说我编写脚本来完成我的大部分工作。 + +我的脚本帮我节省了大量时间,因为它们包含执行特定任务的命令,这大大减少了我需要输入的数量。例如,我经常重新启动我的电子邮件服务器和垃圾邮件处理软件(当修改 SpamAssassin 的 `local.cf` 配置文件时,就需要重启)。必须按特定顺序停止并重新启动这些服务。因此,我用几个命令编写了一个简短的脚本,并将其存储在可访问的 `/usr/local/bin` 中。现在,不用键入几个命令并等待每个命令都完成,然后再键入下一个命令——更用记住正确的命令顺序和每个命令的正确语法——我输入一个三个字符的命令,其余的留给我的脚本来完成。 + +#### 简化键入 + +另一种成为懒惰的系统管理员的方法是减少我们需要键入的数量。而且,我的打字技巧真的很糟糕(也就是说,我一点也没有——顶多是几个笨拙的手指)。导致错误的一个可能原因是我的打字不好,所以我会尽量少打字。 + +绝大多数 GNU 和 Linux 核心实用程序都有非常短的名称。然而,它们都是有意义的名字。诸如用于更改目录的 `cd` 、用于列出(目录内容)的 `ls` 和用于磁盘转储的 `dd` 等工具都非常明显。短名字意味着更少的打字和更少的产生错误机会。我认为短的名字通常更容易记住。 + +当我编写 shell 脚本时,我喜欢保持名称简短而意义(至少对我来说是),比如用于 rsync 备份的 `rsbu`(译者注,Rsync Backup 的简写)。在某些情况下,我喜欢使用更长的名称,比如 `doUpdates` 来执行系统更新。在后一种情况下,长一点名让脚本的目的就越明显。这可以节省时间,因为很容易记住脚本的名称。 + +其他减少键入的方法包括命令行别名(alias)、命令行调回(recall)和编辑。别名只是你在 Bash shell 键入命令时才做的替换。键入 `alias` 命令会看到默认配置的别名列表。例如,当你输入命令 `ls` 时,会被条目 `alias ls='ls –color=auto'` 替成较长的命令,因此你只需键入 2 个字符而不是 14 个字符即可获得带有颜色的列表。还可以使用 `alias` 命令添加你自己(定义)的别名。 + +命令行调回允许你使用键盘的向上和向下箭头键滚动浏览命令历史记录。如果需要再次使用相同的命令,只需在找到所需的命令时按 Enter 键即可。如果在找到命令后需要更改该命令,则可以使用标准命令行编辑功能进行更改。 + +### 结束语 + +一名懒惰的系统管理员实际上也有很多的工作。但我们是聪明地工作,而不是刻苦工作。早在一堆小问题汇聚成大问题之前, 我们就花时间探索我们负责的主机,并处理好所有的小问题。我们花了很多时间思考解决问题的最佳方法, 我们也花了很多时间来发现新的方法, 让自己更聪明地工作, 成为懒惰的系统管理员。 + +除了这里描述的少数方法外, 还有许多其他的方式可以成为懒惰的系统管理员。我相信你也有一些自己的方式;请在评论中和我们分享。 + -------------------------------------------------------------------------------- via: https://opensource.com/article/18/7/how-be-lazy-sysadmin 作者:[David Both][a] 选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) +译者:[zgj1024](https://github.com/zgj1024) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -108,4 +208,4 @@ via: https://opensource.com/article/18/7/how-be-lazy-sysadmin [1]:https://www.apress.com/us/book/9781484237298 [2]:https://en.wikipedia.org/wiki/Unit_record_equipment [3]:https://www.techrepublic.com/article/how-to-install-and-use-logwatch-on-linux/ -[4]:https://www.fail2ban.org/wiki/index.php/Main_Page +[4]:https://www.fail2ban.org/wiki/index.php/Main_Page \ No newline at end of file From 01e78f002326232fd5874c1ea060cfbc350415cd Mon Sep 17 00:00:00 2001 From: LuMing <784315443@qq.com> Date: Sun, 6 Jan 2019 10:32:36 +0800 Subject: [PATCH 217/322] translating --- .../20180503 11 Methods To Find System-Server Uptime In Linux.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180503 11 Methods To Find System-Server Uptime In Linux.md b/sources/tech/20180503 11 Methods To Find System-Server Uptime In Linux.md index 7a30127b07..a2060fb130 100644 --- a/sources/tech/20180503 11 Methods To Find System-Server Uptime In Linux.md +++ b/sources/tech/20180503 11 Methods To Find System-Server Uptime In Linux.md @@ -1,3 +1,4 @@ +LuMing is translating 11 Methods To Find System/Server Uptime In Linux ====== Do you want to know, how long your Linux system has been running without downtime? when the system is up and what date. From bb32cf26d2473665a1adf2e750219b6e2eec0df0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 6 Jan 2019 17:38:31 +0800 Subject: [PATCH 218/322] PRF:20180731 How to be the lazy sysadmin.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @zgj1024 恭喜你完成了第一篇翻译。 --- .../20180731 How to be the lazy sysadmin.md | 181 +++++------------- 1 file changed, 44 insertions(+), 137 deletions(-) diff --git a/translated/talk/20180731 How to be the lazy sysadmin.md b/translated/talk/20180731 How to be the lazy sysadmin.md index 7a5860ed7c..5f1c5b7da5 100644 --- a/translated/talk/20180731 How to be the lazy sysadmin.md +++ b/translated/talk/20180731 How to be the lazy sysadmin.md @@ -1,197 +1,104 @@ -How to be the lazy sysadmin -====== -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cat-yawn-vm.png?itok=0c_zy6aQ) - -The job of a Linux SysAdmin is always complex and often fraught with various pitfalls and obstacles. Ranging from never having enough time to do everything, to having the Pointy-Haired Boss (PHB) staring over your shoulder while you try to work on the task that she or he just gave you, to having the most critical server in your care crash at the most inopportune time, problems and challenges abound. I have found that becoming the Lazy Sysadmin can help. - -I discuss how to be a lazy SysAdmin in detail in my forthcoming book, [The Linux Philosophy for SysAdmins][1], (Apress), which is scheduled to be available in September. Parts of this article are taken from that book, especially Chapter 9, "Be a Lazy SysAdmin." Let's take a brief look at what it means to be a Lazy SysAdmin before we discuss how to do it. - -### Real vs. fake productivity - -#### Fake productivity - -At one place I worked, the PHB believed in the management style called "management by walking around," the supposition being that anyone who wasn't typing something on their keyboard, or at least examining something on their display, was not being productive. This was a horrible place to work. It had high administrative walls between departments that created many, tiny silos, a heavy overburden of useless paperwork, and excruciatingly long wait times to obtain permission to do anything. For these and other reasons, it was impossible to do anything efficiently—if at all—so we were incredibly non-productive. To look busy, we all had our Look Busy Kits (LBKs), which were just short Bash scripts that showed some activity, or programs like `top`, `htop`, `iotop`, or any monitoring tool that constantly displayed some activity. The ethos of this place made it impossible to be truly productive, and I hated both the place and the fact that it was nearly impossible to accomplish anything worthwhile. - -That horrible place was a nightmare for real SysAdmins. None of us was happy. It took four or five months to accomplish what took only a single morning in other places. We had little real work to do but spent a huge amount of time working to look busy. We had an unspoken contest going to create the best LBK, and that is where we spent most of our time. I only managed to last a few months at that job, but it seemed like a lifetime. If you looked only at the surface of that dungeon, you could say we were lazy because we accomplished almost zero real work. - -This is an extreme example, and it is totally the opposite of what I mean when I say I am a Lazy SysAdmin and being a Lazy SysAdmin is a good thing. - -#### Real productivity - -I am fortunate to have worked for some true managers—they were people who understood that the productivity of a SysAdmin is not measured by how many hours per day are spent banging on a keyboard. After all, even a monkey can bang on a keyboard, but that is no indication of the value of the results. - -As I say in my book: - -> "I am a lazy SysAdmin and yet I am also a very productive SysAdmin. Those two seemingly contradictory statements are not mutually exclusive, rather they are complementary in a very positive way. … -> -> "A SysAdmin is most productive when thinking—thinking about how to solve existing problems and about how to avoid future problems; thinking about how to monitor Linux computers in order to find clues that anticipate and foreshadow those future problems; thinking about how to make their work more efficient; thinking about how to automate all of those tasks that need to be performed whether every day or once a year. -> -> "This contemplative aspect of the SysAdmin job is not well known or understood by those who are not SysAdmins—including many of those who manage the SysAdmins, the Pointy Haired Bosses. SysAdmins all approach the contemplative parts of their job in different ways. Some of the SysAdmins I have known found their best ideas at the beach, cycling, participating in marathons, or climbing rock walls. Others think best when sitting quietly or listening to music. Still others think best while reading fiction, studying unrelated disciplines, or even while learning more about Linux. The point is that we all stimulate our creativity in different ways, and many of those creativity boosters do not involve typing a single keystroke on a keyboard. Our true productivity may be completely invisible to those around the SysAdmin." - -There are some simple secrets to being the Lazy SysAdmin—the SysAdmin who accomplishes everything that needs to be done and more, all the while keeping calm and collected while others are running around in a state of panic. Part of this is working efficiently, and part is about preventing problems in the first place. - -### Ways to be the Lazy SysAdmin - -#### Thinking - -I believe the most important secret about being the Lazy SysAdmin is thinking. As in the excerpt above, great SysAdmins spend a significant amount of time thinking about things we can do to work more efficiently, locate anomalies before they become problems, and work smarter, all while considering how to accomplish all of those things and more. - -For example, right now—in addition to writing this article—I am thinking about a project I intend to start as soon as the new parts arrive from Amazon and the local computer store. The motherboard on one of my less critical computers is going bad, and it has been crashing more frequently recently. But my very old and minimal server—the one that handles my email and external websites, as well as providing DHCP and DNS services for the rest of my network—isn't failing but has to deal with intermittent overloads due to external attacks of various types. - -I started by thinking I would just replace the motherboard and its direct components—memory, CPU, and possibly the power supply—in the failing unit. But after thinking about it for a while, I decided I should put the new components into the server and move the old (but still serviceable) ones from the server into the failing system. This would work and take only an hour, or perhaps two, to remove the old components from the server and install the new ones. Then I could take my time replacing the components in the failing computer. Great. So I started generating a mental list of tasks to do to accomplish this. - -However, as I worked the list, I realized that about the only components of the server I wouldn't replace were the case and the hard drive, and the two computers' cases are almost identical. After having this little revelation, I started thinking about replacing the failing computer's components with the new ones and making it my server. Then, after some testing, I would just need to remove the hard drive from my current server and install it in the case with all the new components, change a couple of network configuration items, change the hostname on the KVM switch port, and change the hostname labels on the case, and it should be good to go. This will produce far less server downtime and significantly less stress for me. Also, if something fails, I can simply move the hard drive back to the original server until I can fix the problem with the new one. - -So now I have created a mental list of the tasks I need to do to accomplish this. And—I hope you were watching closely—my fingers never once touched the keyboard while I was working all of this out in my head. My new mental action plan is low risk and involves a much smaller amount of server downtime compared to my original plan. - -When I worked for IBM, I used to see signs all over that said "THINK" in many languages. Thinking can save time and stress and is the main hallmark of a Lazy SysAdmin. - -#### Doing preventative maintenance - -In the mid-1970s, I was hired as a customer engineer at IBM, and my territory consisted of a fairly large number of [unit record machines][2]. That just means that they were heavily mechanical devices that processed punched cards—a few dated from the 1930s. Because these machines were primarily mechanical, their parts often wore out or became maladjusted. Part of my job was to fix them when they broke. The main part of my job—the most important part—was to prevent them from breaking in the first place. The preventative maintenance was intended to replace worn parts before they broke and to lubricate and adjust the moving components to ensure that they were working properly. - -As I say in The Linux Philosophy for SysAdmins: - -> "My managers at IBM understood that was only the tip of the iceberg; they—and I—knew my job was customer satisfaction. Although that usually meant fixing broken hardware, it also meant reducing the number of times the hardware broke. That was good for the customer because they were more productive when their machines were working. It was good for me because I received far fewer calls from those happier customers. I also got to sleep more due to the resultant fewer emergency off-hours callouts. I was being the Lazy [Customer Engineer]. By doing the extra work upfront, I had to do far less work in the long run. -> -> "This same tenet has become one of the functional tenets of the Linux Philosophy for SysAdmins. As SysAdmins, our time is best spent doing those tasks that minimize future workloads." - -Looking for problems to fix in a Linux computer is the equivalent of project management. I review the system logs looking for hints of problems that might become critical later. If something appears to be a little amiss, or I notice my workstation or a server is not responding as it should, or if the logs show something unusual—all of these can be indicative of an underlying problem that has not generated symptoms obvious to users or the PHB. - -I do frequent checks of the files in `/var/log/`, especially messages and security. One of my more common problems is the many script kiddies who try various types of attacks on my firewall system. And, no, I do not rely on the alleged firewall in the modem/router provided by my ISP. These logs contain a lot of information about the source of the attempted attack and can be very valuable. But it takes a lot of work to scan the logs on various hosts and put solutions into place. So I turn to automation. - -#### Automating - -I have found that a very large percentage of my work can be performed by some form of automation. One of the tenets of the Linux Philosophy for SysAdmins is "automate everything," and this includes boring, drudge tasks like scanning logfiles every day. - -Programs like [Logwatch][3] can monitor your logfiles for anomalous entries and notify you when they occur. Logwatch usually runs as a cron job once a day and sends an email to root on the localhost. You can run Logwatch from the command line and view the results immediately on your display. Now I just need to look at the Logwatch email notification every day. - -But the reality is just getting a notification is not enough, because we can't sit and watch for problems all the time. Sometimes an immediate response is required. Another program I like, one that does all of the work for me—see, this is the real Lazy Admin—is [Fail2Ban][4]. Fail2Ban scans designated logfiles for various types of hacking and intrusion attempts, and if it sees enough sustained activity of a specific type from a particular IP address, it adds an entry to the firewall that blocks any further hacking attempts from that IP address for a specified time. The defaults tend to be around 10 minutes, but I like to specify 12 or 24 hours for most types of attacks. Each type of hacking attack is configured separately, such as those trying to log in via SSH and those attacking a web server. - -#### Writing scripts - -Automation is one of the key components of the Philosophy. Everything that can be automated should be, and the rest should be automated as much as possible. So, I also write a lot of scripts to solve problems, which also means I write scripts to do most of my work for me. - -My scripts save me huge amounts of time because they contain the commands to perform specific tasks, which significantly reduces the amount of typing I need to do. For example, I frequently restart my email server and my spam-fighting software (which needs restarted when configuration changes are made to SpamAssassin's `local.cf` file). Those services must be stopped and restarted in a specific order. So, I wrote a short script with a few commands and stored it in `/usr/local/bin`, where it is accessible. Now, instead of typing several commands and waiting for each to finish before typing the next one—not to mention remembering the correct sequence of commands and the proper syntax of each—I type in a three-character command and leave the rest to my script. - -#### Reducing typing - -Another way to be the Lazy SysAdmin is to reduce the amount of typing we need to do. Besides, my typing skills are really horrible (that is to say I have none—a few clumsy fingers at best). One possible cause for errors is my poor typing, so I try to keep typing to a minimum. - -The vast majority of GNU and Linux core utilities have very short names. They are, however, names that have some meaning. Tools like `cd` for change directory, `ls` for list (the contents of a directory), and `dd` for disk dump are pretty obvious. Short names mean less typing and fewer opportunities for errors to creep in. I think the short names are usually easier to remember. - -When I write shell scripts, I like to keep the names short but meaningful (to me at least) like `rsbu` for Rsync BackUp. In some cases, I like the names a bit longer, such as `doUpdates` to perform system updates. In the latter case, the longer name makes the script's purpose obvious. This saves time because it's easy to remember the script's name. - -Other methods to reduce typing are command line aliases and command line recall and editing. Aliases are simply substitutions that are made by the Bash shell when you type a command. Type the `alias` command and look at the list of aliases that are configured by default. For example, when you enter the command `ls`, the entry `alias ls='ls –color=auto'` substitutes the longer command, so you only need to type two characters instead of 14 to get a listing with colors. You can also use the `alias` command to add your own aliases. - -Command line recall allows you to use the keyboard's Up and Down arrow keys to scroll through your command history. If you need to use the same command again, you can just press the Enter key when you find the one you need. If you need to change the command once you have found it, you can use standard command line editing features to make the changes. - -### Parting thoughts - -It is actually quite a lot of work being the Lazy SysAdmin. But we work smart, rather than working hard. We spend time exploring the hosts we are responsible for and dealing with any little problems long before they become large problems. We spend a lot of time thinking about the best ways to resolve problems, and we think a lot about discovering new ways to work smarter at being the Lazy SysAdmin. - -There are many other ways to be the Lazy SysAdmin besides the few described here. I'm sure you have some of your own; please share them with the rest of us in the comments. - - - 如何成为一名懒惰的系统管理员 ---- +====== +> 我们是聪明地工作,而不是刻苦工作,但仍把你的工作做好。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cat-yawn-vm.png?itok=0c_zy6aQ) -Linux 的系统管理员的工作总是复杂的,并且总是伴随这各种陷阱和障碍。从没有足够时间做任何事情,当你想完成那个半秃头老板(PHB)给的任务的时候,他(只会)不停在你的后面.盯着,而最核心的服务器总是在最不合时宜的时间点崩溃,问题和挑战比比皆是。 +Linux 的系统管理员的工作总是复杂的,并且总是伴随着各种陷阱和障碍。做每件事都没有足够时间,当你想完成那个半秃头老板(PHB)给的任务时,他(只会)不停在你的后面盯着,而最核心的服务器总是在最不合时宜的时间点崩溃,问题和挑战比比皆是。而我发现,成为一名懒惰的系统管理员Lazy SysAdmin可以解决这一困境。 -(译者注:半秃头老板 [PHB](https://en.wikipedia.org/wiki/Pointy-haired_Boss),译者:那是[呆伯特漫画](https://zh.wikipedia.org/wiki/%E5%91%86%E4%BC%AF%E7%89%B9)中的角色,缺乏一般知识常识及其职位所应具有的管理能力,爱说大话且富有向物理显示挑战的精神,大概长成这样) +(LCTT 译注:[半秃头老板](https://en.wikipedia.org/wiki/Pointy-haired_Boss)Pointy-Haired Boss(PHB),那是[呆伯特漫画](https://zh.wikipedia.org/wiki/%E5%91%86%E4%BC%AF%E7%89%B9)中的角色,缺乏一般知识常识及其职位所应具有的管理能力,爱说大话且富有向物理显示挑战的精神,大概长成下图这样。) ![](https://cdn-images-1.medium.com/max/1600/1*qu5upg6tgVSXx4KqL-4gZw.jpeg) -我在即将出版的新书 《 The Linux Philosophy for SysAdmins 》(译者注:暂叫《系统管理员的 Liunx 哲学》 ) 中更详细地讨论如何成为一个懒惰的系统管理员,那书预计会在9月出版。这本的部分内容摘录自该书,特别是第九章,「成为一名懒惰的系统管理员」。在我们讨论如何做到这点前,让我们简单了解一下成为一个名懒惰的系统管理员意味着什么。 +我在即将在 Apress 出版的新书 《The Linux Philosophy for SysAdmins》(LCTT 译注:暂译《系统管理员的 Linux 哲学》)中更详细地讨论如何成为一个懒惰的系统管理员,那书预计会在 9 月出版(LCTT 译注:已于 2018 年 8 月出版)。这本的部分内容摘录自该书,特别是第九章,“成为一名懒惰的系统管理员”。在我们讨论如何做到这点前,让我们简单了解一下成为一个名懒惰的系统管理员意味着什么。 + +![](https://images-na.ssl-images-amazon.com/images/I/41YOHTGClbL._SX348_BO1,204,203,200_.jpg) + +### 真实生产力 vs. 虚假生产力 -### 真实生产力vs.虚假生产力 #### 虚假生产力 -在我工作的地方,半秃头老板相信的管理风格叫「走动式管理」( management by walking around )。假设某人不在他的键盘上输入东西,或者至少检查他们显示的东西,判断他们的工作是否有效率的。这是一个糟糕的工作场所。它的各部门间有道很高的行政墙,这会造就了许多小型沟通壁垒,大量无用的文书工作,以及获得任何事情的许可都要等待漫长的时间。因为这些或者其他原因,不可能高效地做任何事情 ——如果真的是这样——所以我们是非常低效。为了看起来很忙,我们都有自己的一套 Look Busy 工具包( Look Busy Kits, LBKs ),可能是一些短小的、用来显示一些行为行为活动的 Bash 脚本,或者是 `top`,`htop`,`iotop` 之类的程序,或者是一些持续显示某些行为活动的监控工具。这个工作场所的风气让人不可能真正高效, 我讨厌这个地方, 也讨厌那个几乎不可能完成任何有价值的事情的事实。 +在我工作的地方,半秃头老板相信的管理风格叫“走动式管理management by walking around”。通过判断某人在不在他的键盘上输入东西,或者至少要看看他们显示器上显示的东西,来判断他们的工作是否有效率。这是一个糟糕的工作场所。各部门间有道很高的行政墙,这会造就了许多的、微小的沟通壁垒,大量无用的文书工作,以及获得任何事情的许可都要等待漫长的时间。因为这样、那样的原因,不可能高效地做任何事情,如果真的是这样,那是非常低效。为了看起来很忙,我们都有自己的一套“看起来很忙”的工具包Look Busy Kits(LBK),可能是一些短小的、用来显示一些行为活动的 Bash 脚本,或者是 `top`、`htop`、`iotop` 之类的程序,或者是一些持续显示某些行为活动的监控工具。这种工作场所的风气让人不可能真正高效,我讨厌这种地方,也讨厌那个几乎不可能完成任何有价值的事情的事实。 -这糟糕场所对真实的系统管理员来讲是场噩梦。我们中没有人会感到快乐。(在那里)花费四五月才能完成的事,在其他地方只需的一个早晨。我们没有什么实际工作要做,却要花大量的时间干活来(让自己)看起来很忙。我们有一个无言竞赛,创造最好的 LBK( Look Busy Kits) ,这就是我们花费最多时间的地方了。那份工作我只做了几个月,但好像已经过完一生。如果你看到的这个监狱的表面,你可能会说我们是很懒,因为我们只完成了几乎为 0 的实际工作。 +这种糟糕场所对真实的系统管理员来讲是场噩梦。没有人会感到快乐。在那里花费四五个月才能完成的事,在其他地方只需的一个早晨。我们没有什么实际工作要做,却要花大量的时间干活来让自己看起来很忙。我们在默默地竞赛,看谁能创造最好的“看起来很忙”的工具包,这就是我们花费最多时间的地方了。那份工作我只做了几个月,但好像已经耗费了一生。如果你看到的这个监狱的表面,你可能会说我们是很懒,因为我们只完成了几乎为 0 的实际工作。 -这是个极端的例子,它完全与我所说的“我是一个懒惰的系统管理员”的意思相反,做一个懒惰的系统管理是件好事。 +这是个极端的例子,它完全与我所说的“我是一个懒惰的系统管理员”的意思相反,而做一个懒惰的系统管理是件好事。 #### 真实生产力 -我很幸运,曾为一些真正的经理工作——他们明白,系统管理员的生产力并不是以每天花多少小时敲键盘来衡量。毕竟,即使一只猴子能敲击他们的键盘,但也不能说明结果的价值。 +我很幸运,曾为一些真正的管理者工作过 —— 他们明白,系统管理员的生产力并不是以每天花多少小时敲键盘来衡量。毕竟,即使一只猴子能敲击他们的键盘,但也不能说明结果的价值。 -正如我书中所言 +正如我书中所言: -> 「我是一个懒惰的系统管理员,同时我也是一个高效的系统管理员。这两者看似矛盾的说法不是相互排斥的,而是会以一种非常积极的方式相辅相成。。。 +> “我是一个懒惰的系统管理员,同时我也是一个高效的系统管理员。这两者看似矛盾的说法不是相互排斥的,而是会以一种非常积极的方式相辅相成…… > -> 「一个系统管理员在思考的时候是最高效的——思考关于如何解决现有问题和避免未来的问题;思考怎样监控 Linux 计算机,以便找到预测和预示这些未来的问题的线索;思考如何让他们的工作更有效率;思考如何自动化所有这些要执行的任务, 无论是每天还是每年一次的任务。 +> “系统管理员在思考的时候是最高效的 —— 思考关于如何解决现有问题和避免未来的问题;思考怎样监控 Linux 计算机,以便找到预测和预示这些未来的问题的线索;思考如何让他们的工作更有效率;思考如何自动化所有这些要执行的任务,无论是每天还是每年一次的任务。 > -> 「系统管理员冥思苦想的那一面是不会被非系统管理员所熟知的,那些人包括很多掌管着系统管理员的人,比如那个半秃头老板。系统管理员都会以不同的方式解决他们工作中苦思的部分。一些我认识的系统管理员会在沙滩、骑自行车、参加马拉松或者攀岩时找到最好的想法。另一些人会认为静坐或听音乐的时候思考得最好。还有一些会在阅读小说、学习不相关的学科、甚至在学习 Linux 系统的时候会想得最好。关键是我们都有不同的方式激发我们的创造力,而这些创造力的推进器中很多并不涉及键盘上的一个按键。我们真正的生产力对于系统管理员周围的人来说可能是完全看不见的。」 +> “系统管理员冥思苦想的那一面是不会被非系统管理员所熟知的,那些人包括很多管理着系统管理员的人,比如那个半秃头老板。系统管理员都会以不同的方式解决他们工作中苦思的部分。一些我认识的系统管理员会在沙滩、骑自行车、参加马拉松或者攀岩时找到最好的想法。另一些人会认为静坐或听音乐的时候思考得最好。还有一些会在阅读小说、学习不相关的学科、甚至在学习 Linux 系统的时候可以最佳思考。关键是我们都有不同的方式激发我们的创造力,而这些创造力的推进器中很多并不涉及键盘上的任何一个按键。我们真正的生产力对于系统管理员周围的人来说可能是完全看不见的。” -成为懒惰的系统管理员有一些简单的秘诀——系统管理员要完成一切需要完成的事,而且更多的是,当所有人都处于恐慌的状态时要保持冷静和镇定。(秘诀的)一部分是高效工作,另一部分是把预防问题放在首位。 +成为懒惰的系统管理员有一些简单的秘诀 —— 系统管理员要完成一切需要完成的事,而且更多的是,当所有人都处于恐慌的状态时要保持冷静和镇定。秘诀的一部分是高效工作,另一部分是把预防问题放在首位。 ### 成为懒惰系统管理员的方法 #### 多思考 -我相信关于懒惰系统管理员最重要的秘诀在于思考。正如上面的摘录所言,优秀的系统管理员会花大量的时候思考这些事情,如何更有效率地工作,在异常成为问题前如何定位,更聪明地工作,做其他所有东西的同时会考虑如何完成这些的事等等。 +我相信关于懒惰系统管理员最重要的秘诀在于思考。正如上面的摘录所言,优秀的系统管理员会花大量的时候思考这些事情,如何更有效率地工作,在异常成为问题前如何定位,更聪明地工作,做其它事情的同时会考虑如何完成这些事情等等。 -例如,现在——除了撰写本文之外——我正在想一个项目,我打算在新部件从亚马逊和本地计算机商店到达时才开始。 我不那么重要的计算机上的主板坏了,最近它的崩溃更频率。 但我旧的和最小的服务器——处理我的电子邮件和外部网站,以及为我的网络的其余部分提供 DHCP 和 DNS 服务——并没有出现故障,但必须处理由于各种外部攻击而导致的间歇性过载。 +例如,除了撰写本文之外,我现在正在想一个项目,我打算在从亚马逊和本地计算机商店采购的新部件到达时才开始。我有一台不太关键的计算机上的主板坏了,最近它的崩溃更频率。但我的一台非常老的小服务器并没有出现故障,它负责处理我的电子邮件和外部网站,以及为我的网络的其余部分提供 DHCP 和 DNS 服务,但需要解决由于各种外部攻击而导致的间歇性过载。 -我一开始想,我只要替换故障单元中的主板及其直接部件——内存、CPU,可能还有电源。但是在考虑了一段时间之后,我决定将新部件放到服务器中,并将旧的(但仍然可用的)部件从服务器移到故障系统中。可以这样做的,只需一、两个小时就可以从服务器上移除旧部件并安装新的。然后我就可以花时间更换出故障的电脑里的部件了。太好了。所以我开始在脑海中列出要完成的任务。 +我一开始想,我只要替换故障设备的主板及其直接部件:内存、CPU,可能还有电源。但是在考虑了一段时间之后,我决定将新部件放到服务器中,并将旧的(但仍然可用的)部件从服务器移到故障设备中。可以这样做的,只需一、两个小时就可以从服务器上移除旧部件并安装新的。然后我就可以花时间更换出故障的电脑里的部件了。太好了,所以我开始在脑海中列出要完成的任务。 -然而,当我查看列表时,我意识到服务器中唯一不能替换的部件是机箱和硬盘驱动器,这两台计算机的机箱几乎完全相同。在有了这个小小的发现之后,我开始考虑用新的部件替换出故障的计算机的部件,并将之作为我的服务器。经过一些测试之后,我只需从当前的服务器移除硬盘,并将它安装到新的组件中,改下网络配置项,再更改 KVM 交换机端口上的主机名,并更改主机名标签,就可以了。这将大大减少服务器停机时间,大大减少我的压力。此外,如果出现故障,我可以简单地将硬盘移回原来的服务器,直到我可以用新服务器解决问题为止。 +然而,当我查看这个任务列表时,我意识到服务器中唯一不能替换的部件是机箱和硬盘驱动器,这两台计算机的机箱几乎完全相同。在有了这个小小的发现之后,我开始考虑用新的部件替换出了故障的计算机的部件,并将之作为我的服务器。经过一些测试之后,我只需从当前的服务器移除硬盘,并将它安装到用了新组件的机箱中,改下网络配置项,再更改 KVM 交换机端口上的主机名,并更改机箱上的主机名标签,就可以了。这将大大减少服务器停机时间,大大减少我的压力。此外,如果出现故障,我可以简单地将硬盘移回原来的服务器,直到我可以用新服务器解决问题为止。 -所以,现在我在脑海中已经创建了一个我需要做的任务清单,以完成这项工作。而且——我希望你能仔细观察——当我脑子里想着这一切的时候,我的手指从来没有碰过键盘。我新的心理行动计划风险很低,与我最初的计划相比,涉及的服务器停机时间要少得多。 +所以,现在我在脑海中已经创建了一个完成这项工作我所需要做的任务清单。而且,我希望你能仔细观察,当我脑子里想着这一切的时候,我的手指从来没有碰过键盘。我新的心理行动计划风险很低,与我最初的计划相比,涉及的服务器停机时间要少得多。 -当我在 IBM 工作的时候,我经常看到很多语言中都有写着“思考”的标语。思考可以节省时间和压力,是懒散的系统管理员的主要标志。 +当我在 IBM 工作的时候,我经常看到很多语言中都有写着“**思考**”的标语。思考可以节省时间和压力,是懒散的系统管理员的主要标志。 #### 做预防性维护 -在 1970 年代中期,我被 IBM 聘为客户工程师,我的领地由相当多的穿孔卡片设备组成。这也就是说,它们是处理打孔卡的重型机械设备—— 一些可以追溯到20世纪30年代。因为这些机器主要是机械的,所以它们的部件经常磨损或失调。我的部分工作是在他们损坏时修复这些他们。我工作的主要部分——最重要的部分 ——首先要防止它们。预防性维护的目的是在磨损部件损坏之前进行更换,并对还在运行的部件进行润滑和调整,以确保它们工作正常。 +在 1970 年代中期,我被 IBM 聘为客户工程师,我的领地由相当多的[穿孔卡片设备][2]组成。这也就是说,它们是处理打孔卡的重型机械设备,其中一些可以追溯到 20 世纪 30 年代。因为这些机器主要是机械的,所以它们的部件经常磨损或失调。我的部分工作是在它们损坏时修复它们。我工作的主要部分,也是最重要的部分,是首先要防止它们损坏。预防性维护的目的是在磨损部件损坏之前进行更换,并对还在运行的部件进行润滑和调整,以确保它们工作正常。 +正如我在《系统管理员的 Linux 哲学》中所言: -正如我在《系统管理员的 Linux哲学》( The Linux Philosophy for SysAdmins)中所言: - ->「我在 IBM 的经理们明白这只是冰山一角;他们——和我——都是我的工作是让顾客满意。虽然这通常意味着修复损坏的硬件,但也意味着减少硬件损坏的次数。这对客户来说是好事,因为他们的机器在工作时工作效率更高。这对我有好处,因为我从那些快乐的客户那里接到的电话要少得多。我也睡了更多的觉,因为这样做的结果是更少的非工作时间的紧急电话。我是个懒惰的(客户工程师)。通过提前做额外的工作,从长远来看,我需要做的工作要少得多。 +>“我在 IBM 的经理们明白这只是冰山一角;他们和我都知道,我的工作是让顾客满意。虽然这通常意味着修复损坏的硬件,但也意味着减少硬件损坏的次数。这对客户来说是好事,因为他们的机器在工作时工作效率更高。这对我有好处,因为我从那些快乐的客户那里接到的电话要少得多。我也睡了更多的觉,因为这样做的结果是更少的非工作时间的紧急电话。我是个懒惰的(客户工程师)。通过提前做额外的工作,从长远来看,我需要做的工作要少得多。 > ->「这一原则已成为系统管理员的 Linux 哲学的功能原则之一。作为系统管理员,我们的时间最好用在最大限度地减少未来工作量的任务上。」 +>“这一原则已成为系统管理员的 Linux 哲学的功能原则之一。作为系统管理员,我们的时间最好用在最大限度地减少未来工作量的任务上。” -在 Linux 计算机中查找要解决的问题相当于项目管理。我检查系统日志,寻找以后可能会变得非常危险的问题的暗示。如果出现了一些小问题,或者我注意到我的工作站、服务器没有做出该有的响应,或者如果日志显示了一些不寻常的东西——所有这些都可以暗示出潜在的问题,而对于用户或半秃头老板来说,这些问题并没有产生明显的症状。 +在 Linux 计算机中查找要解决的问题相当于项目管理。我检查系统日志,寻找以后可能会变得非常危险的问题的迹象。如果出现了一些小问题,或者我注意到我的工作站、服务器没有做出该有的响应,或者如果日志显示了一些不寻常的东西,所有这些都可以暗示出潜在的问题,而对于用户或半秃头老板来说,这些问题并没有产生明显的症状。 -我经常检查 `/var/log/` 中的文件,特别是 messages 和 security 文件。我最常见的问题之一是许多脚本小子在我的防火墙系统上尝试各种类型的攻击。而且,不,我不依赖 ISP(Internet Service Provider,网络服务提供者)提供的调制解调器/路由器中的所谓的防火墙。这些日志包含了大量关于企图攻击来源的信息,非常有价值。但是要扫描不同主机上的日志并将解决方案部署到位,需要做大量的工作。所以我转向自动化。 +我经常检查 `/var/log/` 中的文件,特别是 `messages` 和 `security` 文件。我最常见的问题之一是许多脚本小子在我的防火墙系统上尝试各种类型的攻击。而且,不,我不依赖 ISP 提供的调制解调器/路由器中的所谓的防火墙。这些日志包含了大量关于企图攻击来源的信息,非常有价值。但是要扫描不同主机上的日志并将解决方案部署到位,需要做大量的工作,所以我转向自动化。 #### 自动化 -我发现我的工作有很大一部分可以通过某种形式的自动化来完成。系统管理员的 Linux 哲学的原则之一是 「自动化一切」,这包括每天扫描日志文件等枯燥乏味的任务。 +我发现我的工作有很大一部分可以通过某种形式的自动化来完成。系统管理员的 Linux 哲学的原则之一是 “自动化一切”,这包括每天扫描日志文件等枯燥乏味的任务。 -像是 [Logwatch][3] 这类的程序能够监控你的日志文件中的异常条目,并在异常条目发生时通知您。Logwatch通常作为 cron jobs(译者注,Linux/Unix 中周期作业程序)每天运行一次,并向本地主机上的 root 用户发送电子邮件。你可以从命令行运行 Logwatch,并立即在显示器上查看结果。现在我只需要每天查看 Logwatch 的电子邮件通知。 +像是 [Logwatch][3] 这类的程序能够监控你的日志文件中的异常条目,并在异常条目发生时通知您。Logwatch 通常作为 cron 任务每天运行一次,并向本地主机上的 root 用户发送电子邮件。你可以从命令行运行 Logwatch,并立即在显示器上查看结果。现在我只需要每天查看 Logwatch 的电子邮件通知。 -但现实是,仅仅收到通知是不够的,因为我们不能坐以待毙。有时需要立即作出反应。我喜欢的另一个程序是——它能为我做所有事——(让大家看到,这就是懒惰的管理员)——它就是[Fail2ban][4]。Fail2Ban 会扫描指定的日志文件,查找各种类型的黑客攻击和入侵尝试,如果它发现某个 IP 地址在做特定类型的持续活动够了,它会向防火墙添加一个条目,在指定的时间内阻止来自该 IP 地址的任何进一步的黑客尝试。默认值通常在 10 分钟左右,但我喜欢为大多数类型的攻击指定为 12 或 24 小时。每种类型的黑客攻击都是单独配置的,例如尝试通过 SSH 登录和那些 Web 服务器的攻击。 +但现实是,仅仅收到通知是不够的,因为我们不能坐以待毙。有时需要立即作出反应。我喜欢的另一个程序是——它能为我做所有事(看,这就是懒惰的管理员)——它就是 [Fail2ban][4]。Fail2Ban 会扫描指定的日志文件,查找各种类型的黑客攻击和入侵尝试,如果它发现某个 IP 地址在持续做特定类型的活动,它会向防火墙添加一个条目,在指定的时间内阻止来自该 IP 地址的任何进一步的黑客尝试。默认值通常在 10 分钟左右,但我喜欢为大多数类型的攻击指定为 12 或 24 小时。每种类型的黑客攻击都是单独配置的,例如尝试通过 SSH 登录和那些 Web 服务器的攻击。 #### 写脚本 -自动化是哲学的关键组成部分之一。一切可以自动化的东西都应该自动化的,其余的尽可能地自动化。所以,我也写了很多脚本来解决问题,也就说说我编写脚本来完成我的大部分工作。 +自动化是这种哲学的关键组成部分之一。一切可以自动化的东西都应该自动化的,其余的尽可能地自动化。所以,我也写了很多脚本来解决问题,也就是说我编写了脚本来完成我的大部分工作。 -我的脚本帮我节省了大量时间,因为它们包含执行特定任务的命令,这大大减少了我需要输入的数量。例如,我经常重新启动我的电子邮件服务器和垃圾邮件处理软件(当修改 SpamAssassin 的 `local.cf` 配置文件时,就需要重启)。必须按特定顺序停止并重新启动这些服务。因此,我用几个命令编写了一个简短的脚本,并将其存储在可访问的 `/usr/local/bin` 中。现在,不用键入几个命令并等待每个命令都完成,然后再键入下一个命令——更用记住正确的命令顺序和每个命令的正确语法——我输入一个三个字符的命令,其余的留给我的脚本来完成。 +我的脚本帮我节省了大量时间,因为它们包含执行特定任务的命令,这大大减少了我需要输入的数量。例如,我经常重新启动我的电子邮件服务器和垃圾邮件过滤软件(当修改 SpamAssassin 的 `local.cf` 配置文件时,就需要重启)。必须按特定顺序停止并重新启动这些服务。因此,我用几个命令编写了一个简短的脚本,并将其存储在可访问的 `/usr/local/bin` 中。现在,不用键入几个命令并等待每个命令都完成,然后再键入下一个命令,更不用记住正确的命令顺序和每个命令的正确语法,我输入一个三个字符的命令,其余的留给我的脚本来完成。 #### 简化键入 -另一种成为懒惰的系统管理员的方法是减少我们需要键入的数量。而且,我的打字技巧真的很糟糕(也就是说,我一点也没有——顶多是几个笨拙的手指)。导致错误的一个可能原因是我的打字不好,所以我会尽量少打字。 +另一种成为懒惰的系统管理员的方法是减少我们需要键入的数量。而且,我的打字技巧真的很糟糕(也就是说,我一点也没有,顶多是几个笨拙的手指)。导致错误的一个可能原因是我糟糕的打字技巧,所以我会尽量少打字。 -绝大多数 GNU 和 Linux 核心实用程序都有非常短的名称。然而,它们都是有意义的名字。诸如用于更改目录的 `cd` 、用于列出(目录内容)的 `ls` 和用于磁盘转储的 `dd` 等工具都非常明显。短名字意味着更少的打字和更少的产生错误机会。我认为短的名字通常更容易记住。 +绝大多数 GNU 和 Linux 核心实用程序都有非常短的名称。然而,它们都是有意义的名字。诸如用于更改目录的 `cd` 、用于列出目录内容的 `ls` 和用于磁盘转储的 `dd` 等工具都一目了然。短名字意味着更少的打字和更少的产生错误机会。我认为短的名字通常更容易记住。 -当我编写 shell 脚本时,我喜欢保持名称简短而意义(至少对我来说是),比如用于 rsync 备份的 `rsbu`(译者注,Rsync Backup 的简写)。在某些情况下,我喜欢使用更长的名称,比如 `doUpdates` 来执行系统更新。在后一种情况下,长一点名让脚本的目的就越明显。这可以节省时间,因为很容易记住脚本的名称。 +当我编写 shell 脚本时,我喜欢保持名称简短而意义(至少对我来说是),比如用于 rsync 备份的 `rsbu`(LCTT 译注,Rsync Backup 的简写)。但在某些情况下,我喜欢使用更长的名称,比如 `doUpdates` 来执行系统更新。在后一种情况下,更长一点的名字让脚本的目的更明显。这可以节省时间,因为很容易记住脚本的名称。 -其他减少键入的方法包括命令行别名(alias)、命令行调回(recall)和编辑。别名只是你在 Bash shell 键入命令时才做的替换。键入 `alias` 命令会看到默认配置的别名列表。例如,当你输入命令 `ls` 时,会被条目 `alias ls='ls –color=auto'` 替成较长的命令,因此你只需键入 2 个字符而不是 14 个字符即可获得带有颜色的列表。还可以使用 `alias` 命令添加你自己(定义)的别名。 +其他减少键入的方法包括命令行别名、历史命令调回和编辑。别名只是你在 Bash shell 键入命令时才做的替换。键入 `alias` 命令会看到默认配置的别名列表。例如,当你输入命令 `ls` 时,会被条目 `alias ls='ls –color=auto'` 替成较长的命令,因此你只需键入 2 个字符而不是 14 个字符即可获得带有颜色的文件列表。还可以使用 `alias` 命令添加你自己定义的别名。 -命令行调回允许你使用键盘的向上和向下箭头键滚动浏览命令历史记录。如果需要再次使用相同的命令,只需在找到所需的命令时按 Enter 键即可。如果在找到命令后需要更改该命令,则可以使用标准命令行编辑功能进行更改。 +历史命令调回允许你使用键盘的向上和向下箭头键滚动浏览命令历史记录。如果需要再次使用相同的命令,只需在找到所需的命令时按回车键即可。如果在找到命令后需要更改该命令,则可以使用标准命令行编辑功能进行更改。 ### 结束语 -一名懒惰的系统管理员实际上也有很多的工作。但我们是聪明地工作,而不是刻苦工作。早在一堆小问题汇聚成大问题之前, 我们就花时间探索我们负责的主机,并处理好所有的小问题。我们花了很多时间思考解决问题的最佳方法, 我们也花了很多时间来发现新的方法, 让自己更聪明地工作, 成为懒惰的系统管理员。 +一名懒惰的系统管理员实际上也有很多的工作。但我们是聪明地工作,而不是刻苦工作。早在一堆小问题汇聚成大问题之前,我们就花时间探索我们负责的主机,并处理好所有的小问题。我们花了很多时间思考解决问题的最佳方法,我们也花了很多时间来发现新的方法,让自己更聪明地工作,成为懒惰的系统管理员。 -除了这里描述的少数方法外, 还有许多其他的方式可以成为懒惰的系统管理员。我相信你也有一些自己的方式;请在评论中和我们分享。 +除了这里描述的少数方法外,还有许多其他的方式可以成为懒惰的系统管理员。我相信你也有一些自己的方式;请在评论中和我们分享。 -------------------------------------------------------------------------------- @@ -200,7 +107,7 @@ via: https://opensource.com/article/18/7/how-be-lazy-sysadmin 作者:[David Both][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[zgj1024](https://github.com/zgj1024) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -208,4 +115,4 @@ via: https://opensource.com/article/18/7/how-be-lazy-sysadmin [1]:https://www.apress.com/us/book/9781484237298 [2]:https://en.wikipedia.org/wiki/Unit_record_equipment [3]:https://www.techrepublic.com/article/how-to-install-and-use-logwatch-on-linux/ -[4]:https://www.fail2ban.org/wiki/index.php/Main_Page \ No newline at end of file +[4]:https://www.fail2ban.org/wiki/index.php/Main_Page From bd11e3e57999f374665013e34cbcfc8db5dfeb05 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sun, 6 Jan 2019 21:30:45 +0800 Subject: [PATCH 219/322] =?UTF-8?q?20171227=20YAML-=20probably=20not=20so?= =?UTF-8?q?=20great=20after=20all.md=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...7 YAML- probably not so great after all.md | 316 ------------------ ...7 YAML- probably not so great after all.md | 292 ++++++++++++++++ 2 files changed, 292 insertions(+), 316 deletions(-) delete mode 100644 sources/tech/20171227 YAML- probably not so great after all.md create mode 100644 translated/tech/20171227 YAML- probably not so great after all.md diff --git a/sources/tech/20171227 YAML- probably not so great after all.md b/sources/tech/20171227 YAML- probably not so great after all.md deleted file mode 100644 index adeab60bd2..0000000000 --- a/sources/tech/20171227 YAML- probably not so great after all.md +++ /dev/null @@ -1,316 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MjSeven ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (YAML: probably not so great after all) -[#]: via: (https://arp242.net/weblog/yaml_probably_not_so_great_after_all.html) -[#]: author: (Martin Tournoij https://arp242.net/) - -YAML: probably not so great after all -====== - - -I previously wrote [why using JSON for human-editable configuration files is a bad idea][1]. Today we’re going to look at some general problems with the YAML format. - -### Insecure by default - -YAML is insecure by default. Loading a user-provided (untrusted) YAML string needs careful consideration. - -``` -!!python/object/apply:os.system -args: ['ls /'] -``` - -Running it with `print(yaml.load(open('a.yaml')))` should give you something like: - -``` -bin etc lib lost+found opt root sbin tmp var sys -boot dev efi home lib64 mnt proc run srv usr -0 -``` - -Many other languages (including Ruby and PHP) are also unsafe by default. [Searching for `yaml.load` on GitHub][2] gives a whopping 2.8 million results. [`yaml.safe_load`][3] only gives 26,000 results. - -Mind you, many of those `yaml.load()`s are fine – loading in a config file with `yaml.load()` is often okay since it’s usually (though not always!) from a ‘trusted source’, and many are from test files with static YAML. But still, one can’t help but wonder how many exploits are hidden in those 2.8 million results. - -This is not a theoretical problem. In 2013 [every Ruby on Rails application ever written was found to be vulnerable][4] to remote code execution due to exactly this problem. - -One might argue this is not really the fault of the YAML format as such, but rather the fault of the libraries implementing it wrong, but it seems to be the case that the majority of libraries are unsafe by default (especially the dynamic languages), so de-facto it is a problem with YAML. - -One might also argue that fixing it is as easy as replacing `load()` with `safe_load()`, but many people are unaware of the problem, and even if you’re aware of it, it’s one of those things that can be easy to forget. It’s pretty bad API design. - -### Can be hard to edit, especially for large files - -YAML files can be hard to edit, and this difficulty grows fast as the file gets larger. - -A good example of this are Ruby on Rails’ translation files; for example: - -``` -en: - formtastic: - labels: - title: "Title" # Default global value - article: - body: "Article content" - post: - new: - title: "Choose a title..." - body: "Write something..." - edit: - title: "Edit title" - body: "Edit body" -``` - -This still looks okay, right? But what if this file has 100 lines? Or 1,000 lines? It is difficult to see “where” in the file you are because it may be off the screen. You’ll need to scroll up, but then you need to keep track of the indentation, which can be pretty hard even with indentation guides, especially since 2-space indentation is the norm and [tab indentation is forbidden][5]. - -And accidentally getting the indentation wrong often isn’t an error; it will often just deserialize to something you didn’t intend. Happy debugging! - -I’ve been happily programming Python for over a decade, so I’m used to significant whitespace, but sometimes I’m still struggling with YAML. In Python the drawbacks and loss of clarity are contained by not having functions that are several pages long, but data or configuration files have no such natural limits to their length. - -For small files this is not a problem; but it really doesn’t scale well to larger files, especially not if you want to edit them later on. - -### It’s pretty complex - -YAML may seem ‘simple’ and ‘obvious’ when glancing at a basic example, but turns out it’s not. The [YAML spec][6] is 23,449 words; for comparison, [TOML][7] is 3,339 words, [JSON][8] is 1,969 words, and [XML][9] is 20,603 words. - -Who among us have read all that? Who among us have read and understood all of that? Who among of have read, understood, and **remembered** all of that? - -For example did you know there are [nine ways to write a multi-line string in YAML][10] with subtly different behaviour? - -Yeah :-/ - -That post gets even more interesting if you look at [its revision history][11], as the author of the post discovers more and more ways to do this and more of the subtleties involved. - -It’s telling that the YAML spec starts with a preview, which states (emphases mine): - -> This section provides a quick glimpse into the expressive power of YAML. **It is not expected that the first-time reader grok all of the examples**. Rather, these selections are used as motivation for the remainder of the specification. - -#### Surprising behaviour - -What does this parse to (examples courtesy of [Colm O’Connor][12]): - -``` -- Don Corleone: Do you have faith in my judgment? -- Clemenza: Yes -- Don Corleone: Do I have your loyalty? -``` - -Yup! - -``` -[ - {'Don Corleone': 'Do you have faith in my judgment?'}, - {'Clemenza': True}, - {'Don Corleone': 'Do I have your loyalty?'} -] -``` - -Or what about: - -``` -python: 3.5.3 -postgres: 9.3 -``` - -`3.5.3` gets recognized as as string, but `9.3` gets recognized as a number instead of a string: - -``` -{'python': '3.5.3', 'postgres': 9.3} -``` - -Or what about: - -``` -Effenaar: Eindhoven -013: Tilburg -``` - -013 is a popular music Venue in Tilburg, but YAML will send you the wrong way since it’s parsed as an octal number: - -``` -{11: 'Tilburg', 'Effenaar': 'Eindhoven'} -``` - -All of this – and more – is why many experienced YAMLers will often quote all strings, even when it’s not strictly required. Many people don’t use quotes, and it can be easy to forget especially if the rest of the file – possibly written by other people – doesn’t use quotes. - -#### It’s not portable - -Because it’s so complex, its claims of portability have been greatly exaggerated. For example consider this example taken from the YAML spec: - -``` -? - Detroit Tigers - - Chicago cubs -: - - 2001-07-23 - -? [ New York Yankees, - Atlanta Braves ] -: [ 2001-07-02, 2001-08-12, - 2001-08-14 ] -``` - -Aside from the fact that most readers of this probably won’t even know what this does, try parsing it in Python with PyYAML: - -``` -yaml.constructor.ConstructorError: while constructing a mapping - in "a.yaml", line 1, column 1 -found unhashable key - in "a.yaml", line 1, column 3 -``` - -In Ruby it works: - -``` -{ - ["Detroit Tigers", "Chicago cubs"] => [ - # - ], - ["New York Yankees", "Atlanta Braves"] => [ - #, - #, - # - ] -} -``` - -The reason for this is because you can’t use a list as a dict key in Python: - -``` ->>> {['a']: 'zxc'} -Traceback (most recent call last): - File "", line 1, in - TypeError: unhashable type: 'list' -``` - -And this restriction is not unique to Python; common languages such as PHP, JavaScript, and Go all share this restriction. - -So use this in a YAML file, and you won’t be able to read it in most languages. - -Here’s another example again taken from the examples section of the YAML spec: - -``` -# Ranking of 1998 home runs ---- -- Mark McGwire -- Sammy Sosa -- Ken Griffey - -# Team ranking ---- -- Chicago Cubs -- St Louis Cardinals -``` - -Python says: - -``` -yaml.composer.ComposerError: expected a single document in the stream - in "a.yaml", line 3, column 1 -but found another document - in "a.yaml", line 8, column 1 -``` - -While Ruby outputs: - -``` -["Mark McGwire", "Sammy Sosa", "Ken Griffey"] -``` - -The reason for this is that there are multiple YAML documents in a single file (`---` start the document). In Python there is the `load_all()` function to parse all documents. Ruby’s `load()` just loads the first document, and as near as I can tell, doesn’t have a way to load multiple documents. - -There are [many more incompatibilities between implementations][13]. - -### Goals achieved? - -The spec states: - -> The design goals for YAML are, in decreasing priority: -> -> 1. YAML is easily readable by humans. -> 2. YAML data is portable between programming languages. -> 3. YAML matches the native data structures of agile languages. -> 4. YAML has a consistent model to support generic tools. -> 5. YAML supports one-pass processing. -> 6. YAML is expressive and extensible. -> 7. YAML is easy to implement and use. -> - - -So how well does it do? - -> YAML is easily readable by humans. - -True only if you stick to a small subset. The full set is complex – much more so than XML or JSON. - -> YAML data is portable between programming languages. - -Not really true, as it’s too easy to create constructs that are not supported by common languages. - -> YAML matches the native data structures of agile languages. - -See above. Plus, why only support agile (or dynamic) languages? What about other languages? - -> YAML has a consistent model to support generic tools. - -I am not even sure what this means and I can’t find any elaboration. - -> YAML supports one-pass processing. - -I’ll take their word for it. - -> YAML is expressive and extensible. - -Well, it is, but it’s too expressive (e.g. too complex). - -> YAML is easy to implement and use. - -``` -$ cat `ls -1 ~/gocode/src/github.com/go-yaml/yaml/*.go | grep -v _test` | wc -l -9247 - -$ cat /usr/lib/python3.5/site-packages/yaml/*.py | wc -l -5713 -``` - -### Conclusion - -Don’t get me wrong, it’s not like YAML is absolutely terrible – it’s certainly not as [problematic as using JSON][1] – but it’s not exactly great either. There are some drawbacks and surprises that are not at all obvious at first, and there are a number of better alternatives such as [TOML][7] and other more specialized formats. - -Personally, I’m not likely to use it again when I’ve got a choice. - -If you must use YAML then I recommend you use [StrictYAML][14], which removes some (though not all) of the more hairy parts. - -### Feedback - -You can mail me at [martin@arp242.net][15] or [create a GitHub issue][16] for feedback, questions, etc. - --------------------------------------------------------------------------------- - -via: https://arp242.net/weblog/yaml_probably_not_so_great_after_all.html - -作者:[Martin Tournoij][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://arp242.net/ -[b]: https://github.com/lujun9972 -[1]: http://arp242.net/weblog/JSON_as_configuration_files-_please_dont.html -[2]: https://github.com/search?q=yaml.load&type=Code&utf8=%E2%9C%93 -[3]: https://github.com/search?q=yaml.safe_load&type=Code&utf8=%E2%9C%93 -[4]: https://www.sitepoint.com/anatomy-of-an-exploit-an-in-depth-look-at-the-rails-yaml-vulnerability/ -[5]: http://www.yaml.org/faq.html -[6]: http://yaml.org/spec/1.2/spec.pdf -[7]: https://github.com/toml-lang/toml -[8]: http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf -[9]: https://www.w3.org/TR/REC-xml/ -[10]: http://stackoverflow.com/a/21699210/660921 -[11]: http://stackoverflow.com/posts/21699210/revisions -[12]: https://github.com/crdoconnor/strictyaml/blob/master/FAQ.rst#what-is-wrong-with-implicit-typing -[13]: https://github.com/cblp/yaml-sucks -[14]: https://github.com/crdoconnor/strictyaml -[15]: mailto:martin@arp242.net -[16]: https://github.com/Carpetsmoker/arp242.net/issues/new diff --git a/translated/tech/20171227 YAML- probably not so great after all.md b/translated/tech/20171227 YAML- probably not so great after all.md new file mode 100644 index 0000000000..a64cb1e43d --- /dev/null +++ b/translated/tech/20171227 YAML- probably not so great after all.md @@ -0,0 +1,292 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (YAML: probably not so great after all) +[#]: via: (https://arp242.net/weblog/yaml_probably_not_so_great_after_all.html) +[#]: author: (Martin Tournoij https://arp242.net/) + +YAML: 可能并不是那么完美 +====== + +我之前写过[为什么将 JSON 用于人类可编辑的配置文件是一个坏主意][1],今天我们将讨论 YAML 格式的一些常见问题。 + +### 默认情况下不安全 + +YAML 默认是不安全的。加载用户提供的(不可信的)YAML 字符串需要仔细考虑。 +``` +!!python/object/apply:os.system +args: ['ls /'] +``` + +用 `print(yaml.load(open('a.yaml')))` 运行它,应该给你这样的东西: +``` +bin etc lib lost+found opt root sbin tmp var sys +boot dev efi home lib64 mnt proc run srv usr +0 +``` + +许多其他语言(包括 Ruby 和 PHP)默认情况下(to 校正:这里应该说的是解析 yaml)也不安全。[在 GitHub 上搜索 `yaml.load`][2] 会得到惊人的 280 万个结果,而 [`yaml.safe_load`][3] 只能得到 26,000 个结果。 + +提个醒,很多这样的 `yaml.load()` 都工作的很好,在配置文件中加载 `yaml.load()` 通常没问题,因为它通常(虽然并不总是!)来自“可靠源”,而且很多都来自静态的 YAML 测试文件。但是,人们还是不禁怀疑在这 280 万个结果中隐藏了多少漏洞。 + +这不是一个理论问题。在 2013 年,[正是由于这个问题,所有的 Ruby on Rails 应用程序都被发现易受][4]远程代码执行攻击。 + +有人可能会反驳说这不是 YAML 格式的错误,而是那些库实现错误的的问题,但似乎大多数库默认不是安全的(特别是动态语言),所以事实上这是 YAML 的一个问题。 + +有些人可能会反驳认为修复它就像用 `safe_load()` 替换 `load()` 一样容易,但是很多人都没有意识到这个问题,即使你知道它,它也是很容易忘记的事情之一。这是非常糟糕的 API 设计。 + +### 可能很难编辑,特别是对于大文件 + +YAML 文件可能很难编辑,随着文件变大,这个难度会快速增大。 + +一个很好的例子是 Ruby on Rails 的翻译文件。(to 校正:这里 translation files 是什么?)例如: +``` +en: + formtastic: + labels: + title: "Title" # Default global value + article: + body: "Article content" + post: + new: + title: "Choose a title..." + body: "Write something..." + edit: + title: "Edit title" + body: "Edit body" +``` + +看起来不错,对吧?但是如果这个文件有 100 行怎么办?或者 1,000 行?在文件中很难看到 "where",因为它可能在屏幕外。你需要向上滚动,但是你需要跟踪缩进,即使使用缩进指南也很难,特别是因为 2 个缩进是常态而且 [tab 缩进被禁止][5]。 + +不小心缩进出错通常不是一个错误,它通常只是反序列化为你不想要的东西。这样只能祝你调试快乐! + +我已经愉快地编写 Python 长达十多年,所以我已经习惯了显著的空白,但有时候我仍在和 YAML 抗争。在 Python 中,缺点和清晰度的丧失是由于没有那种长达几页的函数,但数据或配置文件的长度没有这种自然限制。(to 校正:这里不太明白为什么没有长达几页函数会导致 python 清晰度的丧失,或许我的翻译有问题) + +对于小文件,这不是问题,但它确实无法很好地扩展到较大的文件,特别是如果你以后想编辑它们的话。 + +### 这非常复杂 + +在浏览一个基本的例子时,YAML 看似“简单”和“显而易见”,但事实证明并非如此。[YAML 规范][6]有 23,449 个单词,为了比较,[TOML][7] 有 3,339 个单词,[Json][8] 有 1,969 个单词,[XML][9] 有 20,603 个单词。 + +我们中有谁读过全部吗?有谁读过并理解了全部?谁阅读过,理解进而**记住**所有这些? + +例如,你知道有[ 9 种方法在 YAML 中编写多行字符串][10]吗?并且它们具有细微的不同行为。 + +是的 :-/ + +如果你看一下[它的修订历史][11],那篇文章就会变得更加有趣,因为文章的作者发现了越来越多的方法可以实现这一点,以及更多的细微之处。 + +它从预览开始告诉我们 YANL 规范,它表明(强调我的): + +> 本节简要介绍了 YAML 的表达能力。**初次阅读的人不可能熟读所有的例子**。相反,这些选择用作规范其余部分的动机。 + +#### 惊讶的行为 + +以下会解析成什么([Colm O’Connor][12] 提供的例子): +``` +- Don Corleone: Do you have faith in my judgment? +- Clemenza: Yes +- Don Corleone: Do I have your loyalty? +``` + +结果为 +``` +[ + {'Don Corleone': 'Do you have faith in my judgment?'}, + {'Clemenza': True}, + {'Don Corleone': 'Do I have your loyalty?'} +] +``` + +那么这个呢: +``` +python: 3.5.3 +postgres: 9.3 +``` + +`3.5.3` 被识别为字符串,但 `9.3` 被识别为数字而不是字符串: +``` +{'python': '3.5.3', 'postgres': 9.3} +``` + +这个呢: +``` +Effenaar: Eindhoven +013: Tilburg +``` + +013 是蒂尔堡(Tilburg)的一个流行音乐场地,但 YAML 会告诉你错误答案,因为它被解析为八进制数字: +``` +{11: 'Tilburg', 'Effenaar': 'Eindhoven'} +``` + +所有这一切,以及更多,就是为什么许多经验丰富的 YAMLers 经常会引用所有字符串的原因,即使它不是严格要求。许多人不使用引号,而且很容易忘记,特别是如果文件的其余部分(可能由其他人编写)不使用引号。 + +### 它不方便 + +因为它太复杂了,它声称的可移植性被夸大了。例如,考虑以下这个从 YAML 规范中获取的示例: +``` +? - Detroit Tigers + - Chicago cubs +: + - 2001-07-23 + +? [ New York Yankees, + Atlanta Braves ] +: [ 2001-07-02, 2001-08-12, + 2001-08-14 ] +``` + +除了大多数读者可能甚至不知道这样做的事实,还可以尝试使用 PyYAML 在 Python 中解析它: +``` +yaml.constructor.ConstructorError: while constructing a mapping + in "a.yaml", line 1, column 1 +found unhashable key + in "a.yaml", line 1, column 3 +``` + +在 Ruby 中,它可以工作: +``` +{ + ["Detroit Tigers", "Chicago cubs"] => [ + # + ], + ["New York Yankees", "Atlanta Braves"] => [ + #, + #, + # + ] +} +``` + +原因是你不能在 Python 中使用列表作为一个字典(dict)键: +``` +>>> {['a']: 'zxc'} +Traceback (most recent call last): + File "", line 1, in + TypeError: unhashable type: 'list' +``` + +而这种限制并不是 Python 特有的,PHP, JavaScript 和 Go 等常用语言都有此限制。 + +因此,在 YAML 文件中使用它,你将无法在大多数语言中解析它。 + +这是另一个从 YAML 规范的示例部分中获取的: +``` +# Ranking of 1998 home runs +--- +- Mark McGwire +- Sammy Sosa +- Ken Griffey + +# Team ranking +--- +- Chicago Cubs +- St Louis Cardinals +``` + +Python 会输出: + +``` +yaml.composer.ComposerError: expected a single document in the stream + in "a.yaml", line 3, column 1 +but found another document + in "a.yaml", line 8, column 1 +``` + +然而 Ruby 输出: +``` +["Mark McGwire", "Sammy Sosa", "Ken Griffey"] +``` + +原因是单个文件中有多个 YAML 文档(`---` 意味开始一个新文档)。在 Python 中,有一个 `load_all` 函数来解析所有文档,而 Ruby 的 `load()` 只是加载第一个文档,据我所知,它没有办法加载多个文档。 + +[在实现之间存在很多不兼容][13]。 + +### 目标实现了吗? + +规范说明: + +> YAML 的设计目标是降低优先级: +> +> 1. YAML 很容易被人类阅读。 +> 2. YAML 数据在编程语言之间是可移植的。 +> 3. YAML 匹配敏捷语言的原生数据结构。 +> 4. YAML 有一个一致的模型来支持通用工具。 +> 5. YAML 支持一趟处理。(to 校正:这里 one-pass 是否有专业翻译?) +> 6. YAML 具有表现力和可扩展性。 +> 7. YAML 易于实现和使用。 +> + +那么它有多好呢? + +> YAML 很容易被人类阅读。 +只有坚持一小部分时才有效。完整集很复杂 - 远远超过 XML 或 JSON。 + +> YAML 数据在编程语言之间是可移植的。 +事实并非如此,因为创建常见语言不支持的结构太容易了。 + +> YAML 匹配敏捷语言的原生数据结构。 +往上看。另外,为什么只支持敏捷(或动态)语言?其他语言呢? + +> YAML 有一个一致的模型来支持通用工具。 +我甚至不确定这意味着什么,我找不到任何详细说明。 + +> YAML 支持一趟处理。 +这点我接受。 + +> YAML 具有表现力和可扩展性。 +嗯,是的,但它太富有表现力(例如太复杂)。 + +> YAML 易于实现和使用。 +``` +$ cat `ls -1 ~/gocode/src/github.com/go-yaml/yaml/*.go | grep -v _test` | wc -l +9247 + +$ cat /usr/lib/python3.5/site-packages/yaml/*.py | wc -l +5713 +``` + +### 结论 + +不要误解我的意思,并不是说 YAML 很糟糕 - 它肯定不像[使用 JSON 那么多的问题][1] - 但它也不是非常好。有一些一开始并不明显的缺点和惊喜,还有许多更好的替代品,如 [TOML][7] 和其他更专业的格式。 + +就个人而言,当我有选择时,我不太可能再次使用它。 + +如果你必须使用 YAML,那么我建议你使用 [StrictYAML][14],它会删除一些(虽然不是全部)比较麻烦的部分。 + +### 反馈 + +你可以发送电子邮件至 [martin@arp242.net][15] 或[创建 GitHub issue][16] 以获取反馈,问题等。 + +-------------------------------------------------------------------------------- + +via: https://arp242.net/weblog/yaml_probably_not_so_great_after_all.html + +作者:[Martin Tournoij][a] +选题:[lujun9972][b] +译者:[MjSeven](https://github.com/MjSeven) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://arp242.net/ +[b]: https://github.com/lujun9972 +[1]: http://arp242.net/weblog/JSON_as_configuration_files-_please_dont.html +[2]: https://github.com/search?q=yaml.load&type=Code&utf8=%E2%9C%93 +[3]: https://github.com/search?q=yaml.safe_load&type=Code&utf8=%E2%9C%93 +[4]: https://www.sitepoint.com/anatomy-of-an-exploit-an-in-depth-look-at-the-rails-yaml-vulnerability/ +[5]: http://www.yaml.org/faq.html +[6]: http://yaml.org/spec/1.2/spec.pdf +[7]: https://github.com/toml-lang/toml +[8]: http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf +[9]: https://www.w3.org/TR/REC-xml/ +[10]: http://stackoverflow.com/a/21699210/660921 +[11]: http://stackoverflow.com/posts/21699210/revisions +[12]: https://github.com/crdoconnor/strictyaml/blob/master/FAQ.rst#what-is-wrong-with-implicit-typing +[13]: https://github.com/cblp/yaml-sucks +[14]: https://github.com/crdoconnor/strictyaml +[15]: mailto:martin@arp242.net +[16]: https://github.com/Carpetsmoker/arp242.net/issues/new From a91b4862d2aca43fc653712c75f877e8637208e9 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 6 Jan 2019 22:54:44 +0800 Subject: [PATCH 220/322] PUB:20180731 How to be the lazy sysadmin.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @zgj1024 本文首发地址:https://linux.cn/article-10419-1.html 您的LCTT 专页地址:https://linux.cn/lctt/zgj1024 请注册领取LCCN:https://lctt.linux.cn/ --- .../talk => published}/20180731 How to be the lazy sysadmin.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename {translated/talk => published}/20180731 How to be the lazy sysadmin.md (99%) diff --git a/translated/talk/20180731 How to be the lazy sysadmin.md b/published/20180731 How to be the lazy sysadmin.md similarity index 99% rename from translated/talk/20180731 How to be the lazy sysadmin.md rename to published/20180731 How to be the lazy sysadmin.md index 5f1c5b7da5..3acc9ce9c4 100644 --- a/translated/talk/20180731 How to be the lazy sysadmin.md +++ b/published/20180731 How to be the lazy sysadmin.md @@ -1,6 +1,6 @@ 如何成为一名懒惰的系统管理员 ====== -> 我们是聪明地工作,而不是刻苦工作,但仍把你的工作做好。 +> 我们是聪明地工作,而不是刻苦工作,但仍能把工作做好。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cat-yawn-vm.png?itok=0c_zy6aQ) From f7fa58d0031bc351062a3009bc09b7c1c81a71d0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 6 Jan 2019 23:22:18 +0800 Subject: [PATCH 221/322] PRF:20181217 4 cool new projects to try in COPR for December 2018.md @geekpi --- ...ojects to try in COPR for December 2018.md | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/translated/tech/20181217 4 cool new projects to try in COPR for December 2018.md b/translated/tech/20181217 4 cool new projects to try in COPR for December 2018.md index e69a659b9e..c791f3c0ca 100644 --- a/translated/tech/20181217 4 cool new projects to try in COPR for December 2018.md +++ b/translated/tech/20181217 4 cool new projects to try in COPR for December 2018.md @@ -1,23 +1,25 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (4 cool new projects to try in COPR for December 2018) [#]: via: (https://fedoramagazine.org/4-try-copr-december-2018/) [#]: author: (Dominik Turecek https://fedoramagazine.org) -2018 年 12 月值得尝试的 4个很酷的 COPR 新项目 +COPR 仓库中 4 个很酷的新软件(2018.12) ====== + ![](https://fedoramagazine.org/wp-content/uploads/2017/08/4-copr-945x400.jpg) -COPR 是个人软件仓库[集合][1],它不在 Fedora 中。某些软件不符合允许轻松打包的标准。或者它可能不符合其他 Fedora 标准,尽管它是自由开源的。COPR 可在 Fedora套件之外提供这些项目。COPR 中的软件不受 Fedora 基础设施的支持,或由项目自己签名。但是,这是尝试新的或实验性软件的一种很好的方法。 +COPR 是软件的个人存储库的[集合][1],它包含那些不在标准的 Fedora 仓库中的软件。某些软件不符合允许轻松打包的标准。或者它可能不符合其他 Fedora 标准,尽管它是自由开源的。COPR 可以在标准的 Fedora 包之外提供这些项目。COPR 中的软件不受 Fedora 基础设施的支持,或者是由项目自己背书的。但是,它是尝试新的或实验性软件的一种很好的方法。 这是 COPR 中一组新的有趣项目。 ### MindForger -[MindForger][2] 是 Markdown 编辑器和笔记本。除了你希望的 Markdown 编辑器的功能之外,MindForger 还允许你将单个文件拆分为多个笔记。组织笔记并在文件之间移动、搜索它们都很容易。我已经使用 MindForger 一段时间来记录学习笔记了,现在可以在 COPR 中找到它啦。 +[MindForger][2] 是一个 Markdown 编辑器和笔记本。除了你预期的 Markdown 编辑器的功能之外,MindForger 还允许你将单个文件拆分为多个笔记。组织笔记并在文件之间移动、搜索它们都很容易。我已经使用 MindForger 一段时间来记录学习笔记了,现在可以在 COPR 中找到它啦。 + ![][3] #### 安装说明 @@ -31,7 +33,7 @@ sudo dnf install mindforger ### Clingo -[Clingo][4] 是使用[回答集编程][5] (ASP) 建模语言解决逻辑问题的程序。使用 ASP,你可以将问题声明为一个 Clingo 逻辑程序然后解决。最后,Clingo 以逻辑模型的形式产生问题的解决方案,称为回答集。 +[Clingo][4] 是使用[回答集编程][5](ASP)建模语言解决逻辑问题的程序。使用 ASP,你可以将问题声明为一个逻辑程序,然后 Clingo 来解决。最后,Clingo 以逻辑模型的形式产生问题的解决方案,称为回答集。 #### 安装说明 @@ -44,7 +46,8 @@ sudo dnf install clingo ### SGVrecord -[SGVrecord][6] 是一个用于录制屏幕的简单工具。它允许你捕获整个屏幕或仅选择其中的一部分。此外,有没有声音都可以进行录制。Sgvrecord 以 WebM 格式生成文件。 +[SGVrecord][6] 是一个用于录制屏幕的简单工具。它允许你捕获整个屏幕或仅选择其中的一部分。此外,有没有声音都可以进行录制。SGVrecord 以 WebM 格式生成文件。 + ![][7] #### 安装说明 @@ -77,7 +80,7 @@ via: https://fedoramagazine.org/4-try-copr-december-2018/ 作者:[Dominik Turecek][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -90,4 +93,4 @@ via: https://fedoramagazine.org/4-try-copr-december-2018/ [5]: https://en.wikipedia.org/wiki/Answer_set_programming [6]: https://github.com/yucefsourani/sgvrecord [7]: https://fedoramagazine.org/wp-content/uploads/2018/12/SGVrecord.png -[8]: https://facebook.github.io/watchman/ \ No newline at end of file +[8]: https://facebook.github.io/watchman/ From b0537b55c6a8473c0e4fed419dbeb569c9d06d49 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 6 Jan 2019 23:23:10 +0800 Subject: [PATCH 222/322] PUB:20181217 4 cool new projects to try in COPR for December 2018.md @geekpi https://linux.cn/article-10420-1.html --- ...17 4 cool new projects to try in COPR for December 2018.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181217 4 cool new projects to try in COPR for December 2018.md (98%) diff --git a/translated/tech/20181217 4 cool new projects to try in COPR for December 2018.md b/published/20181217 4 cool new projects to try in COPR for December 2018.md similarity index 98% rename from translated/tech/20181217 4 cool new projects to try in COPR for December 2018.md rename to published/20181217 4 cool new projects to try in COPR for December 2018.md index c791f3c0ca..5aa1170d24 100644 --- a/translated/tech/20181217 4 cool new projects to try in COPR for December 2018.md +++ b/published/20181217 4 cool new projects to try in COPR for December 2018.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10420-1.html) [#]: subject: (4 cool new projects to try in COPR for December 2018) [#]: via: (https://fedoramagazine.org/4-try-copr-december-2018/) [#]: author: (Dominik Turecek https://fedoramagazine.org) From 70a8cec601c0115caa85a19fb8ca73b76abd95c2 Mon Sep 17 00:00:00 2001 From: WangYue <815420852@qq.com> Date: Sun, 6 Jan 2019 23:24:54 +0800 Subject: [PATCH 223/322] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E7=BF=BB=E8=AF=91=20?= =?UTF-8?q?20190102=20How=20To=20Display=20Thumbnail=20Images=20In=20Termi?= =?UTF-8?q?nal.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 申请翻译 20190102 How To Display Thumbnail Images In Terminal.md --- .../20190102 How To Display Thumbnail Images In Terminal.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190102 How To Display Thumbnail Images In Terminal.md b/sources/tech/20190102 How To Display Thumbnail Images In Terminal.md index 2756747334..3c4105e13f 100644 --- a/sources/tech/20190102 How To Display Thumbnail Images In Terminal.md +++ b/sources/tech/20190102 How To Display Thumbnail Images In Terminal.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: ( WangYueScream) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 922e13340ad924d00129bcc6b160d11ac2fb30a8 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 7 Jan 2019 00:09:39 +0800 Subject: [PATCH 224/322] PRF:20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md @qhwdw --- ...y with PGP - Part 6- Using PGP with Git.md | 195 +++++++----------- 1 file changed, 80 insertions(+), 115 deletions(-) diff --git a/translated/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md b/translated/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md index ba010bb0ec..688864d163 100644 --- a/translated/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md +++ b/translated/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md @@ -1,123 +1,92 @@ 保护代码完整性(六):在 Git 上使用 PGP ====== +> 我们继续我们的 PGP 实践系列,来看看签名标签的标签和提交,这可以帮你确保你的仓库没有被篡改。 + ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/global-network.jpg?itok=h_hhZc36) + 在本系列教程中,我们提供了一个使用 PGP 的实用指南,包括基本概念和工具、生成和保护你的密钥。如果你错过了前面的文章,你可以查看下面的链接。在这篇文章中,我们谈一谈在 Git 中如何集成 PGP、使用签名的标签,然后介绍签名提交,最后添加签名推送的支持。 -[第一部分:基本概念和工具][1] - -[第二部分:生成你的主密钥][2] - -[第三部分:生成 PGP 子密钥][3] - -[第四部分:将主密钥移到离线存储中][4] - -[第五部分:将子密钥移到硬件设备中][5] +- [第一部分:基本概念和工具][1] +- [第二部分:生成你的主密钥][2] +- [第三部分:生成 PGP 子密钥][3] +- [第四部分:将主密钥移到离线存储中][4] +- [第五部分:将子密钥移到硬件设备中][5] Git 的核心特性之一就是它的去中心化本质 —— 一旦仓库克隆到你的本地系统,你就拥有了项目的完整历史,包括所有的标签、提交和分支。然而由于存在着成百上千的克隆仓库,如何才能验证你下载的仓库没有被恶意的第三方做过篡改?你可以从 GitHub 或一些貌似官方的位置来克隆它们,但是如果有些人故意欺骗了你怎么办? -或者在你参与的一些项目上发现了后门,而 "Author" 行显示是你干的,然而你很确定 [不是你干的][6],会发生什么情况? +或者在你参与的一些项目上发现了后门,而 “Author” 行显示是你干的,然而你很确定 [不是你干的][6],会发生什么情况? 为解决上述问题,Git 添加了 PGP 集成。签名的标签通过确认它的内容与创建这个标签的开发者的工作站上的内容完全一致来证明仓库的完整性,而签名的提交几乎是不可能在不访问你的 PGP 密钥的情况下能够假冒你。 -### 清单 - - * 了解签名的标签、提交、和推送(必要) +#### 清单 + * 了解签名的标签、提交和推送(必要) * 配置 git 使用你的密钥(必要) - - * 学习如何签名标签和验证工作(必要) - - * 配置 git 总是签名注释的标签(推荐) - - * 学习如何签名提交和验证工作(必要) - + * 学习标签如何签名和验证(必要) + * 配置 git 总是签名带注释标签(推荐) + * 学习提交如何签名和验证工作(必要) * 配置 git 总是签名提交(推荐) - * 配置 gpg-agent 选项(必要) +#### 考虑事项 +git 实现了 PGP 的多级集成,首先从签名标签开始,接着介绍签名提交,最后添加签名推送的支持。 +##### 了解 Git 哈希 -### 考虑事项 +git 是一个复杂的东西,为了你能够更好地掌握它如何集成 PGP,你需要了解什么是”哈希“。我们将它归纳为两种类型的哈希:树哈希和提交哈希。 -Git 实现了 PGP 的多级集成,首先从签名标签开始,接着介绍签名提交,最后添加签名推送的支持。 - -#### 了解 Git 哈希 - -Git 是一个复杂的东西,为了你能够更好地掌握它如何集成 PGP,你需要了解什么是”哈希“。我们将它归纳为两种类型的哈希:树哈希和提交哈希。 - -##### 树哈希 +###### 树哈希 每次你向仓库提交一个变更,对于仓库中的每个子目录,git 都会记录它里面所有对象的校验和哈希 —— 内容(blobs)、目录(trees)、文件名和许可等等。它只对每次提交中发生变更的树和内容做此操作,这样在只变更树的一小部分时就不必去重新计算整个树的校验和。 然后再计算和存储处于顶级的树的校验和,这样如果仓库的任何一部分发生变化,校验和将不可避免地发生变化。 -##### 提交哈希 +###### 提交哈希 一旦创建了树哈希,git 将计算提交哈希,它将包含有关仓库和变更的下列信息: * 树哈希的校验和 - * 变更前树哈希的校验和(父级) - * 有关作者的信息(名字、email、创作时间) - * 有关提交者的信息(名字、email、提交时间) - * 提交信息 - - - -##### 哈希函数 +###### 哈希函数 在写这篇文章时,虽然研究一种更强大的、抗碰撞的算法的工作正在进行,但 git 仍然使用的是 SHA1 哈希机制去计算校验和。注意,git 已经包含了碰撞防范程序,因此认为对 git 成功进行碰撞攻击仍然是不可行的。 -#### 注释的标签和标签签名 +#### 带注释标签和标签签名 -在每个 Git 仓库中,标签允许开发者标记特定的提交。标签可以是 “轻量级的” —— 几乎只是一个特定提交上的指针,或者它们可以是 “注释的”,它成为 git 树中自己的项目。一个注释的标签对象包含所有下列的信息: - - * 成为标签的提交哈希的校验和 +在每个 Git 仓库中,标签允许开发者标记特定的提交。标签可以是 “轻量级的” —— 几乎只是一个特定提交上的指针,或者它们可以是 “带注释的”,它自己将成为 git 树中的项目。一个带注释标签对象包含所有下列的信息: + * 成为标签的提交的哈希的校验和 * 标签名字 - * 关于打标签的人的信息(名字、email、打标签时间) - * 标签信息 - - - -一个 PGP 签名的标签是一个带有将所有这些条目封装进一个 PGP 签名的注释标签。当开发者签名他们的 git 标签时,他们实际上是向你保证了如下的信息: +一个 PGP 签名的标签是一个带有将所有这些条目封装进一个 PGP 签名的带注释标签。当开发者签名他们的 git 标签时,他们实际上是向你保证了如下的信息: * 他们是谁(以及他们为什么应该被信任) - * 他们在签名时的仓库状态是什么样: - - * 标签包含提交的哈希 - - * 提交哈希包含了顶级树的哈希 - - * 顶级哈希包含了所有文件、内容和子树的哈希 + * 标签包含的提交的哈希 + * 提交的哈希包含了顶级树的哈希 + * 顶级树哈希包含了所有文件、内容和子树的哈希 * 它也包含有关作者的所有信息 - * 包含变更发生时的精确时间 - - - -当你克隆一个仓库并验证一个签名标签时,就是向你以密码方式保证仓库中的所有内容、包括所有它的历史,与开发者签名时在它的计算机上的仓库完全一致。 +当你克隆一个仓库并验证一个签名的标签时,就是向你以密码方式保证:仓库中的所有内容、包括所有它的历史,与开发者签名时在它的计算机上的仓库完全一致。 #### 签名的提交 -签名的提交与签名的标签非常类似 —— 提交对象的内容是 PGP 签名过的,而不是标签对象的内容。一个提交签名也给你提供了开发者签名时,开发者树上的全部可验证信息。标签签名和提交 PGP 签名提供了有关仓库和它的完整历史的完全一致的安全保证。 +签名的提交与签名的标签非常类似 —— PGP 签名的是提交对象的内容,而不是标签对象的内容。一个提交签名也给你提供了开发者签名时开发者树上的全部可验证信息。标签签名和提交的 PGP 签名提供了有关仓库和它的完整历史的完全一致的安全保证。 #### 签名的推送 为了完整起见,在这里包含了签名的推送这一功能,因为在你使用这个功能之前,需要在接收推送的服务器上先启用它。正如我们在上面所说过的,PGP 签名一个 git 对象就是提供了开发者的 git 树当时的可验证信息,但不提供开发者对那个树意图相关的信息。 -比如,你可以在你自己 fork 的 git 仓库的一个实验分支上尝试一个很酷的特性,为了评估它,你提交了你的工作,但是有人在你的代码中发现了一个恶意的 bug。由于你的提交是经过正确签名的,因此有人可能将包含有恶意 bug 的分支推入到 master 分支中,从而在生产系统中引入一个漏洞。由于提交是经过你的密钥正确签名的,所以一切看起来都是合理合法的,而当 bug 被发现时,你的声誉就会因此而受到影响。 +比如,你可以在你自己复刻的 git 仓库的一个实验分支上尝试一个很酷的特性,为了评估它,你提交了你的工作,但是有人在你的代码中发现了一个恶意的 bug。由于你的提交是经过正确签名的,因此有人可能将包含有恶意 bug 的分支推入到 master 分支中,从而在生产系统中引入一个漏洞。由于提交是经过你的密钥正确签名的,所以一切看起来都是合理合法的,而当 bug 被发现时,你的声誉就会因此而受到影响。 在 `git push` 时,为了验证提交的意图而不仅仅是验证它的内容,添加了要求 PGP 推送签名的功能。 @@ -125,47 +94,48 @@ Git 是一个复杂的东西,为了你能够更好地掌握它如何集成 PGP 如果在你的钥匙环上只有一个密钥,那么你就不需要再做额外的事了,因为它是你的默认密钥。 -然而,如果你有多个密钥,那么你必须要告诉 git 去使用哪一个密钥。([fpr] 是你的密钥的指纹): +然而,如果你有多个密钥,那么你必须要告诉 git 去使用哪一个密钥。(`[fpr]` 是你的密钥的指纹): + ``` $ git config --global user.signingKey [fpr] - ``` -注意:如果你有一个不同的 gpg2 命令,那么你应该告诉 git 总是去使用它,而不是传统的版本 1 的 gpg: +注意:如果你有一个不同的 `gpg2` 命令,那么你应该告诉 git 总是去使用它,而不是传统的版本 1 的 `gpg`: + ``` $ git config --global gpg.program gpg2 - ``` #### 如何使用签名标签 -创建一个签名的标签,只要传递一个简单地 -s 开关给 tag 命令即可: +创建一个签名的标签,只要传递一个简单地 `-s` 开关给 `tag` 命令即可: + ``` $ git tag -s [tagname] - ``` 我们建议始终对 git 标签签名,这样让其它的开发者确信他们使用的 git 仓库没有被恶意地修改过(比如,引入后门): ##### 如何验证签名的标签 -验证一个签名的标签,只需要简单地使用 verify-tag 命令即可: +验证一个签名的标签,只需要简单地使用 `verify-tag` 命令即可: + ``` $ git verify-tag [tagname] - ``` 如果你要验证其他人的 git 标签,那么就需要你导入他的 PGP 公钥。请参考 “可信任的团队沟通” 一文中关于此主题的指导。 ##### 在拉取时验证 -如果你从项目仓库的其它 fork 中拉取一个标签,git 将自动验证签名,并在合并操作时显示结果: +如果你从项目仓库的其它复刻中拉取一个标签,git 将自动验证签名,并在合并操作时显示结果: + ``` $ git pull [url] tags/sometag - ``` 合并信息将包含类似下面的内容: + ``` Merge tag 'sometag' of [url] @@ -173,128 +143,123 @@ Merge tag 'sometag' of [url] # gpg: Signature made [...] # gpg: Good signature from [...] - ``` -#### 配置 git 始终签名注释的标签 +#### 配置 git 始终签名带注释标签 + +很可能的是,你正在创建一个带注释标签,你应该去签名它。强制 git 始终签名带注释的标签,你可以设置一个全局配置选项: -很可能的是,你正在创建一个带注释的标签,你应该去签名它。强制 git 始终签名带注释的标签,你可以设置一个全局配置选项: ``` $ git config --global tag.forceSignAnnotated true - ``` -或者,你始终记得每次都传递一个 -s 开关: +或者,你始终记得每次都传递一个 `-s` 开关: + ``` $ git tag -asm "Tag message" tagname - ``` -#### 如何使用签名提交 +#### 如何使用签名的提交 -创建一个签名提交很容易,但是将它纳入到你的工作流中却很困难。许多项目使用签名提交作为一种 "Committed-by:” 的等价行,它记录了代码来源 —— 除了跟踪项目历史外,签名很少有人去验证。在某种意义上,签名的提交用于 ”篡改证据“,而不是 git 工作流的 ”篡改证明“。 +创建一个签名的提交很容易,但是将它纳入到你的工作流中却很困难。许多项目使用签名的提交作为一种 “Committed-by:” 的等价行,它记录了代码来源 —— 除了跟踪项目历史外,签名很少有人去验证。在某种意义上,签名的提交用于 “篡改证据”,而不是 git 工作流的 “篡改证明”。 + +为创建一个签名的提交,你只需要 `git commit` 命令传递一个 `-S` 标志即可(由于它与另一个标志冲突,所以改为大写的 `-S`): -为创建一个签名的提交,你只需要 `git commit` 命令传递一个 -S 标志即可(由于它与另一个标志冲突,所以改为大写的 -S): ``` $ git commit -S - ``` 我们建议始终使用签名提交,并要求项目所有成员都这样做,这样其它人就可以验证它们(下面就讲到如何验证)。 ##### 如何去验证签名的提交 -验证签名的提交需要使用 verify-commit 命令: +验证签名的提交需要使用 `verify-commit` 命令: + ``` $ git verify-commit [hash] - ``` 你也可以查看仓库日志,要求所有提交签名是被验证和显示的: + ``` $ git log --pretty=short --show-signature - ``` -##### 在 git merge 时验证提交 +##### 在 git 合并时验证提交 + +如果项目的所有成员都签名了他们的提交,你可以在合并时强制进行签名检查(然后使用 `-S` 标志对合并操作本身进行签名): -如果项目的所有成员都签名了他们的提交,你可以在合并时强制进行签名检查(然后使用 -S 标志对合并操作本身进行签名): ``` $ git merge --verify-signatures -S merged-branch - ``` 注意,如果有一个提交没有签名或验证失败,将导致合并操作失败。通常情况下,技术是最容易的部分 —— 而人的因素使得项目中很难采用严格的提交验证。 ##### 如果你的项目在补丁管理上采用邮件列表 -如果你的项目在提交和处理补丁时使用一个邮件列表,那么一般很少使用签名提交,因为通过那种方式发送时,签名信息将会丢失。对提交进行签名仍然是非常有用的,这样引用你托管在公开 git 树的其他人就能以它作为参考,但是上游项目接收你的补丁时,仍然不能直接使用 git 去验证它们。 +如果你的项目在提交和处理补丁时使用一个邮件列表,那么一般很少使用签名提交,因为通过那种方式发送时,签名信息将会丢失。对提交进行签名仍然是非常有用的,这样其他人就能引用你托管在公开 git 树作为参考,但是上游项目接收你的补丁时,仍然不能直接使用 git 去验证它们。 尽管,你仍然可以签名包含补丁的电子邮件。 #### 配置 git 始终签名提交 你可以告诉 git 总是签名提交: + ``` git config --global commit.gpgSign true - ``` -或者你每次都记得给 `git commit` 操作传递一个 -S 标志(包括 —amend)。 +或者你每次都记得给 `git commit` 操作传递一个 `-S` 标志(包括 `—amend`)。 #### 配置 gpg-agent 选项 -GnuPG agent 是一个守护工具,它能在你使用 gpg 命令时随时自动启动,并运行在后台来缓存私钥的密码。这种方式让你只需要解锁一次密钥就可以重复地使用它(如果你需要在一个自动脚本中签署一组 git 操作,而不需要重复输入密钥,这种方式就很方便)。 +GnuPG agent 是一个守护工具,它能在你使用 gpg 命令时随时自动启动,并运行在后台来缓存私钥的密码。这种方式让你只需要解锁一次密钥就可以重复地使用它(如果你需要在一个自动脚本中签署一组 git 操作,而不想重复输入密钥,这种方式就很方便)。 为了调整缓存中的密钥过期时间,你应该知道这两个选项: - * default-cache-ttl(秒):如果在 time-to-live 过期之前再次使用同一个密钥,这个倒计时将重置成另一个倒计时周期。缺省值是 600(10 分钟)。 + * `default-cache-ttl`(秒):如果在 TTL 过期之前再次使用同一个密钥,这个倒计时将重置成另一个倒计时周期。缺省值是 600(10 分钟)。 + * `max-cache-ttl`(秒):自首次密钥输入以后,不论最近一次使用密钥是什么时间,只要最大值的 TTL 倒计时过期,你将被要求再次输入密码。它的缺省值是 30 分钟。 - * max-cache-ttl(秒):自首次密钥输入以后,不论最近一次使用密钥是什么时间,只要最大值的 time-to-live 倒计时过期,你将被要求再次输入密码。它的缺省值是 30 分钟。 +如果你认为这些缺省值过短(或过长),你可以编辑 `~/.gnupg/gpg-agent.conf` 文件去设置你自己的值: - - - -如果你认为这些缺省值过短(或过长),你可以编辑 ~/.gnupg/gpg-agent.conf 文件去设置你自己的值: ``` # set to 30 minutes for regular ttl, and 2 hours for max ttl default-cache-ttl 1800 max-cache-ttl 7200 - ``` -##### 额外好处:与 ssh 一起使用 gpg-agent +##### 补充:与 ssh 一起使用 gpg-agent 如果你创建了一个 [A](验证)密钥,并将它移到了智能卡,你可以将它用到 ssh 上,为你的 ssh 会话添加一个双因子验证。为了与 agent 沟通你只需要告诉你的环境去使用正确的套接字文件即可。 -首先,添加下列行到你的 ~/.gnupg/gpg-agent.conf 文件中: +首先,添加下列行到你的 `~/.gnupg/gpg-agent.conf` 文件中: + ``` enable-ssh-support - ``` -接着,添加下列行到你的 .bashrc 文件中: +接着,添加下列行到你的 `.bashrc` 文件中: + ``` export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) - ``` -为了让改变生效,你需要 kill 掉正在运行的 gpg-agent 进程,并重新启动一个新的登入会话: +为了让改变生效,你需要杀掉正在运行的 gpg-agent 进程,并重新启动一个新的登入会话: + ``` $ killall gpg-agent $ bash $ ssh-add -L - ``` 最后的命令将列出代表你的 PGP Auth 密钥的 SSH(注释应该会在结束的位置显示: cardno:XXXXXXXX,表示它来自智能卡)。 -为了启用 ssh 的基于密钥的登入,只需要在你要登入的远程系统上添加 `ssh-add -L` 的输出到 ~/.ssh/authorized_keys 中。祝贺你,这将使你的 SSH 登入凭据更难以窃取。 +为了启用 ssh 的基于密钥的登入,只需要在你要登入的远程系统上添加 `ssh-add -L` 的输出到 `~/.ssh/authorized_keys` 中。祝贺你,这将使你的 SSH 登入凭据更难以窃取。 + +此外,你可以从公共密钥服务器上下载其它人的基于 PGP 的 ssh 公钥,这样就可以赋予他登入 ssh 的权利: -作为一个福利,你可以从公共密钥服务器上下载其它人的基于 PGP 的 ssh 公钥,这样就可以赋予他登入 ssh 的权利: ``` $ gpg --export-ssh-key [keyid] - ``` 如果你有让开发人员通过 ssh 来访问 git 仓库的需要,这将让你非常方便。下一篇文章,我们将提供像保护你的密钥那样保护电子邮件帐户的小技巧。 @@ -305,14 +270,14 @@ via: https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-p 作者:[KONSTANTIN RYABITSEV][a] 译者:[qhwdw](https://github.com/qhwdw) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]:https://www.linux.com/users/mricon -[1]:https://www.linux.com/blog/learn/2018/2/protecting-code-integrity-pgp-part-1-basic-pgp-concepts-and-tools -[2]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-2-generating-and-protecting-your-master-pgp-key -[3]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-3-generating-pgp-subkeys -[4]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-4-moving-your-master-key-offline-storage -[5]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-5-moving-subkeys-hardware-device +[1]:https://linux.cn/article-9524-1.html +[2]:https://linux.cn/article-9529-1.html +[3]:https://linux.cn/article-9607-1.html +[4]:https://linux.cn/article-10402-1.html +[5]:https://linux.cn/article-10415-1.html [6]:https://github.com/jayphelps/git-blame-someone-else From 92d61ac555a7a1e3f6e087d26da377ffd8c65498 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 7 Jan 2019 00:10:03 +0800 Subject: [PATCH 225/322] PUB:20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md @qhwdw https://linux.cn/article-10421-1.html --- ...ecting Code Integrity with PGP - Part 6- Using PGP with Git.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md (100%) diff --git a/translated/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md b/published/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md similarity index 100% rename from translated/tech/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md rename to published/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md From ffddd29dada11075f8d29e4ee38f120a816ac82d Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 7 Jan 2019 08:55:38 +0800 Subject: [PATCH 226/322] translated --- ...ux command line can fetch fun from afar.md | 63 ------------------- ...ux command line can fetch fun from afar.md | 63 +++++++++++++++++++ 2 files changed, 63 insertions(+), 63 deletions(-) delete mode 100644 sources/tech/20181223 The Linux command line can fetch fun from afar.md create mode 100644 translated/tech/20181223 The Linux command line can fetch fun from afar.md diff --git a/sources/tech/20181223 The Linux command line can fetch fun from afar.md b/sources/tech/20181223 The Linux command line can fetch fun from afar.md deleted file mode 100644 index 19231007f4..0000000000 --- a/sources/tech/20181223 The Linux command line can fetch fun from afar.md +++ /dev/null @@ -1,63 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (The Linux command line can fetch fun from afar) -[#]: via: (https://opensource.com/article/18/12/linux-toy-remote) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) - -The Linux command line can fetch fun from afar -====== -Use these tools to access weather, reading material, and more from remote locations. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-remote.png?itok=mHm9POPi) - -We're almost to the end of our 24-day-long Linux command-line toys advent calendar. Hopefully, you've been following along, but if not, start back at [the beginning][1] and work your way through. You'll find plenty of games, diversions, and oddities for your Linux terminal. - -And while you may have seen some toys from our calendar before, we hope there’s at least one new thing for everyone. - -Today's toy (or actually, collection of toys) is a little different. So far I've mostly tried to focus on toys that are self-contained, and completely usable under an open source license. But I've gotten some great suggestions from readers which utilize an open source tool to access something remotely that may or may not be open source. Today, I'll round up a few of those. - -The first one is a total classic: use Telnet to watch an ASCII-rendition of Star Wars. Chances are that Telnet is already installed on your system, so all you'll need to do is run: - -``` -$ telnet towel.blinkenlights.nl -``` - -I feel like I first saw this one over a decade ago, so it's a bit amazing to me that it's still alive and online. If you've never watched it, set aside some time and go check it out. You won't regret it. - -![](https://opensource.com/sites/default/files/uploads/linux-toy-star-wars.png) - -Next, Opensource.com contributor [Manuel Dewald][2] suggested a way to fetch your local weather from the terminal. It's easy, and only requires that you have **curl** (or, well, **** **wget** ) installed. - -``` -$ curl wttr.in -``` - -![](https://opensource.com/sites/default/files/uploads/linux-toy-weather.png) - -Finally, while you can spend the holidays reading your favorite sites (including Opensource.com) from your favorite [command-line web browser][3], there are a few of my favorite sites that are more easily browsed with a dedicated client. Two of these include Reddit and Hacker News, for which there are clients that have been recommended to me that you may wish to try, mostly available under open source licenses. I've poked around with [haxor-news][4] (Hacker News) and [rtv][5] (Reddit), and both seem pretty cool. - -Do you have a favorite command-line toy that we should have included? It's a little late to submit a suggestion for this year, but we'd still love to feature some cool command-line toys in the new year. Let me know in the comments below, and I'll check it out. And let me know what you thought of today's amusement. - -Be sure to check out yesterday's toy, [Watch YouTube videos at the Linux terminal][6], and come back tomorrow for another! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-remote - -作者:[Jason Baker][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/jason-baker -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/article/18/12/linux-toy-boxes -[2]: https://opensource.com/users/ntlx -[3]: https://opensource.com/article/16/12/web-browsers-linux-command-line -[4]: https://github.com/donnemartin/haxor-news -[5]: https://github.com/michael-lazar/rtv -[6]: https://opensource.com/article/18/12/linux-toy-youtube-dl diff --git a/translated/tech/20181223 The Linux command line can fetch fun from afar.md b/translated/tech/20181223 The Linux command line can fetch fun from afar.md new file mode 100644 index 0000000000..d9f64745f3 --- /dev/null +++ b/translated/tech/20181223 The Linux command line can fetch fun from afar.md @@ -0,0 +1,63 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The Linux command line can fetch fun from afar) +[#]: via: (https://opensource.com/article/18/12/linux-toy-remote) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +能从远程获得乐趣的 Linux 命令 +====== +使用这些工具从远程了解天气、阅读资料等。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-remote.png?itok=mHm9POPi) + +我们即将结束为期 24 天的 Linux 命令行玩具日历。希望你有一直在看,如果没有,请回到[开始][1],从头看过来。你会发现 Linux 终端有很多游戏、消遣和奇怪之处。 + +虽然你之前可能已经看过我们日历中的一些玩具,但我们希望每个人都遇见一个新事物。 + +今天的玩具(实际是玩具集合)有点不同。到目前为止,我主要是想把重点放在那些独立的玩具上,并且完全可在开源许可下使用。但是我从读者那里得到了一些很好的建议,利用开源工具远程访问一些开源或者不开源的东西。今天,我将介绍其中的一些。 + +第一个是经典之作:使用 Telnet 观看星球大战的 ASCII 演绎版本。你的系统可能已经安装了 Telnet,因此你只需运行: + +``` +$ telnet towel.blinkenlights.nl +``` + +我第一次看到它是十年之前,因此我对于它还存在优点惊奇。如果你还没看过,请留出一点时间看一下。你不会后悔的。 + +![](https://opensource.com/sites/default/files/uploads/linux-toy-star-wars.png) + +接下来,Opensource.com 的撰稿人 [Manuel Dewald][2] 提出了一种从终端获取当地天气的方法。它很简单,你只需安装 **curl**(或者,**wget**)。 + +``` +$ curl wttr.in +``` + +![](https://opensource.com/sites/default/files/uploads/linux-toy-weather.png) + +最后,在假期中虽然你可以从[命令行 Web 浏览器][3]浏览你喜欢的网站(包括 Opensource.com),但有一些我最喜欢的网站可以通过专用客户端更轻松地浏览。其中两个是 Reddit 和 Hacker News,我被推荐过一些它们的客户端,你可能也想尝试,它们都使用开源许可。我尝试过 [haxor-news][4] (Hacker News) 和 [rtv][5] (Reddit),它们都还不错。 + +你有特别喜欢的命令行小玩具需要我介绍的吗?提交今年的建议有点晚了,但我们仍然希望在新的一年里有一些很酷的命令行玩具。请在下面的评论中告诉我,我会查看的。让我知道你对今天的玩具有何看法。 + +一定要看看昨天的玩具,[在 Linux 终端收看 Youtube 视频][2],明天还要再来! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-remote + +作者:[Jason Baker][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jason-baker +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/18/12/linux-toy-boxes +[2]: https://opensource.com/users/ntlx +[3]: https://opensource.com/article/16/12/web-browsers-linux-command-line +[4]: https://github.com/donnemartin/haxor-news +[5]: https://github.com/michael-lazar/rtv +[6]: https://opensource.com/article/18/12/linux-toy-youtube-dl \ No newline at end of file From a893339bf1cffe00d274f3c60af08ea56f1a3540 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 7 Jan 2019 09:01:09 +0800 Subject: [PATCH 227/322] translating --- .../tech/20181210 Snake your way across your Linux terminal.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181210 Snake your way across your Linux terminal.md b/sources/tech/20181210 Snake your way across your Linux terminal.md index 5ae452dcf5..32c4aba096 100644 --- a/sources/tech/20181210 Snake your way across your Linux terminal.md +++ b/sources/tech/20181210 Snake your way across your Linux terminal.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 61374c191a5955e5ce7b35b757c4792d443b5c42 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 7 Jan 2019 13:03:19 +0800 Subject: [PATCH 228/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Computer=20Labora?= =?UTF-8?q?tory=20=E2=80=93=20Raspberry=20Pi:=20Lesson=201=20OK01?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...aboratory - Raspberry Pi- Lesson 1 OK01.md | 232 ++++++++++++++++++ 1 file changed, 232 insertions(+) create mode 100644 sources/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md diff --git a/sources/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md b/sources/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md new file mode 100644 index 0000000000..c5225cba1a --- /dev/null +++ b/sources/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md @@ -0,0 +1,232 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 1 OK01) +[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html) +[#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) + +Computer Laboratory – Raspberry Pi: Lesson 1 OK01 +====== + +The OK01 lesson contains an explanation about how to get started and teaches how to enable the 'OK' or 'ACT' **LED** on the Raspberry Pi board near the RCA and USB ports. This light was originally labelled OK but has been renamed to ACT on the revision 2 Raspberry Pi boards. + +### 1 Getting Started + +I am assuming at this point that you have already visited the [Downloads][1] page, and got the necessary GNU Toolchain. Also on the downloads page is a file called OS Template. Please download this and extract its contents to a new directory. + +### 2 The Beginning + +``` +The '.s' file extension is commonly used for all forms of assembly code, it is up to us to remember this is ARMv6. +``` + +Now that you have extracted the template, create a new file in the 'source' directory called 'main.s'. This file will contain the code for this operating system. To be explicit, the folder structure should look like: + +``` +build/ + (empty) +source/ + main.s +kernel.ld +LICENSE +Makefile +``` + +Open 'main.s' in a text editor so that we can begin typing assembly code. The Raspberry Pi uses a variety of assembly code called ARMv6, so that is what we'll need to write in. + +Copy in these first commands. + +``` +.section .init +.globl _start +_start: +``` + +As it happens, none of these actually do anything on the Raspberry Pi, these are all instructions to the assembler. The assembler is the program that will translate between assembly code that we understand, and binary machine code that the Raspberry Pi understands. In Assembly Code, each line is a new command. The first line here tells the Assembler[1] where to put our code. The template I provided causes the code in the section called .init to be put at the start of the output. This is important, as we want to make sure we can control which code runs first. If we don't do this, the code in the alphabetically first file name will run first! The .section command simply tells the assembler which section to put the code in, from this point until the next .section or the end of the file. + +``` +In assembly code, you may skip lines, and put spaces before and after commands to aid readability. +``` + +The next two lines are there to stop a warning message and aren't all that important.[2] + +### 3 The First Line + +Now we're actually going to code something. In assembly code, the computer simply goes through the code, doing each instruction in order, unless told otherwise. Each instruction starts on a new line. + +Copy the following instruction. + +``` +ldr r0,=0x20200000 +``` + +``` +ldr reg,=val puts the number val into the register named reg. +``` + +That is our first command. It tells the processor to store the number 0x20200000 into the register r0. I shall need to answer two questions here, what is a register, and how is 0x20200000 a number? + +``` +A single register can store any integer between 0 and 4,294,967,295 inclusive on the Raspberry Pi, which might seem like a large amount of memory, but it is only 32 binary bits. +``` + +A register is a tiny piece of memory in the processor, which is where the processor stores the numbers it is working on right now. There are quite a few of these, many of which have a special meaning, which we will come to later. Importantly there are 13 (named r0,r1,r2,...,r9,r10,r11,r12) which are called General Purpose, and you can use them for whatever calculations you need to do. Since it's the first, I've used r0 in this example, but I could very well have used any of the others. As long as you're consistent, it doesn't matter. + +0x20200000 is indeed a number. However it is written in Hexadecimal notation. To learn more about hexadecimal expand the box below: +``` +Hexadecimal is an alternate system for writing numbers. You may only be aware of the decimal system for writing numbers in which we have 10 digits: 0,1,2,3,4,5,6,7,8 and 9. Hexadecimal is a system with 16 digits: 0,1,2,3,4,5,6,7,8,9,a,b,c,d,e and f. + +![567 is 5 hundreds, 6 tens and 7 units.][2] + +You may recall being taught how decimal numbers work in terms of place value. We say that the rightmost digits is the 'units' digits, the next one left is the 'tens' digit, the next is the 'hundreds' digit, and so on. What this actually meant is, the number is 100 × the value in the 'hundreds' digit, plus 10 × the value in the 'tens' digit, plus 1 × the value in the units digit. + +![567 is 5x10^2+6x10^1+7x10^0][3] + +More mathematically, we can now spot the pattern and say that the rightmost digit is the 100=1s digit, the next left is the 101=10s digit, the next is 102=100s digit, and so on. We have all agreed on the system that 0 is the lowest digit, 1 is the next and so on. But what if we used a different number instead of 10 in these powers? Hexadecimal is just the system in which we use 16 instead. + +![567 = 5x10^2+6x10^1+7x10^0 = 2x16^2+3x16^1+7x16^0][4] + +The mathematics to the right shows that the number 567 in decimal is equivalent to the number 237 in hexadecimal. Often when we need to be clear about what system we're using to write numbers in we put 10 for decimal and 16 for hexadecimal. Since it's difficult to write small numbers in assembly code, we use 0x instead to represent a number in hexadecimal notation. So 0x237 means 23716. + +So where do a,b,c,d,e and f come in? Well, in order to be able to write every number in hexadecimal, we need extra digits. For example 916 = 9×160 = 910, but 1016 = 1×161 + 1×160 = 1610. So if we just used 0,1,2,3,4,5,6,7,8 and 9 we would not be able to write 1010, 1110, 1210, 1310, 1410, 1510. So we introduce 6 new digits such that a16 = 1010, b16 = 1110, c16 = 1210, d16 = 1310, e16 = 1410, f16 = 1510 + +So, we now have another system for writing numbers. But why did we bother? Well, it turns out that since computers always work in binary, hexadecimal notation is very useful because every hexadecimal digit is exactly four binary digits long. This has the nice side effect that a lot of computer numbers are round numbers in hexadecimal, even though they're not in decimal. For example, in the assembly code just above I used the number 2020000016. If I had chose to write this in decimal it would have been 53896806410, which is much less memorable. + +To convert numbers from decimal to hexadecimal I find the following method easiest: + +![Conversion example][5] + + 1. Start with the decimal number, say 567. + 2. Divide by 16 and calculate the remainder. For example 567 ÷ 16 = 35 remainder 7. + 3. The remainder is the last digit of the answer in hexadecimal, in the example this is 7. + 4. Repeat steps 2 and 3 again with the result of the last division until the result is 0. For example 35 ÷ 16 = 2 remainder 3, so 3 is the next digit of the answer. 2 ÷ 16 = 0 remainder 2, so 2 is the next digit of the answer. + 5. Once the result of the division is 0, you can stop. The answer is just the remainders in the reverse order to which you got them, so 56710 = 23716. + + + +To convert hexadecimal numbers back to decimal, it is easiest to expand out the number, so 23716 = 2×162 + 3×161 +7 ×160 = 2×256 + 3×16 + 7×1 = 512 + 48 + 7 = 567. +``` + +So our first command is to put the number 2020000016 into r0. That doesn't sound like it would be much use, but it is. In computers, there are an awful lot of chunks of memory and devices. In order to access them all, we give each one an address. Much like a postal address or a web address this is just a means of identifying the location of the device or chunks of memory we want. Addresses in computers are just numbers, and so the number 2020000016 happens to be the address of the GPIO controller. This is just a design decision taken by the manufacturers, they could have used any other address (providing it didn't conflict with anything else). I know this address only because I looked it up in a manual[3], there is no particular system to the addresses (other than that they are all large round numbers in hexadecimal). + +### 4 Enabling Output + +![A diagram showing key parts of the GPIO controller.][6] + +Having read the manual, I know we're going to need to send two messages to the GPIO controller. We need to talk its language, but if we do, it will obligingly do what we want and turn on the OK LED. Fortunately, it is such a simple chip, that it only needs a few numbers in order to understand what to do. + +``` +mov r1,#1 +lsl r1,#18 +str r1,[r0,#4] +``` + +``` +mov reg,#val puts the number val into the register named reg. + +lsl reg,#val shifts the binary representation of the number in reg by val places to the left. + +str reg,[dest,#val] stores the number in reg at the address given by dest + val. +``` + +These commands enable output to the 16th GPIO pin. First we get a necessary value in r1, then send it to the GPIO controller. Since the first two instructions are just trying to get a value into r1, we could use another ldr command as before, but it will be useful to us later to be able to set any given GPIO pin, so it is better to deduce the value from a formula than write it straight in. The OK LED is wired to the 16th GPIO pin, and so we need to send a command to enable the 16th pin. + +The value in r1 is needed to enable the LED pin. The first line puts the number 110 into r1. The mov command is faster than the ldr command, because it does not involve a memory interaction, whereas ldr loads the value we want to put into the register from memory. However, mov can only be used to load certain values[4]. In ARM assembly code, almost every instruction begins with a three letter code. This is called the mnemonic, and is supposed to hint at what the operation does. mov is short for move and ldr is short for load register. mov moves the second argument #1 into the first r1. In general, # must be used to denote numbers, but we have already seen a counterexample to this. + +The second instruction is lsl or logical shift left. This means shift the binary representation for the first argument left by the second argument. In this case this will shift the binary representation of 110 (which is 12) left by 18 places (making it 10000000000000000002=26214410). + +If you are unfamiliar with binary, expand the box below: +``` +Just like hexadecimal binary is another way of writing numbers. In binary we only have 2 digits, 0 and 1. This is useful for computers because we can implement this in a circuit by saying that electricity flowing through the circuit means 1, and not means 0. This is how computers actually work and do maths. Despite only having 2 digits binary can still be used to represent every number, it just takes a lot longer. + +![567 in decimal = 1000110111 in binary][7] + +The image shows the binary representation of the number 56710 which is 10001101112. We use 2 to denote numbers written in binary. + +One of the quirks of binary that we make heavy use of in assembly code is the ease by which numbers can be multiplied or divided by powers of 2 (e.g. 1,2,4,8,16). Normally multiplications and divisions are tricky operations, however these special cases are very easy, and so are very important. + +![13*4 = 52, 1101*100=110100][8] + +Shifting a binary number left by **n** places is the same as multiplying the number by 2 **n**. So, if we want to multiply by 4, we just shift the number left 2 places. If we want to multiply by 256 we could shift it left by 8 places. If we wanted to multiply by a number like 12, we could instead multiply it by 8, then separately by 4 and add the results (N × 12 = N × (8 + 4) = N × 8 + N × 4). + +![53/16 = 3, 110100/10000=11][9] + +Shifting a binary number right by **n** places is the same as dividing the number by 2 **n**. The remainder of the division is the bits that were lost when shifted right. Unfortunately dividing by a binary number that is not an exact power of 2 is very difficult, and will be covered in [Lesson 9: Screen04][10]. + +![Binary Terminology][11] + +This diagram shows common terminology used with binary. A bit is a single binary digit. A nibble is 4 binary bits. A byte is 2 nibbles, or 8 bits. A half is half the size of a word, 2 bytes in this case. A word refers to the size of the registers on a processor, and so on the Raspberry Pi this is 4 bytes. The convention is to number the most significant bit of a word 31, and the least significant bit as 0. The top, or high bits refer to the most significant bits, and the low or bottom bits refer to the least significant. A kilobyte (KB) is 1000 bytes, a megabyte is 1000 KB. There is some confusion as to whether this should be 1000 or 1024 (a round number in binary). As such, the new international standard is that a KB is 1000 bytes, and a Kibibyte (KiB) is 1024 bytes. A Kb is 1000 bits, and a Kib is 1024 bits. + +The Raspberry Pi is little endian by default, meaning that loading a byte from an address you just wrote a word to will load the lowest byte of the word. +``` + +Once again, I only know that we need this value from reading the manual[3]. The manual says that there is a set of 24 bytes in the GPIO controller, which determine the settings of the GPIO pin. The first 4 relate to the first 10 GPIO pins, the second 4 relate to the next 10 and so on. There are 54 GPIO pins, so we need 6 sets of 4 bytes, which is 24 bytes in total. Within each 4 byte section, every 3 bits relates to a particular GPIO pin. Since we want the 16th GPIO pin, we need the second set of 4 bytes because we're dealing with pins 10-19, and we need the 6th set of 3 bits, which is where the number 18 (6×3) comes from in the code above. + +Finally the str 'store register' command stores the value in the first argument, r1 into the address computed from the expression afterwards. The expression can be a register, in this case r0, which we know to be the GPIO controller address, and another value to add to it, in this case #4. This means we add 4 to the GPIO controller address and write the value in r1 to that location. This happens to be the location of the second set of 4 bytes that I mentioned before, and so we send our first message to the GPIO controller, telling it to ready the 16th GPIO pin for output. + +### 5 A Sign Of Life + +Now that the LED is ready to turn on, we need to actually turn it on. This means sending a message to the GPIO controller to turn pin 16 off. Yes, turn it off. The chip manufacturers decided it made more sense[5] to have the LED turn on when the GPIO pin is off. Hardware engineers often seem to take these sorts of decisions, seemingly just to keep OS Developers on their toes. Consider yourself warned. + +``` +mov r1,#1 +lsl r1,#16 +str r1,[r0,#40] +``` + +Hopefully you should recognise all of the above commands, if not their values. The first puts a 1 into r1 as before. The second shifts the binary representation of this 1 left by 16 places. Since we want to turn pin 16 off, we need to have a 1 in the 16th bit of this next message (other values would work for other pins). Finally we write it out to the address which is 4010 added to the GPIO controller address, which happens to be the address to write to turn a pin off (28 would turn the pin on). + +### 6 Happily Ever After + +It might be tempting to finish now, but unfortunately the processor doesn't know we're done. In actuality, the processor never will stop. As long as it has power, it continues working. Thus, we need to give it a task to do forever more, or the Raspberry Pi will crash (not much of a problem in this example, the light is already on). + +``` +loop$: +b loop$ +``` + +``` +name: labels the next line name. + +b label causes the next line to be executed to be label. +``` + +The first line here is not a command, but a label. It names the next line loop$. This means we can now refer to the line by name. This is called a label. Labels get discarded when the code is turned into binary, but they're useful for our benefit for referring to lines by name, not number (address). By convention we use a $ for labels which are only important to the code in this block of code, to let others know they're not important to the overall program. The b (branch) command causes the next line to be executed to be the one at the label specified, rather than the one after it. Therefore, the next line to be executed will be this b, which will cause it to be executed again, and so on forever. Thus the processor is stuck in a nice infinite loop until it is switched off safely. + +The new line at the end of the block is intentional. The GNU toolchain expects all assembly code files to end in an empty line, so that it is sure you were really finished, and the file hasn't been cut off. If you don't put one, you get an annoying warning when the assembler runs. + +### 7 Pi Time + +So we've written the code, now to get it onto the pi. Open a terminal on your computer and change the current working directory to the parent directory of the source directory. Type make and then press enter. If any errors occur, please refer to the troubleshooting section. If not, you will have generated three files. kernel.img is the compiled image of your operating system. kernel.list is a listing of the assembly code you wrote, as it was actually generated. This is useful to check that things were generated correctly in future. The kernel.map file contains a map of where all the labels ended up, which can be useful for chasing around values. + +To install your operating system, first of all get a Raspberry PI SD card which has an operating system installed already. If you browse the files in the SD card, you should see one called kernel.img. Rename this file to something else, such as kernel_linux.img. Then, copy the file kernel.img that make generated onto the SD Card. You've just replaced the existing operating system with your own. To switch back, simply delete your kernel.img file, and rename the other one back to kernel.img. I find it is always helpful to keep a backup of you original Raspberry Pi operating system, in case you need it again. + +Put the SD card into a Raspberry Pi and turn it on. The OK LED should turn on. If not please see the troubleshooting page. If so, congratulations, you just wrote your first operating system. See [Lesson 2: OK02][12] for a guide to making the LED flash on and off. + +-------------------------------------------------------------------------------- + +via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html + +作者:[Robert Mullins][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://www.cl.cam.ac.uk/~rdm34 +[b]: https://github.com/lujun9972 +[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/downloads.html +[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/hexadecimal1.png +[3]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/hexadecimal2.png +[4]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/hexadecimal3.png +[5]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/hexadecimal4.png +[6]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/gpioController.png +[7]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/binary1.png +[8]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/binary2.png +[9]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/binary3.png +[10]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen04.html +[11]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/binary4.png +[12]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok02.html From 1454b2ba82673e43a05d75d8b42179fe10e00df3 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 7 Jan 2019 13:05:17 +0800 Subject: [PATCH 229/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Computer=20Labora?= =?UTF-8?q?tory=20=E2=80=93=20Raspberry=20Pi:=20Lesson=202=20OK02?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...aboratory - Raspberry Pi- Lesson 2 OK02.md | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 sources/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md diff --git a/sources/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md b/sources/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md new file mode 100644 index 0000000000..9442a67708 --- /dev/null +++ b/sources/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md @@ -0,0 +1,68 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 2 OK02) +[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok02.html) +[#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) + +Computer Laboratory – Raspberry Pi: Lesson 2 OK02 +====== + +The OK02 lesson builds on OK01, by causing the 'OK' or 'ACT' LED to turn on and off repeatedly. It is assumed you have the code for the [Lesson 1: OK01][1] operating system as a basis. + +### 1 Waiting + +Waiting is a surprisingly useful part of Operating System development. Often Operating Systems find themselves with nothing to do, and must delay. In this example, we wish to do so in order to allow the LED flashing off and on to be visible. If you just turned it off and on, it would not be visible, as the computer would be able to turn it off and on many thousands of times per second. In later lessons we will look at accurate waiting, but for now it is sufficient to simply waste time. + +``` +mov r2,#0x3F0000 +wait1$: +sub r2,#1 +cmp r2,#0 +bne wait1$ +``` + +``` +sub reg,#val subtracts the number val from the value in reg. + +cmp reg,#val compares the value in reg with the number val. + +Suffix ne causes the command to be executed only if the last comparison determined that the numbers were not equal. +``` + +The code above is a generic piece of code that creates a delay, which thanks to every Raspberry Pi being basically the same, is roughly the same time. How it does this is using a mov command to put the value 3F000016 into r2, and then subtracting 1 from this value until it is 0. The new commands here are sub, cmp, and bne. + +sub is the subtract command, and simply subtracts the second argument from the first. + +cmp is a more interesting command. It compares the first argument with the second, and remembers the result of the comparison in a special register called the current processor status register. You don't really need to worry about this, suffice to say it remembers, among other things, which of the two numbers was bigger or smaller, or if they were equal.[1] + +bne is actually just a branch command in disguise. In the ARM assembly language family, any instruction can be executed conditionally. This means that the instruction is only run if the last comparison had a certain result. We will use this extensively later for interesting tricks, but in this case we use the ne suffix on the b command to mean 'only branch if the last comparison's result was that the values were not equal'. The ne suffix can be used on any command, as can several other (16 in all) conditions such as eq for equal and lt for less than. + +### 2 The All Together + +I mentioned briefly last time that the status LED can be turned off again by writing to an offset of 28 from the GPIO controller instead of 40 (i.e. str r1,[r0,#28]). Thus, you need to modify the code from OK01 to turn the LED on, run the wait code, turn it off, run the wait code again, and then include a branch back to the beginning. Note, it is not necessary to re-enable the output to GPIO 16, we need only do that once. If you're being efficient, which I strongly encourage, you should be able to reuse the value of r1. As with all lessons, a full solution to this can be found on the [download page][2]. Be careful to make sure all of your labels are unique. When you write wait1$: you cannot label another line wait1$. + +On my Raspberry Pi it flashes about twice a second. this could easily be altered by changing the value we set r2 to. However, unfortunately we can't precisely predict the speed this runs at. If you didn't manage to get this working see our trouble shooting page, otherwise, congratulations. + +In this lesson we've learnt two more assembly commands, sub and cmp, as well as learning about conditional execution in ARM. + +In the next lesson, [Lesson 3: OK03][3] we will evaluate how we're coding, and establish some standards so that we can reuse code, and if necessary, work with C or C++ code. + +-------------------------------------------------------------------------------- + +via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok02.html + +作者:[Robert Mullins][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://www.cl.cam.ac.uk/~rdm34 +[b]: https://github.com/lujun9972 +[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html +[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/downloads.html +[3]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok03.html From 700d20a872b7e4933c8a849147d47bb030d24e40 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 7 Jan 2019 14:28:28 +0800 Subject: [PATCH 230/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Computer=20Labora?= =?UTF-8?q?tory=20=E2=80=93=20Raspberry=20Pi:=20Lesson=203=20OK03?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...aboratory - Raspberry Pi- Lesson 3 OK03.md | 383 ++++++++++++++++++ 1 file changed, 383 insertions(+) create mode 100644 sources/tech/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md diff --git a/sources/tech/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md b/sources/tech/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md new file mode 100644 index 0000000000..c6724ff672 --- /dev/null +++ b/sources/tech/20120203 Computer Laboratory - Raspberry Pi- Lesson 3 OK03.md @@ -0,0 +1,383 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 3 OK03) +[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok03.html) +[#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) + +Computer Laboratory – Raspberry Pi: Lesson 3 OK03 +====== + +The OK03 lesson builds on OK02 by teaching how to use functions in assembly to make more reusable and rereadable code. It is assumed you have the code for the [Lesson 2: OK02][1] operating system as a basis. + +### 1 Reusable Code + +So far we've made code for our operating system by typing the things we want to happen in order. This is fine for such tiny programs, but if we wrote the whole system like this, the code would be completely unreadable. Instead we use functions. + +``` +A function is a piece of code that can be reused to compute a certain kind of answer, or perform a certain action. You may also hear them called procedures, routines or subroutines. Although these are all different, people rarely use the correct term. + +You should already be happy with the concept of a function from mathematics. For example the cosine function applied to a number gives another number between -1 and 1 which is the cosine of the angle. Notationally we write cos(x) to be the cosine function applied to the value x. + +In code, functions can take multiple inputs (including none), give multiple outputs (including none), and may cause side effects. For example a function might create a file on the file system, named after the first input, with length based on the second. +``` + +![Function as black boxes][2] + +``` +Functions are said to be 'black boxes'. We put inputs in, and outputs come out, but we don't need to know how they work. +``` + +In higher level code such as C or C++, functions are part of the language itself. In assembly code, functions are just ideas we have. + +Ideally we want to be able to set our registers to some input values, branch to an address, and expect that at some point the code will branch back to our code having set the registers to output values. This is what a function is in assembly code. The difficulty comes in what system we use for setting the registers. If we just used any system we felt like, each programmer may use a different system, and would find other programmers' work hard to understand. Further, compilers would not be able to work with assembly code as easily, as they would not know how to use the functions. To prevent confusion, a standard called the Application Binary Interface (ABI) was devised for each assembly language which is an agreement on how functions should be run. If everyone makes functions in the same way, then everyone will be able to use each others' functions. I will teach that standard here, and from now on I will code all of my functions to meet the standard. + +The standard says that r0,r1,r2 and r3 will be used as inputs to a function in order. If a function needs no inputs, then it doesn't matter what value it takes. If it needs only one it always goes in r0, if it needs two, the first goes in r0, and the second goes on r1, and so on. The output will always be in r0. If a function has no output, it doesn't matter what value r0 takes. + +Further, it also requires that after a function is run, r4 to r12 must have the same values as they had when the function started. This means that when you call a function, you can be sure the r4 to r12 will not change value, but you cannot be so sure about r0 to r3. + +When a function completes it has to branch back to the code that started it. This means it must know the address of the code that started it. To facilitate this, there is a special register called lr (link register) which always holds the address of the instruction after the one that called this function. + +Table 1.1 ARM ABI register usage +| Register | Brief | Preserved | Rules | +| -------- | ------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| r0 | Argument and result | No | r0 and r1 are used for passing the first two arguments to functions, and returning the results of functions. If a function does not use them for a return value, they can take any value after a function. | +| r1 | Argument and result | No | | +| r2 | Argument | No | r2 and r3 are used for passing the second two arguments to functions. There values after a function is called can be anything. | +| r3 | Argument | No | | +| r4 | General purpose | Yes | r4 to r12 are used for working values, and their value after a function is called must be the same as before. | +| r5 | General purpose | Yes | | +| r6 | General purpose | Yes | | +| r7 | General purpose | Yes | | +| r8 | General purpose | Yes | | +| r9 | General purpose | Yes | | +| r10 | General purpose | Yes | | +| r11 | General purpose | Yes | | +| r12 | General purpose | Yes | | +| lr | Return address | No | lr is the address to branch back to when a function is finished, but this does have to contain the same address after the function has finished. | +| sp | Stack pointer | Yes | sp is the stack pointer, described below. Its value must be the same after the function has finished. | + +Often functions need to use more registers than just r0 to r3. But, since r4 to r12 must stay the same after the method has run, they must be saved somewhere. We save them on something called the stack. + + +![Stack diagram][3] +``` +A stack is a metaphor we use in computing for a method of storing values. Just like in a stack of plates, you can only remove items from the top of a stack, and only add items to the top of the stack. + +The stack is a brilliant idea for storing registers on when functions are running. For example if I have a function which needs to use registers r4 and r5, it could place the current values of those registers on a stack. At the end of the method it could take them back off again. What is most clever is that if my function had to run another function in order to complete and that function needed to save some registers, it could put those on the top of the stack while it ran, and then take them off again at the end. That wouldn't affect the values of r4 and r5 that my method had to save, as they would be added to the top of the stack, and then taken off again. + +The terminology we used to refer to the values put on the stack by a particular method is that methods 'stack frame'. Not every method needs a stack frame, some don't need to store values. +``` + +Because the stack is so useful, it has been implemented in the ARMv6 instruction set directly. A special register called sp (stack pointer) holds the address of the stack. When items are added to the stack, the sp register updates so that it always holds the address of the first item on the stack. push {r4,r5} would put the values in r4 and r5 onto the top of the stack and pop {r4,r5} would take them back off again (in the correct order). + +### 2 Our First Function + +Now that we have some idea about how functions work, let's try to make one. For a basic first example, we are going to make a function that takes no input, and gives an output of the GPIO address. In the last lesson, we just wrote in this value, but it would be better as a function, since it is something we might need to do often in a real operating system, and we might not always remember the address. + +Copy the following code into a new file called 'gpio.s'. Just make the new file in the 'source' directory with 'main.s'. We're going to put all functions related to the GPIO controller in one file to make them easier to find. + +``` +.globl GetGpioAddress +GetGpioAddress: +ldr r0,=0x20200000 +mov pc,lr +``` + +``` +.globl lbl makes the label lbl accessible from other files. + +mov reg1,reg2 copies the value in reg2 into reg1. +``` + +This is a very simple complete function. The .globl GetGpioAddress command is a message to the assembler to make the label GetGpioAddress accessible to all files. This means that in our main.s file we can branch to the label GetGpioAddress even though it is not defined in that file. + +You should recognise the ldr r0,=0x20200000 command, which stores the GPIO controller address in r0. Since this is a function, we have to give the output in r0, so we are not as free to use any register as we once were. + +mov pc,lr copies the value in lr to pc. As mentioned earlier lr always contains the address of the code that we have to go back to when a method finishes. pc is a special register which always contains the address of the next instruction to be run. A normal branch command just changes the value of this register. By copying the value in lr to pc we just change the next line to be run to be the one we were told to go back to. + +A reasonable question would now be, how would we actually run this code? A special type of branch bl does what we need. It branches to a label like a normal branch, but before it does it updates lr to contain the address of the line after the branch. That means that when the function finishes, the line it will go back to will be the one after the bl command. This makes a function running just look like any other command, it simply runs, does whatever it needs to do, and then carries on to the next line. This is a really useful way of thinking about functions. We treat them as 'black boxes' in that when we use them, we don't need to think about how they work, we just need to know what inputs they need, and what outputs they give. + +For now, don't worry about using the function, we will use it in the next section. + +### 3 A Big Function + +Now we're going to implement a bigger function. Our first job was to enable output on GPIO pin 16. It would be nice if this was a function. We could simply specify a pin and a function as the input, and the function would set the function of that pin to that value. That way, we could use the code to control any GPIO pin, not just the LED. + +Copy the following commands below the GetGpioAddress function in gpio.s. + +``` +.globl SetGpioFunction +SetGpioFunction: +cmp r0,#53 +cmpls r1,#7 +movhi pc,lr +``` + +``` +Suffix ls causes the command to be executed only if the last comparison determined that the first number was less than or the same as the second. Unsigned. + +Suffix hi causes the command to be executed only if the last comparison determined that the first number was higher than the second. Unsigned. +``` + +One of the first things we should always think about when writing functions is our inputs. What do we do if they are wrong? In this function, we have one input which is a GPIO pin number, and so must be a number between 0 and 53, since there are 54 pins. Each pin has 8 functions, numbered 0 to 7 and so the function code must be too. We could just assume that the inputs will be correct, but this is very dangerous when working with hardware, as incorrect values could cause very bad side effects. Therefore, in this case, we wish to make sure the inputs are in the right ranges. + +To do this we need to check that r0 <= 53 and r1 <= 7. First of all, we can use the comparison we've seen before to compare the value of r0 with 53. The next instruction, cmpls is a normal comparison instruction that will only be run if r0 was lower than or the same as 53. If that was the case, it compares r1 with 7, otherwise the result of the comparison is the same as before. Finally we go back to the code that ran the function if the result of the last comparison was that the register was higher than the number. + +The effect of this is exactly what we want. If r0 was bigger than 53, then the cmpls command doesn't run, but the movhi does. If r0 is <= 53, then the cmpls command does run, and so r1 is compared with 7, and then if it is higher than 7, movhi is run, and the function ends, otherwise movhi does not run, and we know for sure that r0 <= 53 and r1 <= 7. + +There is a subtle difference between the ls (lower or same) and le (less or equal) as well as between hi (higher) and gt (greater) suffixes, but I will cover this later. + +Copy these commands below the above. + +``` +push {lr} +mov r2,r0 +bl GetGpioAddress +``` + +``` +push {reg1,reg2,...} copies the registers in the list reg1,reg2,... onto the top of the stack. Only general purpose registers and lr can be pushed. + +bl lbl sets lr to the address of the next instruction and then branches to the label lbl. +``` + +These next three commands are focused on calling our first method. The push {lr} command copies the value in lr onto the top of the stack, so that we can retrieve it later. We must do this because when we call GetGpioAddress, we will need to use lr to store the address to come back to in our function. + +If we did not know anything about the GetGpioAddress function, we would have to assume it changes r0,r1,r2 and r3, and would have to move our values to r4 and r5 to keep them the same after it finishes. Fortunately, we do know about GetGpioAddress, and we know it only changes r0 to the address, it doesn't affect r1,r2 or r3. Thus, we only have to move the GPIO pin number out of r0 so it doesn't get overwritten, but we know we can safely move it to r2, as GetGpioAddress doesn't change r2. + +Finally we use the bl instruction to run GetGpioAddress. Normally we use the term 'call' for running a function, and I will from now. As discussed earlier bl calls a function by updating the lr to the next instruction's address, and then branching to the function. + +When a function ends we say it has 'returned'. When the call to GetGpioAddress returns, we now know that r0 contains the GPIO address, r1 contains the function code and r2 contains the GPIO pin number. I mentioned earlier that the GPIO functions are stored in blocks of 10, so first we need to determine which block of ten our pin number is in. This sounds like a job we would use a division for, but divisions are very slow indeed, so it is better for such small numbers to do repeated subtraction. + +Copy the following code below the above. + +``` +functionLoop$: + +cmp r2,#9 +subhi r2,#10 +addhi r0,#4 +bhi functionLoop$ +``` + +``` +add reg,#val adds the number val to the contents of the register reg. +``` + +This simple loop code compares the pin number to 9. If it is higher than 9, it subtracts 10 from the pin number, and adds 4 to the GPIO Controller address then runs the check again. + +The effect of this is that r2 will now contain a number from 0 to 9 which represents the remainder of dividing the pin number by 10. r0 will now contain the address in the GPIO controller of this pin's function settings. This would be the same as GPIO Controller Address + 4 × (GPIO Pin Number ÷ 10). + +Finally, copy the following code below the above. + +``` +add r2, r2,lsl #1 +lsl r1,r2 +str r1,[r0] +pop {pc} +``` + +``` +Argument shift reg,lsl #val shifts the binary representation of the number in reg left by val before using it in the operation before. + +lsl reg,amt shifts the binary representation of the number in reg left by the number in amt. + +str reg,[dst] is the same as str reg,[dst,#0]. + +pop {reg1,reg2,...} copies the values from the top of the stack into the register list reg1,reg2,.... Only general purpose registers and pc can be popped. +``` + +This code finishes off the method. The first line is actually a multiplication by 3 in disguise. Multiplication is a big and slow instruction in assembly code, as the circuit can take a long time to come up with the answer. It is much faster sometimes to use some instructions which can get the answer quicker. In this case, I know that r2 × 3 is the same as r2 × 2 + r2. It is very easy to multiply a register by 2 as this is conveniently the same as shifting the binary representation of the number left by one place. + +One of the very useful features of the ARMv6 assembly code language is the ability to shift an argument before using it. In this case, I add r2 to the result of shifting the binary representation of r2 to the left by one place. In assembly code, you often use tricks such as this to compute answers more easily, but if you're uncomfortable with this, you could also write something like mov r3,r2; add r2,r3; add r2,r3. + +Now we shift the function value left by a number of places equal to r2. Most instructions such as add and sub have a variant which uses a register rather than a number for the amount. We perform this shift because we want to set the bits that correspond to our pin number, and there are three bits per pin. + +We then store the the computed function value at the address in the GPIO controller. We already worked out the address in the loop, so we don't need to store it at an offset like we did in OK01 and OK02. + +Finally, we can return from this method call. Since we pushed lr onto the stack, if we pop pc, it will copy the value that was in lr at the time we pushed it into pc. This would be the same as having used mov pc,lr and so the function call will return when this line is run. + +The very keen may notice that this function doesn't actually work correctly. Although it sets the function of the GPIO pin to the requested value, it causes all the pins in the same block of 10's functions to go back to 0! This would likely be quite annoying in a system which made heavy use of the GPIO pins. I leave it as a challenge to the interested to fix this function so that it does not overwrite other pins values by ensuring that all bits other than the 3 that must be set remain the same. A solution to this can be found on the downloads page for this lesson. Functions that you may find useful are and which computes the Boolean and function of two registers, mvns which computes the Boolean not and orr which computes the Boolean or. + +### 4 Another Function + +So, we now have a function which takes care of the GPIO pin function setting. We now need to make a function to turn a GPIO pin on or off. Rather than having one function for off and one function for on, it would be handy to have a single function which does either. + +We will make a function called SetGpio which takes a GPIO pin number as its first input in r0, and a value as its second in r1. If the value is 0 we will turn the pin off, and if it is not zero we will turn it on. + +Copy and paste the following code at the end of 'gpio.s'. + +``` +.globl SetGpio +SetGpio: +pinNum .req r0 +pinVal .req r1 +``` + +``` +alias .req reg sets alias to mean the register reg. +``` + +Once again we need the .globl command and the label to make the function accessible from other files. This time we're going to use register aliases. Register aliases allow us to use a name other than just r0 or r1 for registers. This may not be so important now, but it will prove invaluable when writing big methods later, and you should try to use aliases from now on. pinNum .req r0 means that pinNum now means r0 when used in instructions. + +Copy and paste the following code after the above. + +``` +cmp pinNum,#53 +movhi pc,lr +push {lr} +mov r2,pinNum +.unreq pinNum +pinNum .req r2 +bl GetGpioAddress +gpioAddr .req r0 +``` + +``` +.unreq alias removes the alias alias. +``` + +Like in SetGpioFunction the first thing we must do is check that we were actually given a valid pin number. We do this in exactly the same way by comparing pinNum (r0) with 53, and returning immediately if it is higher. Once again we wish to call GetGpioAddress, so we have to preserve lr by pushing it onto the stack, and to move pinNum to r2. We then use the .unreq statement to remove our alias from r0. Since the pin number is now stored in r2 we want our alias to reflect this, so we remove the alias from r0 and remake it on r2. You should always .unreq every alias as soon as it is done with, so that you cannot make the mistake of using it further down the code when it no longer exists. + +We then call GetGpioAddress, and we create an alias for r0 to reflect this. + +Copy and paste the following code after the above. + +``` +pinBank .req r3 +lsr pinBank,pinNum,#5 +lsl pinBank,#2 +add gpioAddr,pinBank +.unreq pinBank +``` + +``` +lsr dst,src,#val shifts the binary representation of the number in src right by val, but stores the result in dst. +``` + +The GPIO controller has two sets of 4 bytes each for turning pins on and off. The first set in each case controls the first 32 pins, and the second set controls the remaining 22. In order to determine which set it is in, we need to divide the pin number by 32. Fortunately this is very easy, at is the same as shifting the binary representation of the pin number right by 5 places. Hence, in this case I've named r3 as pinBank and then computed pinNum ÷ 32. Since it is a set of 4 bytes, we then need to multiply the result of this by 4. This is the same as shifting the binary representation left by 2 places, which is the command that follows. You may wonder if we could just shift it right by 3 places, as we went right then left. This won't work however, as some of the answer may have been rounded away when we did ÷ 32 which may not be if we just ÷ 8. + +The result of this is that gpioAddr now contains either 2020000016 if the pin number is 0-31, and 2020000416 if the pin number is 32-53. This means if we add 2810 we get the address for turning the pin on, and if we add 4010 we get the address for turning the pin off. Since we are done with pinBank, I use .unreq immediately afterwards. + +Copy and paste the following code after the above. + +``` +and pinNum,#31 +setBit .req r3 +mov setBit,#1 +lsl setBit,pinNum +.unreq pinNum +``` + +``` +and reg,#val computes the Boolean and function of the number in reg with val. +``` + +This next part of the function is for generating a number with the correct bit set. For the GPIO controller to turn a pin on or off, we give it a number with a bit set in the place of the remainder of that pin's number divided by 32. For example, to set pin 16, we need a number with the 16th bit a 1. To set pin 45 we would need a number with the 13th bit 1 as 45 ÷ 32 = 1 remainder 13. + +The and command computes the remainder we need. How it does this is that the result of an and operation is a number with 1s in all binary digits which had 1s in both of the inputs, and 0s elsewhere. This is a fundamental binary operation, and is very quick. We have given it inputs of pinNum and 3110 = 111112. This means that the answer can only have 1 bits in the last 5 places, and so is definitely between 0 and 31. Specifically it only has 1s where there were 1s in pinNum's last 5 places. This is the same as the remainder of a division by 32. It is no coincidence that 31 = 32 - 1. + +![binary division example][4] + +The rest of this code simply uses this value to shift the number 1 left. This has the effect of creating the binary number we need. + +Copy and paste the following code after the above. + +``` +teq pinVal,#0 +.unreq pinVal +streq setBit,[gpioAddr,#40] +strne setBit,[gpioAddr,#28] +.unreq setBit +.unreq gpioAddr +pop {pc} +``` + +``` +teq reg,#val checks if the number in reg is equal to val. +``` + +This code ends the method. As stated before, we turn the pin off if pinVal is zero, and on otherwise. teq (test equal) is another comparison operation that can only be used to test for equality. It is similar to cmp but it does not work out which number is bigger. If all you wish to do is test if to numbers are the same, you can use teq. + +If pinVal is zero, we store the setBit at 40 away from the GPIO address, which we already know turns the pin off. Otherwise we store it at 28, which turns the pin on. Finally, we return by popping the pc, which sets it to the value that we stored when we pushed the link register. + +### 5 A New Beginning + +Finally, after all that work we have our GPIO functions. We now need to alter 'main.s' to use them. Since 'main.s' is now getting a lot bigger and more complicated, it is better design to split it into two sections. The '.init' we've been using so far is best kept as small as possible. We can change the code to reflect this easily. + +Insert the following just after _start: in main.s: + +``` +b main + +.section .text +main: +mov sp,#0x8000 +``` + +The key change we have made here is to introduce the .text section. I have designed the makefile and linker scripts such that code in the .text section (which is the default section) is placed after the .init section which is placed at address 800016. This is the default load address and gives us some space to store the stack. As the stack exists in memory, it has to have an address. The stack grows down memory, so that each new value is at a lower address, thus making the 'top' of the stack, the lowest address. + +``` +The 'ATAGs' section in the diagram is a place where information about the Raspberry Pi is stored such as how much memory it has, and what its default screen resolution is. +``` + +![Layout diagram of operating system][5] + +Replace all the code that set the function of the GPIO pin with the following: + +``` +pinNum .req r0 +pinFunc .req r1 +mov pinNum,#16 +mov pinFunc,#1 +bl SetGpioFunction +.unreq pinNum +.unreq pinFunc +``` + +This code calls SetGpioFunction with the pin number 16 and the pin function code 1. This has the effect of enabling output to the OK LED. + +Replace any code which turns the OK LED on with the following: + +``` +pinNum .req r0 +pinVal .req r1 +mov pinNum,#16 +mov pinVal,#0 +bl SetGpio +.unreq pinNum +.unreq pinVal +``` + +This code uses SetGpio to turn off GPIO pin 16, thus turning on the OK LED. If we instead used mov pinVal,#1, it would turn the LED off. Replace your old code to turn the LED off with that. + +### 6 Onwards + +Hopefully now, you should be able to test what you have made on the Raspberry Pi. We've done a large amount of code this time, so there is a lot that can go wrong. If it does, head to the troubleshooting page. + +When you get it working, congratulations. Although our operating system does nothing more than it did in [Lesson 2: OK02][1], we've learned a lot about functions and formatting, and we can now code new features much more quickly. It would be very simple now to make an Operating System that alters any GPIO register, which could be used to control hardware! + +In [Lesson 4: OK04][6], we will address our wait function, which is currently imprecise, so that we can gain better control over our LED, and ultimately over all of the GPIO pins. + +-------------------------------------------------------------------------------- + +via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok03.html + +作者:[Robert Mullins][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://www.cl.cam.ac.uk/~rdm34 +[b]: https://github.com/lujun9972 +[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok02.html +[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/functions.png +[3]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/stack.png +[4]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/binary3.png +[5]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/osLayout.png +[6]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok04.html From 4352a239aa23038e8b1493eddfd14f0953aaa211 Mon Sep 17 00:00:00 2001 From: dianbanjiu Date: Mon, 7 Jan 2019 15:32:11 +0800 Subject: [PATCH 231/322] translating --- ...asy Way To Remove Programs Installed From Source In Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md b/sources/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md index 7e3378b4e3..1d3f35beaf 100644 --- a/sources/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md +++ b/sources/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: ( dianbanjiu ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 6c8a667cbd1cafaf243b0428b4ea79a9277a6b70 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 7 Jan 2019 15:59:53 +0800 Subject: [PATCH 232/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Computer=20Labora?= =?UTF-8?q?tory=20=E2=80=93=20Raspberry=20Pi:=20Lesson=204=20OK04?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...aboratory - Raspberry Pi- Lesson 4 OK04.md | 161 ++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 sources/tech/20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md diff --git a/sources/tech/20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md b/sources/tech/20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md new file mode 100644 index 0000000000..00fe349914 --- /dev/null +++ b/sources/tech/20120204 Computer Laboratory - Raspberry Pi- Lesson 4 OK04.md @@ -0,0 +1,161 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 4 OK04) +[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok04.html) +[#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) + +Computer Laboratory – Raspberry Pi: Lesson 4 OK04 +====== + +The OK04 lesson builds on OK03 by teaching how to use the timer to flash the 'OK' or 'ACT' LED at precise intervals. It is assumed you have the code for the [Lesson 3: OK03][1] operating system as a basis. + +### 1 A New Device + +The timer is the only way the Pi can keep time. Most computers have a battery powered clock to keep time when off. + +So far, we've only looked at one piece of hardware on the Raspberry Pi, namely the GPIO Controller. I've simply told you what to do, and it happened. Now we're going to look at the timer, and I'm going to lead you through understanding how it works. + +Just like the GPIO Controller, the timer has an address. In this case, the timer is based at 2000300016. Reading the manual, we find the following table: + +Table 1.1 GPIO Controller Registers +| Address | Size / Bytes | Name | Description | Read or Write | +| -------- | ------------ | ---------------- | ---------------------------------------------------------- | ---------------- | +| 20003000 | 4 | Control / Status | Register used to control and clear timer channel comparator matches. | RW | +| 20003004 | 8 | Counter | A counter that increments at 1MHz. | R | +| 2000300C | 4 | Compare 0 | 0th Comparison register. | RW | +| 20003010 | 4 | Compare 1 | 1st Comparison register. | RW | +| 20003014 | 4 | Compare 2 | 2nd Comparison register. | RW | +| 20003018 | 4 | Compare 3 | 3rd Comparison register. | RW | + +![Flowchart of the system timer's operation][2] + +This table tells us a lot, but the descriptions in the manual of the various fields tell us the most. The manual explains that the timer fundamentally just increments the value in Counter by 1 every 1 micro second. Each time it does so, it compares the lowest 32 bits (4 bytes) of the counter's value with the 4 comparison registers, and if it matches any of them, it updates Control / Status to reflect which ones matched. + +For more information about bits, bytes, bit fields, and data sizes expand the box below. + +``` +A bit is a name for a single binary digit. As you may recall, a single binary digit is either a 1 or a 0. + +A byte is the name we give for a collection of 8 bits. Since each bit can be one of two values, there are 28 = 256 different possible values for a byte. We normally interpret a byte as a binary number between 0 and 255 inclusive. + +![Diagram of GPIO function select controller register 0.][3] + +A bit field is another way of interpreting binary. Rather than interpreting it as a number, binary can be interpreted as many different things. A bit field treats binary as a series of switches which are either on (1) or off (0). If we have a meaning for each of these little switches, we can use them to control things. We have actually already met bitfields with the GPIO controller, with the setting a pin on or off. The bit that was a 1 was the GPIO pin to actually turn on or off. Sometimes we need more options than just on or off, so we group several of the switches together, such as with the GPIO controller function settings (pictured), in which every group of 3 bits controls one GPIO pin function. +``` + +Our goal is to implement a function that we can call with an amount of time as an input that will wait for that amount of time and then return. Think for a moment about how we could do this, given what we have. + +I see there being two options: + + 1. Read a value from the counter, and then keep branching back into the same code until the counter is the amount of time to wait more than it was. + 2. Read a value from the counter, add the amount of time to wait, store this in one of the comparison registers and then keep branching back into the same code until the Control / Status register updates. + + +``` +Issues like these are called concurrency problems, and can be almost impossible to fix. +``` + +Both of these strategies would work fine, but in this tutorial we will only implement the first. The reason is because the comparison registers are more likely to go wrong, as during the time it takes to add the wait time and store it in the comparison register, the counter may have increased, and so it would not match. This could lead to very long unintentional delays if a 1 micro second wait is requested (or worse, a 0 microsecond wait). + +### 2 Implementation + +``` +Large Operating Systems normally use the Wait function as an opportunity to perform background tasks. +``` + +I will largely leave the challenge of creating the ideal wait method to you. I suggest you put all code related to the timer in a file called 'systemTimer.s' (for hopefully obvious reasons). The complicated part about this method, is that the counter is an 8 byte value, but each register only holds 4 bytes. Thus, the counter value will span two registers. + +The following code blocks are examples. + +``` +ldrd r0,r1,[r2,#4] +``` + +``` +ldrd regLow,regHigh,[src,#val] loads 8 bytes from the address given by the number in src plus val into regLow and regHigh . +``` + +An instruction you may find useful is the ldrd instruction above. It loads 8 bytes of memory across 2 registers. In this case, the 8 bytes of memory starting at the address in r2 would be copied into r0 and r1. What is slightly complicated about this arrangement is that r1 actually holds the highest 4 bytes. In other words, if the counter had a value of 999,999,999,99910 = 11101000110101001010010100001111111111112, r1 would contain 111010002 and r0 would contain 110101001010010100001111111111112. + +The most sensible way to implement this would be to compute the difference between the current counter value and the one from when the method started, and then to compare this with the requested amount of time to wait. Conveniently, unless you wish to support wait times that were 8 bytes, the value in r1 in the example above could be discarded, and only the low 4 bytes of the counter need be used. + +When waiting you should always be sure to use higher comparisons not equality comparisons, as if you try to wait for the gap between the time the method started and the time it ends to be exactly the amount requested, you could miss the value, and wait forever. + +If you cannot figure out how to code the wait function, expand the box below for a guide. + +``` +Borrowing the idea from the GPIO controller, the first function we should write should be to get the address of this system timer. An example of this is shown below: + +.globl GetSystemTimerBase +GetSystemTimerBase: +ldr r0,=0x20003000 +mov pc,lr + +Another function that will prove useful would be one that returns the current counter value in registers r0 and r1: + +.globl GetTimeStamp +GetTimeStamp: +push {lr} +bl GetSystemTimerBase +ldrd r0,r1,[r0,#4] +pop {pc} + +This function simply uses the GetSystemTimerBase function and loads in the counter value using ldrd like we have just learned. + +Now we actually want to code our wait method. First of all, we need to know the counter value when the method started, which we can now get using GetTimeStamp. + +delay .req r2 +mov delay,r0 +push {lr} +bl GetTimeStamp +start .req r3 +mov start,r0 + +This code copies our method's input, the amount of time to delay, into r2, and then calls GetTimeStamp, which we know will return the current counter value in r0 and r1. It then copies the lower 4 bytes of the counter's value to r3. + +Next we need to compute the difference between the current counter value and the reading we just took, and then keep doing so until the gap between them is at least the size of delay. + +loop$: + +bl GetTimeStamp +elapsed .req r1 +sub elapsed,r0,start +cmp elapsed,delay +.unreq elapsed +bls loop$ + +This code will wait until the requested amount of time has passed. It takes a reading from the counter, subtracts the initial value from this reading and then compares that to the requested delay. If the amount of time that has elapsed is less than the requested delay, it branches back to loop$. + +.unreq delay +.unreq start +pop {pc} + +This code finishes off the function by returning. +``` + +### 3 Another Blinking Light + +Once you have what you believe to be a working wait function, change 'main.s' to use it. Alter everywhere you wait to set the value of r0 to some big number (remember it is in microseconds) and then test it on the Raspberry Pi. If it does not function correctly please see our troubleshooting page. + +Once it is working, congratulations you have now mastered another device, and with it, time itself. In the next and final lesson in the OK series, [Lesson 5: OK05][4] we shall use all we have learned to flash out a pattern on the LED. + +-------------------------------------------------------------------------------- + +via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok04.html + +作者:[Robert Mullins][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://www.cl.cam.ac.uk/~rdm34 +[b]: https://github.com/lujun9972 +[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok03.html +[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/systemTimer.png +[3]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/gpioControllerFunctionSelect.png +[4]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok05.html From 6188288bbe7ec922f9eb82f5ff3bbc3950488135 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 7 Jan 2019 16:03:06 +0800 Subject: [PATCH 233/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Computer=20Labora?= =?UTF-8?q?tory=20=E2=80=93=20Raspberry=20Pi:=20Lesson=205=20OK05?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...aboratory - Raspberry Pi- Lesson 5 OK05.md | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 sources/tech/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md diff --git a/sources/tech/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md b/sources/tech/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md new file mode 100644 index 0000000000..9eb5bf6f93 --- /dev/null +++ b/sources/tech/20120205 Computer Laboratory - Raspberry Pi- Lesson 5 OK05.md @@ -0,0 +1,108 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 5 OK05) +[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok05.html) +[#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) + +Computer Laboratory – Raspberry Pi: Lesson 5 OK05 +====== + +The OK05 lesson builds on OK04 using it to flash the SOS Morse Code pattern (...---...). It is assumed you have the code for the [Lesson 4: OK04][1] operating system as a basis. + +### 1 Data + +So far, all we've had to do with our operating system is provide instructions to be followed. Sometimes however, instructions are only half the story. Our operating systems may need data. + +``` +Some early Operating Systems did only allow certain types of data in certain files, but this was generally found to be too restrictive. The modern way does make programs a lot more complicated however. +``` + +In general data is just values that are important. You are probably trained to think of data as being of a specific type, e.g. a text file contains text, an image file contains an image, etc. This is, in truth, just an idea. All data on a computer is just binary numbers, how we choose to interpret them is what counts. In this example we're going to store a light flashing sequence as data. + +At the end of 'main.s' copy the following code: + +``` +.section .data +.align 2 +pattern: +.int 0b11111111101010100010001000101010 +``` + +``` +.align num ensures the address of the next line is a multiple of 2num . + +.int val outputs the number val . +``` + +To differentiate between data and code, we put all the data in the .data. I've included this on the operating system memory layout diagram here. I've just chosen to put the data after the end of the code. The reason for keeping our data and instructions separate is so that if we eventually implement some security on our operating system, we need to know what parts of the code can be executed, and what parts can't. + +I've used two new commands here. .align and .int. .align ensures alignment of the following data to a specified power of 2. In this case I've used .align 2 which means that this data will definitely be placed at an address which is a multiple of 22 = 4. It is really important to do this, because the ldr instruction we used to read memory only works at addresses that are multiples of 4. + +The .int command copies the constant after it into the output directly. That means that 111111111010101000100010001010102 will be placed into the output, and so the label pattern actually labels this piece of data as pattern. + +``` +One challenge with data is finding an efficient and useful representation. This method of storing the sequence as on and off units of time is easy to run, but would be difficult to edit, as the concept of a Morse - or . is lost. +``` + +As I mentioned, data can mean whatever you want. In this case I've encoded the Morse Code SOS sequence, which is ...---... for those unfamiliar. I've used a 0 to represent a unit of time with the LED off, and a 1 to represent a unit of time with the LED on. That way, we can write some code which just displays a sequence in data like this one, and then all we have to do to make it display a different sequence is change the data. This is a very simple example of what operating systems must do all the time; interpret and display data. + +Copy the following lines before the loop$ label in 'main.s'. + +``` +ptrn .req r4 +ldr ptrn,=pattern +ldr ptrn,[ptrn] +seq .req r5 +mov seq,#0 +``` + +This code loads the pattern into r4, and loads 0 into r5. r5 will be our sequence position, so we can keep track of how much of the pattern we have displayed. + +The following code puts a non-zero into r1 if and only if there is a 1 in the current part of the pattern. + +``` +mov r1,#1 +lsl r1,seq +and r1,ptrn +``` + +This code is useful for your calls to SetGpio, which must have a non-zero value to turn the LED off, and a value of zero to turn the LED on. + +Now modify all of your code in 'main.s' so that each loop the code sets the LED based on the current sequence number, waits for 250000 micro seconds (or any other appropriate delay), and then increments the sequence number. When the sequence number reaches 32, it needs to go back to 0. See if you can implement this, and for an extra challenge, try to do it using only 1 instruction (solution in the download). + +### 2 Time Flies When You're Having Fun... + +You're now ready to test this on the Raspberry Pi. It should flash out a sequence of 3 short pulses, 3 long pulses and then 3 more short pulses. After a delay, the pattern should repeat. If it doesn't work please see our troubleshooting page. + +Once it works, congratulations you have reached the end of the OK series of tutorials. + +In this series we've learnt about assembly code, the GPIO controller and the System Timer. We've learnt about functions and the ABI, as well as several basic Operating System concepts, and also about data. + +You're now ready to move onto one of the more advanced series. + + * The [Screen][2] series is next and teaches you how to use the screen with assembly code. + * The [Input][3] series teaches you how to use the keyboard and mouse. + + + +By now you already have enough information to make Operating Systems that interact with the GPIO in other ways. If you have any robot kits, you may want to try writing a robot operating system controlled with the GPIO pins! + +-------------------------------------------------------------------------------- + +via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok05.html + +作者:[Robert Mullins][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://www.cl.cam.ac.uk/~rdm34 +[b]: https://github.com/lujun9972 +[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok04.html +[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen01.html +[3]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/input01.html From 13dba92b6989f3f4dad649edeebba95df12a3b22 Mon Sep 17 00:00:00 2001 From: guevaraya Date: Mon, 7 Jan 2019 19:26:56 +0800 Subject: [PATCH 234/322] Linux/Unix App For Prevention Of RSI (Repetitive Strain Injury) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 申请翻译 --- ...Unix App For Prevention Of RSI (Repetitive Strain Injury).md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md b/sources/tech/20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md index 0adea8a54c..989f54d45a 100644 --- a/sources/tech/20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md +++ b/sources/tech/20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md @@ -1,3 +1,5 @@ +Translating By Guevaraya + Linux/Unix App For Prevention Of RSI (Repetitive Strain Injury) ====== ![workrave-image][1] From 5f25c6e7d17f25ceefc4b9a31e2296ea2469ce82 Mon Sep 17 00:00:00 2001 From: "GJ.Zhang" Date: Mon, 7 Jan 2019 21:20:59 +0800 Subject: [PATCH 235/322] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit My Lisp Experiences and the Development of GNU Emacs --- ...40412 My Lisp Experiences and the Development of GNU Emacs.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/talk/20140412 My Lisp Experiences and the Development of GNU Emacs.md b/sources/talk/20140412 My Lisp Experiences and the Development of GNU Emacs.md index 7be913c3bf..60e1094af9 100644 --- a/sources/talk/20140412 My Lisp Experiences and the Development of GNU Emacs.md +++ b/sources/talk/20140412 My Lisp Experiences and the Development of GNU Emacs.md @@ -1,3 +1,4 @@ +zgj1024 is translating My Lisp Experiences and the Development of GNU Emacs ====== From 2f8ec07b2c67ed31dd92f208159f76e85801fa01 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 7 Jan 2019 22:27:00 +0800 Subject: [PATCH 236/322] PRF:20180703 10 killer tools for the admin in a hurry.md @bestony --- ...0 killer tools for the admin in a hurry.md | 70 ++++++++++--------- 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/translated/tech/20180703 10 killer tools for the admin in a hurry.md b/translated/tech/20180703 10 killer tools for the admin in a hurry.md index 8fc7d36474..82d1c4e33f 100644 --- a/translated/tech/20180703 10 killer tools for the admin in a hurry.md +++ b/translated/tech/20180703 10 killer tools for the admin in a hurry.md @@ -1,77 +1,79 @@ -10 个供管理员快速使用的杀手工具 +10 个供管理员救急的杀手级工具 ====== +> 可以让你赶快离开办公室的网络管理技巧和工具。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cloud_tools_hardware.png?itok=PGjJenqT) -当工作负载累计时,管理网络和系统变得富有压力。没有人能真正意识到需要花费多长时间,每个人都希望在昨天能够完成他们的具体事务。 +当工作任务堆积成山时,管理网络和系统就变得十分有压力了。没有人能真正意识到需要花费多长时间,每个人都希望在昨天就完成他们的工作。 所以难怪我们这么多人都被致力于找出有效的方法并与大家分享的开源精神所吸引。因为,当截止日期来临,并且当天没有足够多的时间时,如果你可以找到立刻施行的免费答案,那会非常有帮助。 -So, without further ado, here's my Swiss Army Knife of stuff to get you out of the office before dinner time. - 因此,闲话少叙,下述是我的瑞士军刀,可以保证你在晚饭前离开办公室。 ### 服务器配置和脚本 让我们看一看! -**[NixCraft][1]** -用于网站内部的搜索功能。经过十多年的定期更新,这里有黄金!有用的脚本和方便的提示可以立刻解决你的问题。这是我一般使用 Google 后的第二个选项。 +- [NixCraft][1] -**[Webmin][2]** -它提供给你了一个很好的 Web 界面来帮助你远程编辑配置问卷。它减少了大量花费在处理目录路径和 `sudo nano` 上的时间,在你处理多个客户时,非常方便。 + 使用该网站的搜索功能。经过十多年的定期更新,这里遍地是黄金!有用的脚本和方便的技巧可以立刻解决你的问题。这是我一般使用 Google 后的第二个选项。 -**[Windows 下的 Linux 子系统][3]** +- [Webmin][2] -现代工作场所的现实是大多数员工都运行着 Windows,而服务器机房中增长的设备则运行着 Linux 。因此,有些时候你会发现尝试在 Windows 桌面上执行管理任务。 + 它提供给你了一个很好的 Web 界面来帮助你远程编辑配置文件。它减少了在处理目录路径和 `sudo nano` 上花费的大量时间,在你处理多个客户时,非常方便。 -你怎么做?装一个虚拟机?如果安装目前 Windows 10 中免费提供的 Linux 子系统的兼容层,实际上要快得多,配置文件要少的多。 +- [Windows 下的 Linux 子系统][3] -这为你提供了一个 Bash 终端窗口,你可以在这个窗口中执行本地计算机上的 Bash 脚本和 Linux 二进制问卷,可以完全访问 Windows 和 Linux 问卷系统,以及安装网络驱动器。它包含 Ubuntu 、OpenSUSE、SLES、Debian和 Kali 发行版。 + 现代工作场所的现实是大多数员工都运行着 Windows,而服务器机房中不断增长的设备则运行着 Linux 。因此,有些时候你会发现尝试在 Windows 桌面上执行管理任务。 -**[mRemoteNG][4]** -当你有 100 + 服务器需要去管理时,这会是一个出色的 SSH 和远程桌面客户端。 + 你怎么做?装一个虚拟机?如果安装目前 Windows 10 中免费提供的 Linux 子系统的兼容层,实际上要快得多,配置要少的多。 + + 这为你提供了一个 Bash 终端窗口,你可以在这个窗口中执行本地计算机上的 Bash 脚本和 Linux 二进制文件,可以完全访问 Windows 和 Linux 文件系统,以及安装网络驱动器。它包含 Ubuntu 、OpenSUSE、SLES、Debian 和 Kali 发行版。 + +- [mRemoteNG][4] + + 当你有 100 多个服务器需要去管理时,这会是一个出色的 SSH 和远程桌面客户端。 ### 设置网络,这样你就无需再这样做了。 -一个考虑不周的网络是厌恶加班管理员的死敌。 +一个设计不周的网络是厌恶加班的管理员的死敌。 -**[可拓展的 IP 寻址方案][5]** +- [可拓展的 IP 寻址方案][5] -IP 地址耗尽的可怕之处在于,当 IP 地址耗尽时,网络已经变的足够大,而新的寻址方案是众所周知的昂贵、令人痛苦的耗时。 + IP 地址耗尽的可怕之处在于,当 IP 地址耗尽时,网络已经变的足够大,而新的寻址方案是众所周知的昂贵、令人痛苦的耗时。 -没有人有时间做这件事! + 没有人有时间做这件事! -到了某个时候,IPv6 终将到来,来拯救这世界。在那之前,无论世界向我们扔了多少可穿戴设备、平板电脑、智能锁、灯、安全摄像头、VoIP耳机和浓缩咖啡机,这些一刀切的IP 寻址方案都应该让我们继续前行。 + 到了某个时候,IPv6 终将到来,来拯救这世界。但在那之前,无论世界向我们扔了多少可穿戴设备、平板电脑、智能锁、灯、安全摄像头、VoIP 耳机和浓缩咖啡机,这些以不变应万变的 IP 寻址方案都应该让我们继续前行。 +- [Linux Chmod 权限备忘录][6] -**[Linux Chmod 权限备忘录][6]** + 一个简短但是有用的 Bash 命令备忘录可以帮助你通过网络设置权限。所以,客户服务部的账单落入到勒索软件骗局时,你可以只恢复他们的文件,而不是整个公司的文件。 -一个简短但是有用的 Bash 命令备忘录可以帮助你通过网络设置权限。所以,客户服务部的账单落入到勒索软件骗局时,你可以只恢复他们的文件,而不是整个公司的文件。 +- [VLSM 子网计算器][7] -**[VLSM 子网计算器][7]** - -只需要输入你想要从地址空间中创建的网络的数量,以及每个网络所需要的主机数量,它就可以计算出所有的子网掩码应该是什么。 + 只需要输入你想要从地址空间中创建的网络的数量,以及每个网络所需要的主机数量,它就可以计算出所有的子网掩码应该是什么。 ### 单一用途的 Linux 发行版 -需要一个只一件事的 Linux 容器?如果其他人已经在操作系统上花了很多钱,它可以帮助你快速安装并准备好一个操作系统。 +需要一个只做一件事的 Linux 容器?如果其他人已经在一个操作系统上搞好了一个小东西,你就可以快速安装它并马上投入使用。 下面这些每一个都使得我的工作变得轻松了许多。 -**[Porteus Kiosk][8]** -这个工具用来帮你在一台锁定的电脑上打开一个浏览器。通过稍稍一些调整,你甚至可以把浏览器锁定在一个特定的网站上。它对于公共访问机器来说非常方便。它可以与触摸屏或键盘鼠标配合使用。 +- [Porteus Kiosk][8] -**[Parted Magic][9]** -这是一个你可以从 USB 驱动器启动的可以用来划分磁盘驱动器、恢复数据并运行基准测试工具的操作系统。 + 这个工具用来帮你把一台电脑上锁定到一个浏览器上。通过稍稍一些调整,你甚至可以把浏览器锁定在一个特定的网站上。它对于公共访问机器来说非常方便。它可以与触摸屏或键盘鼠标配合使用。 -**[IPFire][10]** +- [Parted Magic][9] -啊哈~我还是不敢相信有人吧路由器/防火墙/代理组合成为“我尿火”(译者注:IPFire 和 “I pee Fire“ 同音)。这是我在这个 Linux 发行版中第二喜欢的东西。我最喜欢的是它是一个非常可靠的软件套件,设置和配置十分容易,而且有一系列的插件可以拓展它。 + 这是一个你可以从 USB 驱动器启动的,可以用来划分磁盘驱动器、恢复数据并运行基准测试工具的操作系统。 -那么,你呢?你发现了哪些工具、资源和备忘录可以让我们的工作日更加的轻松? +- [IPFire][10] -我很高兴知道,请在评论中分享您的工具。 + 啊哈~我还是不敢相信有人把路由器/防火墙/代理组合成为“我尿火”(LCTT 译注:IPFire 和 “I pee Fire“ 同音)。这是我在这个 Linux 发行版中第二喜欢的东西。我最喜欢的是它是一个非常可靠的软件套件,设置和配置十分容易,而且有一系列的插件可以拓展它。 + +那么,你呢?你发现了哪些工具、资源和备忘录可以让我们的工作日更加的轻松?我很高兴知道,请在评论中分享您的工具。 -------------------------------------------------------------------------------- @@ -80,7 +82,7 @@ via: https://opensource.com/article/18/7/tools-admin 作者:[Grant Hamono][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[bestony](https://github.com/bestony) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 28a84e33ee7b8322321e0f2b4bc9a4874aacbb15 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 7 Jan 2019 22:27:18 +0800 Subject: [PATCH 237/322] PUB:20180703 10 killer tools for the admin in a hurry.md @bestony https://linux.cn/article-10422-1.html --- .../20180703 10 killer tools for the admin in a hurry.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180703 10 killer tools for the admin in a hurry.md (100%) diff --git a/translated/tech/20180703 10 killer tools for the admin in a hurry.md b/published/20180703 10 killer tools for the admin in a hurry.md similarity index 100% rename from translated/tech/20180703 10 killer tools for the admin in a hurry.md rename to published/20180703 10 killer tools for the admin in a hurry.md From b52ab9f4649ef4a9137adabcb20f01049cb21de1 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 7 Jan 2019 23:28:22 +0800 Subject: [PATCH 238/322] PRF:20171227 YAML- probably not so great after all.md @MjSeven --- ...7 YAML- probably not so great after all.md | 132 +++++++++++------- 1 file changed, 78 insertions(+), 54 deletions(-) diff --git a/translated/tech/20171227 YAML- probably not so great after all.md b/translated/tech/20171227 YAML- probably not so great after all.md index a64cb1e43d..02c80a6a11 100644 --- a/translated/tech/20171227 YAML- probably not so great after all.md +++ b/translated/tech/20171227 YAML- probably not so great after all.md @@ -1,13 +1,13 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (YAML: probably not so great after all) [#]: via: (https://arp242.net/weblog/yaml_probably_not_so_great_after_all.html) [#]: author: (Martin Tournoij https://arp242.net/) -YAML: 可能并不是那么完美 +YAML:可能并不是那么完美 ====== 我之前写过[为什么将 JSON 用于人类可编辑的配置文件是一个坏主意][1],今天我们将讨论 YAML 格式的一些常见问题。 @@ -15,19 +15,21 @@ YAML: 可能并不是那么完美 ### 默认情况下不安全 YAML 默认是不安全的。加载用户提供的(不可信的)YAML 字符串需要仔细考虑。 + ``` !!python/object/apply:os.system args: ['ls /'] ``` 用 `print(yaml.load(open('a.yaml')))` 运行它,应该给你这样的东西: + ``` -bin etc lib lost+found opt root sbin tmp var sys -boot dev efi home lib64 mnt proc run srv usr +bin etc lib lost+found opt root sbin tmp var sys +boot dev efi home lib64 mnt proc run srv usr 0 ``` -许多其他语言(包括 Ruby 和 PHP)默认情况下(to 校正:这里应该说的是解析 yaml)也不安全。[在 GitHub 上搜索 `yaml.load`][2] 会得到惊人的 280 万个结果,而 [`yaml.safe_load`][3] 只能得到 26,000 个结果。 +许多其他语言(包括 Ruby 和 PHP [^1] )默认情况下也不安全(LCTT 译注:这里应该说的是解析 yaml)。[在 GitHub 上搜索 yaml.load][2] 会得到惊人的 280 万个结果,而 [yaml.safe_load][3] 只能得到 26000 个结果。 提个醒,很多这样的 `yaml.load()` 都工作的很好,在配置文件中加载 `yaml.load()` 通常没问题,因为它通常(虽然并不总是!)来自“可靠源”,而且很多都来自静态的 YAML 测试文件。但是,人们还是不禁怀疑在这 280 万个结果中隐藏了多少漏洞。 @@ -41,57 +43,60 @@ boot dev efi home lib64 mnt proc run srv usr YAML 文件可能很难编辑,随着文件变大,这个难度会快速增大。 -一个很好的例子是 Ruby on Rails 的翻译文件。(to 校正:这里 translation files 是什么?)例如: +一个很好的例子是 Ruby on Rails 的本地化翻译文件。例如: + ``` en: - formtastic: - labels: - title: "Title" # Default global value - article: - body: "Article content" - post: - new: - title: "Choose a title..." - body: "Write something..." - edit: - title: "Edit title" - body: "Edit body" + formtastic: + labels: + title: "Title" # Default global value + article: + body: "Article content" + post: + new: + title: "Choose a title..." + body: "Write something..." + edit: + title: "Edit title" + body: "Edit body" ``` -看起来不错,对吧?但是如果这个文件有 100 行怎么办?或者 1,000 行?在文件中很难看到 "where",因为它可能在屏幕外。你需要向上滚动,但是你需要跟踪缩进,即使使用缩进指南也很难,特别是因为 2 个缩进是常态而且 [tab 缩进被禁止][5]。 +看起来不错,对吧?但是如果这个文件有 100 行怎么办?或者 1,000 行?在文件中很难看到 “where”,因为它可能在屏幕外。你需要向上滚动,但是你需要跟踪缩进,即使遵循缩进指南也很难,特别是因为 2 个空格缩进是常态而且 [制表符缩进被禁止][5] [^2] 。 -不小心缩进出错通常不是一个错误,它通常只是反序列化为你不想要的东西。这样只能祝你调试快乐! +不小心缩进出错通常不算错误,它通常只是反序列化为你不想要的东西。这样只能祝你调试快乐! -我已经愉快地编写 Python 长达十多年,所以我已经习惯了显著的空白,但有时候我仍在和 YAML 抗争。在 Python 中,缺点和清晰度的丧失是由于没有那种长达几页的函数,但数据或配置文件的长度没有这种自然限制。(to 校正:这里不太明白为什么没有长达几页函数会导致 python 清晰度的丧失,或许我的翻译有问题) +我已经愉快地编写 Python 长达十多年,所以我已经习惯了显眼的空白,但有时候我仍在和 YAML 抗争。在 Python 中,虽然没有那种长达几页的函数,但数据或配置文件的长度没有这种自然限制,这就带来了缺点和损失了清晰度。 对于小文件,这不是问题,但它确实无法很好地扩展到较大的文件,特别是如果你以后想编辑它们的话。 ### 这非常复杂 -在浏览一个基本的例子时,YAML 看似“简单”和“显而易见”,但事实证明并非如此。[YAML 规范][6]有 23,449 个单词,为了比较,[TOML][7] 有 3,339 个单词,[Json][8] 有 1,969 个单词,[XML][9] 有 20,603 个单词。 +在浏览一个基本的例子时,YAML 看似“简单”和“显而易见”,但事实证明并非如此。[YAML 规范][6]有 23449 个单词,为了比较,[TOML][7] 有 3339 个单词,[Json][8] 有 1969 个单词,[XML][9] 有 20603 个单词。 -我们中有谁读过全部吗?有谁读过并理解了全部?谁阅读过,理解进而**记住**所有这些? +我们中有谁读过全部规范吗?有谁读过并理解了全部?谁阅读过,理解进而**记住**所有这些? -例如,你知道有[ 9 种方法在 YAML 中编写多行字符串][10]吗?并且它们具有细微的不同行为。 +例如,你知道[在 YAML 中编写多行字符串有 9 种方法][10]吗?并且它们具有细微的不同行为。 是的 :-/ -如果你看一下[它的修订历史][11],那篇文章就会变得更加有趣,因为文章的作者发现了越来越多的方法可以实现这一点,以及更多的细微之处。 +如果你看一下[那篇文章的修订历史][11],它就会变得更加有趣,因为文章的作者发现了越来越多的方法可以实现这一点,以及更多的细微之处。 -它从预览开始告诉我们 YANL 规范,它表明(强调我的): +它从预览开始告诉我们 YAML 规范,它表明(强调我的): -> 本节简要介绍了 YAML 的表达能力。**初次阅读的人不可能熟读所有的例子**。相反,这些选择用作规范其余部分的动机。 +> 本节简要介绍了 YAML 的表达能力。**预计初次阅读的人不可能理解所有的例子**。相反,这些选择用作该规范其余部分的动机。 -#### 惊讶的行为 +#### 令人惊讶的行为 以下会解析成什么([Colm O’Connor][12] 提供的例子): + ``` - Don Corleone: Do you have faith in my judgment? - Clemenza: Yes - Don Corleone: Do I have your loyalty? ``` -结果为 +结果为: + ``` [ {'Don Corleone': 'Do you have faith in my judgment?'}, @@ -101,53 +106,60 @@ en: ``` 那么这个呢: + ``` python: 3.5.3 postgres: 9.3 ``` `3.5.3` 被识别为字符串,但 `9.3` 被识别为数字而不是字符串: + ``` {'python': '3.5.3', 'postgres': 9.3} ``` 这个呢: + ``` Effenaar: Eindhoven 013: Tilburg ``` -013 是蒂尔堡(Tilburg)的一个流行音乐场地,但 YAML 会告诉你错误答案,因为它被解析为八进制数字: +`013` 是蒂尔堡Tilburg的一个流行音乐场地,但 YAML 会告诉你错误答案,因为它被解析为八进制数字: + ``` {11: 'Tilburg', 'Effenaar': 'Eindhoven'} ``` -所有这一切,以及更多,就是为什么许多经验丰富的 YAMLers 经常会引用所有字符串的原因,即使它不是严格要求。许多人不使用引号,而且很容易忘记,特别是如果文件的其余部分(可能由其他人编写)不使用引号。 +所有这一切,以及更多,就是为什么许多经验丰富的 YAMLer 经常会将所有字符串用引号引起来的原因,即使它不是严格要求。许多人不使用引号,而且很容易忘记,特别是如果文件的其余部分(可能由其他人编写)不使用引号。 ### 它不方便 -因为它太复杂了,它声称的可移植性被夸大了。例如,考虑以下这个从 YAML 规范中获取的示例: +因为它太复杂了,它所声称的可移植性被夸大了。例如,考虑以下这个从 YAML 规范中获取的示例: + ``` ? - Detroit Tigers - - Chicago cubs + - Chicago cubs : - - 2001-07-23 + - 2001-07-23 ? [ New York Yankees, - Atlanta Braves ] + Atlanta Braves ] : [ 2001-07-02, 2001-08-12, - 2001-08-14 ] + 2001-08-14 ] ``` -除了大多数读者可能甚至不知道这样做的事实,还可以尝试使用 PyYAML 在 Python 中解析它: +抛开大多数读者可能甚至不知道这是在做什么之外,请尝试使用 PyYAML 在 Python 中解析它: + ``` yaml.constructor.ConstructorError: while constructing a mapping - in "a.yaml", line 1, column 1 + in "a.yaml", line 1, column 1 found unhashable key - in "a.yaml", line 1, column 3 + in "a.yaml", line 1, column 3 ``` 在 Ruby 中,它可以工作: + ``` { ["Detroit Tigers", "Chicago cubs"] => [ @@ -161,19 +173,21 @@ found unhashable key } ``` -原因是你不能在 Python 中使用列表作为一个字典(dict)键: +这个原因是你不能在 Python 中使用列表作为一个字典的键: + ``` >>> {['a']: 'zxc'} Traceback (most recent call last): - File "", line 1, in - TypeError: unhashable type: 'list' + File "", line 1, in + TypeError: unhashable type: 'list' ``` -而这种限制并不是 Python 特有的,PHP, JavaScript 和 Go 等常用语言都有此限制。 +而这种限制并不是 Python 特有的,PHP、JavaScript 和 Go 等常用语言都有此限制。 -因此,在 YAML 文件中使用它,你将无法在大多数语言中解析它。 +因此,在 YAML 文件中使用这种语法,你将无法在大多数语言中解析它。 这是另一个从 YAML 规范的示例部分中获取的: + ``` # Ranking of 1998 home runs --- @@ -191,12 +205,13 @@ Python 会输出: ``` yaml.composer.ComposerError: expected a single document in the stream - in "a.yaml", line 3, column 1 + in "a.yaml", line 3, column 1 but found another document - in "a.yaml", line 8, column 1 + in "a.yaml", line 8, column 1 ``` 然而 Ruby 输出: + ``` ["Mark McGwire", "Sammy Sosa", "Ken Griffey"] ``` @@ -215,32 +230,38 @@ but found another document > 2. YAML 数据在编程语言之间是可移植的。 > 3. YAML 匹配敏捷语言的原生数据结构。 > 4. YAML 有一个一致的模型来支持通用工具。 -> 5. YAML 支持一趟处理。(to 校正:这里 one-pass 是否有专业翻译?) +> 5. YAML 支持一次性处理。 > 6. YAML 具有表现力和可扩展性。 > 7. YAML 易于实现和使用。 -> -那么它有多好呢? +那么它做的如何呢? > YAML 很容易被人类阅读。 -只有坚持一小部分时才有效。完整集很复杂 - 远远超过 XML 或 JSON。 + +只有坚持一小部分子集时才有效。完整的规则集很复杂 —— 远远超过 XML 或 JSON。 > YAML 数据在编程语言之间是可移植的。 + 事实并非如此,因为创建常见语言不支持的结构太容易了。 > YAML 匹配敏捷语言的原生数据结构。 -往上看。另外,为什么只支持敏捷(或动态)语言?其他语言呢? + +参见上面。另外,为什么只支持敏捷(或动态)语言?其他语言呢? > YAML 有一个一致的模型来支持通用工具。 + 我甚至不确定这意味着什么,我找不到任何详细说明。 -> YAML 支持一趟处理。 +> YAML 支持一次性处理。 + 这点我接受。 > YAML 具有表现力和可扩展性。 + 嗯,是的,但它太富有表现力(例如太复杂)。 > YAML 易于实现和使用。 + ``` $ cat `ls -1 ~/gocode/src/github.com/go-yaml/yaml/*.go | grep -v _test` | wc -l 9247 @@ -251,7 +272,7 @@ $ cat /usr/lib/python3.5/site-packages/yaml/*.py | wc -l ### 结论 -不要误解我的意思,并不是说 YAML 很糟糕 - 它肯定不像[使用 JSON 那么多的问题][1] - 但它也不是非常好。有一些一开始并不明显的缺点和惊喜,还有许多更好的替代品,如 [TOML][7] 和其他更专业的格式。 +不要误解我的意思,并不是说 YAML 很糟糕 —— 它肯定不像[使用 JSON 那么多的问题][1] —— 但它也不是非常好。有一些一开始并不明显的缺点和惊喜,还有许多更好的替代品,如 [TOML][7] 和其他更专业的格式。 就个人而言,当我有选择时,我不太可能再次使用它。 @@ -259,7 +280,10 @@ $ cat /usr/lib/python3.5/site-packages/yaml/*.py | wc -l ### 反馈 -你可以发送电子邮件至 [martin@arp242.net][15] 或[创建 GitHub issue][16] 以获取反馈,问题等。 +你可以发送电子邮件至 [martin@arp242.net][15] 或[创建 GitHub issue][16] 以获取反馈、问题等。 + +[^1]: 在 PHP 中你需要修改一个 INI 设置来获得安全的行为,不能只是调用像 `yaml_safe()` 这样的东西。PHP 想尽办法让愚蠢的东西越发愚蠢。干得漂亮! +[^2]: 不要在这里做空格与制表符之争,如果这里可以用制表符的话,我可以(临时)增加制表符宽度来使它更易读——这是制表符的一种用途。 -------------------------------------------------------------------------------- From ac07a0f5c39e9fb087b9c57f56d814fb2649301c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 7 Jan 2019 23:53:40 +0800 Subject: [PATCH 239/322] PUB:20171227 YAML- probably not so great after all.md @MjSeven https://linux.cn/article-10423-1.html --- .../20171227 YAML- probably not so great after all.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20171227 YAML- probably not so great after all.md (99%) diff --git a/translated/tech/20171227 YAML- probably not so great after all.md b/published/20171227 YAML- probably not so great after all.md similarity index 99% rename from translated/tech/20171227 YAML- probably not so great after all.md rename to published/20171227 YAML- probably not so great after all.md index 02c80a6a11..03efe649de 100644 --- a/translated/tech/20171227 YAML- probably not so great after all.md +++ b/published/20171227 YAML- probably not so great after all.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10423-1.html) [#]: subject: (YAML: probably not so great after all) [#]: via: (https://arp242.net/weblog/yaml_probably_not_so_great_after_all.html) [#]: author: (Martin Tournoij https://arp242.net/) @@ -292,7 +292,7 @@ via: https://arp242.net/weblog/yaml_probably_not_so_great_after_all.html 作者:[Martin Tournoij][a] 选题:[lujun9972][b] 译者:[MjSeven](https://github.com/MjSeven) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ccdbd5558391fb4dab71a1fe1b7e18b903cedc6f Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 8 Jan 2019 08:51:52 +0800 Subject: [PATCH 240/322] translated --- ...e at the Linux command line with nudoku.md | 54 ------------------- ...e at the Linux command line with nudoku.md | 54 +++++++++++++++++++ 2 files changed, 54 insertions(+), 54 deletions(-) delete mode 100644 sources/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md create mode 100644 translated/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md diff --git a/sources/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md b/sources/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md deleted file mode 100644 index 664921bb87..0000000000 --- a/sources/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md +++ /dev/null @@ -1,54 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Solve a puzzle at the Linux command line with nudoku) -[#]: via: (https://opensource.com/article/18/12/linux-toy-nudoku) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) - -Solve a puzzle at the Linux command line with nudoku -====== -Sudokus are simple logic games that can be enjoyed just about anywhere, including in your Linux terminal. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-nudoku.png?itok=OS2o4Rot) - -Welcome back to another installment in our 24-day-long Linux command-line toys advent calendar. If this is your first visit to the series, you might be asking yourself what a command-line toy even is. We’re figuring that out as we go, but generally, it could be a game, or any simple diversion that helps you have fun at the terminal. - -Some of you will have seen various selections from our calendar before, but we hope there’s at least one new thing for everyone. - -Every year for Christmas, my mother-in-law gives my wife a Sudoku calendar. It sits on our coffee table for the year to follow. Each day is a separate sheet (except for Saturday and Sunday, that are combined onto one page), with the idea being that you have a new puzzle every day while also having a functioning calendar. - -The problem, in practice, is that it's a great pad of puzzles but not a great calendar because it turns out some days are harder than others and we just don't get through them at the necessary rate of one a day. Then, we may have a week's worth that gets batched on a lazy Sunday. - -Since I've already given you a [calendar][1] as a part of this series, I figure it's only fair to give you a Sudoku puzzle as well, except our command-line versions are decoupled so there's no pressure to complete exactly one a day. - -I found **nudoku** in my default repositories on Fedora, so installing it was as simple as: - -``` -$ sudo dnf install nudoku -``` - -Once installed, just invoke **nudoku** by name to launch it, and it should be fairly self-explanatory from there. If you've never played Sudoku before, it's fairly simple: You need to make sure that each row, each column, and each of the nine 3x3 squares that make up the large square each have one of every digit, 1-9. - -You can find **nudoku** 's c source code [on GitHub][2] under a GPLv3 license. -![](https://opensource.com/sites/default/files/uploads/linux-toy-nudoku-animated.gif) -Do you have a favorite command-line toy that you we should have included? Our calendar is basically set for the remainder of the series, but we'd still love to feature some cool command-line toys in the new year. Let me know in the comments below, and I'll check it out. And let me know what you thought of today's amusement. - -Be sure to check out yesterday's toy, [Use your Linux terminal to celebrate a banner][3] [year][3], and come back tomorrow for another! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-nudoku - -作者:[Jason Baker][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/jason-baker -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/article/18/12/linux-toy-cal -[2]: https://github.com/jubalh/nudoku -[3]: https://opensource.com/article/18/12/linux-toy-figlet diff --git a/translated/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md b/translated/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md new file mode 100644 index 0000000000..a76fbbd50c --- /dev/null +++ b/translated/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md @@ -0,0 +1,54 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Solve a puzzle at the Linux command line with nudoku) +[#]: via: (https://opensource.com/article/18/12/linux-toy-nudoku) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +在 Linux 命令行中使用 nudoku 解决谜题 +====== +数独是简单的逻辑游戏,它可以在任何地方玩,包括在 Linux 终端中。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-nudoku.png?itok=OS2o4Rot) + +欢迎回到我们为期 24 天的 Linux 命令行玩具日历。如果这是你第一次访问该系列,你甚至可能会问自己什么是命令行玩具。我们在考虑中,但一般来说,它可能是一个游戏,或任何简单的消遣,可以帮助你在终端玩得开心。 + +很可能你们中的一些人之前已经看过我们日历中的各种玩具,但我们希望每个人至少见到一件新事物。 + +每年圣诞节,我的婆婆都会给我妻子一本数独日历。它接着会在我们的咖啡桌上呆上一年。每天都是一张单独的表格(星期六和星期日除外,它们合并在一页上),这样你每天都有一个新的谜题,同时还有一本能用的日历。 + +问题在于在实际中它是一本很好的谜题,但不是一本好的日历,因为事实证明有些日子的题目比其他日子更难,我们没有以每天一个的速度解决它们。然后,我们会在懒散的周日来解决这周堆积的谜题。 + +既然我在这个系列的一部分中介绍过[日历][1],那么在这里介绍数独也是公平的,除了我们的命令行版本是解耦的,因此将来很容易就能完成它。 + +我在 Fedora 的默认仓库中找到了 **nudoku**,因此安装它就像下面这样简单: + +``` +$ sudo dnf install nudoku +``` + +安装完后,只需输入 **nudoku** 即可启动它,之后的操作就很明了。如果你以前从未玩过数独,它它很容易:你只需要确保每行、每列、每个 3x3 构成的方块里都包含了 1-9 的所有数字。 + +你可在 [Github][2] 中找到 GPLv3 许可的 **nudoku** 源码 +![](https://opensource.com/sites/default/files/uploads/linux-toy-nudoku-animated.gif) +你有特别喜欢的命令行小玩具需要我介绍的吗?我们的日历基本上满了,但我们仍然希望在新的一年中展示一些很酷的命令行玩具。请在评论中留言,我会查看的。记得让我知道你对今天玩具的看法。 + +一定要看看昨天的玩具,[使用 Linux 终端庆祝丰年][3],记得明天回来! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-nudoku + +作者:[Jason Baker][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jason-baker +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/18/12/linux-toy-cal +[2]: https://github.com/jubalh/nudoku +[3]: https://opensource.com/article/18/12/linux-toy-figlet \ No newline at end of file From 1b97b347574b67e068d3920392fc1bcfcbe727a3 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 8 Jan 2019 08:57:44 +0800 Subject: [PATCH 241/322] translating --- .../tech/20190103 How to create presentations with Beamer.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190103 How to create presentations with Beamer.md b/sources/tech/20190103 How to create presentations with Beamer.md index 68997a146d..f6d910c348 100644 --- a/sources/tech/20190103 How to create presentations with Beamer.md +++ b/sources/tech/20190103 How to create presentations with Beamer.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 377dfc6f1f77912cf49f9b76af8f952b6777aa09 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 8 Jan 2019 09:04:30 +0800 Subject: [PATCH 242/322] translated --- ...nux terminal to celebrate a banner year.md | 100 ------------------ 1 file changed, 100 deletions(-) delete mode 100644 sources/tech/20181218 Use your Linux terminal to celebrate a banner year.md diff --git a/sources/tech/20181218 Use your Linux terminal to celebrate a banner year.md b/sources/tech/20181218 Use your Linux terminal to celebrate a banner year.md deleted file mode 100644 index c02371d1ed..0000000000 --- a/sources/tech/20181218 Use your Linux terminal to celebrate a banner year.md +++ /dev/null @@ -1,100 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Use your Linux terminal to celebrate a banner year) -[#]: via: (https://opensource.com/article/18/12/linux-toy-figlet) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) - -Use your Linux terminal to celebrate a banner year -====== -Need make sure your command is heard? Pipe it to a banner and it won't be missed. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-figlet.png?itok=o4XmTL-b) - - -Hello again for another installment in our 24-day-long Linux command-line toys advent calendar. If this is your first visit to the series, you might be asking yourself what a command-line toy even is. We’re figuring that out as we go, but generally, it could be a game, or any simple diversion that helps you have fun at the terminal. - -Some of you will have seen various selections from our calendar before, but we hope there’s at least one new thing for everyone. - -Today's toy if **figlet** , a utility for printing text in banner form across your Linux terminal. - -You'll likely find **figlet** packaged in your standard repositories. For me on Fedora, this meant installation was as simple as: - -``` -$ sudo dnf install figlet -``` - -After that, simply use the program's name to invoke it. You can either use it interactively, or, pipe some text to it, as below: - -``` -echo "Hello world" | figlet - _   _      _ _                            _     _ -| | | | ___| | | ___   __      _____  _ __| | __| | -| |_| |/ _ \ | |/ _ \  \ \ /\ / / _ \| '__| |/ _` | -|  _  |  __/ | | (_) |  \ V  V / (_) | |  | | (_| | -|_| |_|\___|_|_|\___/    \_/\_/ \___/|_|  |_|\__,_| -``` - -There are a number of different font options available for **figlet**. To see the options available to you, try the command **showfigfonts**. For me, this displayed over a dozen. I've copied out a few of my favorites below. - -``` -block : -                                            -_|        _|                      _|         -_|_|_|    _|    _|_|      _|_|_|  _|  _|     -_|    _|  _|  _|    _|  _|        _|_|       -_|    _|  _|  _|    _|  _|        _|  _|     -_|_|_|    _|    _|_|      _|_|_|  _|    _|   - - -bubble : -  _   _   _   _   _   _   - / \ / \ / \ / \ / \ / \ -( b | u | b | b | l | e ) - \_/ \_/ \_/ \_/ \_/ \_/ - - -lean : -                                      -    _/                               -   _/    _/_/      _/_/_/  _/_/_/     -  _/  _/_/_/_/  _/    _/  _/    _/   - _/  _/        _/    _/  _/    _/     -_/    _/_/_/    _/_/_/  _/    _/   - - -script : -                          -               o           - ,   __   ,_        _ _|_ -/ \_/    /  |  |  |/ \_|   - \/ \___/   |_/|_/|__/ |_/ -                 /|       -                 \|       -``` - -You can find out more about **figlet** on the project's [homepage][1]. The version I downloaded was made available as open source under an MIT license. - -You'll find that **figlet** isn't the only banner-printer available for the Linux terminal. Another option that you may choose to check out is [toilet][2], which comes with its own set of ASCII-art style printing options. - -Do you have a favorite command-line toy that you we should have included? Our calendar is basically set for the remainder of the series, but we'd still love to feature some cool command-line toys in the new year. Let me know in the comments below, and I'll check it out. And let me know what you thought of today's amusement. - -Be sure to check out yesterday's toy, [Take a swim at your Linux terminal with asciiquarium][3], and come back tomorrow for another! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-figlet - -作者:[Jason Baker][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/jason-baker -[b]: https://github.com/lujun9972 -[1]: http://www.figlet.org/ -[2]: http://caca.zoy.org/wiki/toilet -[3]: https://opensource.com/article/18/12/linux-toy-asciiquarium From 8aef4983925255d9f67bd12a43206882f72a10b1 Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Tue, 8 Jan 2019 10:00:59 +0800 Subject: [PATCH 243/322] Translating by qhwdw --- ...0120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md b/sources/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md index c5225cba1a..f16c290504 100644 --- a/sources/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md +++ b/sources/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (qhwdw) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 99c59bcae667c72261964d8356cc0c44f7dce369 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 8 Jan 2019 14:47:30 +0800 Subject: [PATCH 244/322] APL:20181029 How I organize my knowledge as a Software Engineer.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 翻译申请 --- ...181029 How I organize my knowledge as a Software Engineer.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20181029 How I organize my knowledge as a Software Engineer.md b/sources/talk/20181029 How I organize my knowledge as a Software Engineer.md index c11e1c9c38..448e9b564b 100644 --- a/sources/talk/20181029 How I organize my knowledge as a Software Engineer.md +++ b/sources/talk/20181029 How I organize my knowledge as a Software Engineer.md @@ -1,4 +1,4 @@ -@flowsnow is translating +wxy is translating How I organize my knowledge as a Software Engineer From 685dba0aaac8ad23b7d0572665f35585a1e49eb1 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 8 Jan 2019 15:23:47 +0800 Subject: [PATCH 245/322] TRD:20181029 How I organize my knowledge as a Software Engineer.md --- ...ize my knowledge as a Software Engineer.md | 98 +++++++++---------- 1 file changed, 45 insertions(+), 53 deletions(-) diff --git a/sources/talk/20181029 How I organize my knowledge as a Software Engineer.md b/sources/talk/20181029 How I organize my knowledge as a Software Engineer.md index 448e9b564b..cb447b476d 100644 --- a/sources/talk/20181029 How I organize my knowledge as a Software Engineer.md +++ b/sources/talk/20181029 How I organize my knowledge as a Software Engineer.md @@ -1,101 +1,93 @@ -wxy is translating +我怎样如软件工程师一样组织知识 +========== + +总体上说,软件开发和技术是以非常快的速度发展的领域,所以持续学习是必不可少的。在互联网上花几分钟找一下,在 Twitter、媒体、RSS 订阅、Hacker News 和其它专业网站和社区等地方,就可以从文章、案例研究、教程、代码片段、新应用程序和信息中找到大量有用的信息。 + +保存和组织所有这些信息可能是一项艰巨的任务。在这篇文章中,我将介绍一些我用来组织信息的工具。 + +我认为在知识管理方面非常重要的一点就是避免锁定在特定平台。我使用的所有工具都允许以标准格式(如 Markdown 和 HTML)导出数据。 + +请注意,我的流程并不完美,我一直在寻找新工具和方法来优化它。每个人都不同,所以对我有用的东西可能不适合你。 -How I organize my knowledge as a Software Engineer -============================================================ +### 用 NotionHQ 做知识库 +对我来说,知识管理的基本部分是拥有某种个人知识库或维基。这是一个你可以以有组织的方式保存链接、书签、备注等的地方。 -Software Development and Technology in general are areas that evolve at a very fast pace and continuous learning is essential. -Some minutes navigating in the internet, in places like Twitter, Medium, RSS feeds, Hacker News and other specialized sites and communities, are enough to find lots of great pieces of information from articles, case studies, tutorials, code snippets, new applications and much more. +我使用 [NotionHQ][7] 做这件事。我使用它来记录各种主题,包括资源列表,如通过编程语言分组的优秀的库或教程,为有趣的博客文章和教程添加书签等等,不仅与软件开发有关,而且与我的个人生活有关。 -Saving and organizing all that information can be a daunting task. In this post I will present some tools tools that I use to do it. +我真正喜欢 NotionHQ 的是,创建新内容是如此简单。你可以使用 Markdown 编写它并将其组织为树状。 -One of the points I consider very important regarding knowledge management is to avoid lock-in in a particular platform. All the tools I use, allow to export your data in standard formats like Markdown and HTML. +这是我的“开发”工作区的顶级页面: -Note that, My workflow is not perfect and I am constantly searching for new tools and ways to optimize it. Also everyone is different, so what works for me might not working well for you. +[![Image](https://res.cloudinary.com/practicaldev/image/fetch/s--uMbaRUtu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://i.imgur.com/kRnuvMV.png)][8] -### Knowledge base with NotionHQ +NotionHQ 有一些很棒的其他功能,如集成了电子表格/数据库和任务板。 -For me, the fundamental piece of Knowledge management is to have some kind of personal Knowledge base / wiki. A place where you can save links, bookmarks, notes etc in an organized manner. +如果您想认真使用 NotionHQ,您将需要订阅付费个人计划,因为免费计划有所限制。我觉得它物有所值。NotionHQ 允许将整个工作区导出为 Markdown 文件。导出功能存在一些重要问题,例如丢失页面层次结构,希望 Notion 团队可以改进这一点。 -I use [NotionHQ][7] for that matter. I use it to keep notes on various topics, having lists of resources like great libraries or tutorials grouped by programming language, bookmarking interesting blog posts and tutorials, and much more, not only related to software development but also my personal life. +作为一个免费的替代方案,我可能会使用 [VuePress][9] 或 [GitBook][10] 来托管我自己的知识库。 -What I really like about Notion, is how simple it is to create new content. You write it using Markdown and it is organized as tree. +### 用 Pocket 保存感兴趣的文章 -Here is my top level pages of my "Development" workspace: +[Pocket][11] 是我最喜欢的应用之一!使用 Pocket,您可以创建一个来自互联网上的文章的阅读列表。每当我看到一篇看起来很有趣的文章时,我都会使用 Chrome 扩展程序将其保存到 Pocket。稍后,我会阅读它,如果我发现它足够有用,我将使用 Pocket 的“存档”功能永久保存该文章并清理我的 Pocket 收件箱。 - [![Image](https://res.cloudinary.com/practicaldev/image/fetch/s--uMbaRUtu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://i.imgur.com/kRnuvMV.png)][8] +我尽量保持这个阅读清单足够小,并存档我已经处理过的信息。Pocket 允许您标记文章,以便以后更轻松地搜索特定主题的文章。 -Notion has some nice other features like integrated spreadsheets / databases and Task boards. +如果原始网站消失,您还可以在 Pocket 服务器中保存文章的副本,但是您需要 Pocket Premium 订阅计划。 -You will need to subscribe to paid Personal Plan, if you want to use Notion seriously as the free plan is somewhat limited. I think its worth the price. Notion allows to export your entire workspace to Markdown files. The export has some important problems, like loosing the page hierarchy, but hope Notion Team can improve that. +Pocket 还具有“发现”功能,根据您保存的文章推荐类似的文章。这是找到可以阅读的新内容的好方法。 -As a free alternative I would probably use [VuePress][9] or [GitBook][10] to host my own. +### 用 SnippetStore 做代码片段管理 -### Save interesting articles with Pocket +从 GitHub 到 Stack Overflow 的答案,到博客文章,经常能找到一些你想要保存备用的好代码片段。它可能是一些不错的算法实现、一个有用的脚本或如何在某种语言中执行某种操作的示例。 -[Pocket][11] is one of my favorite applications ever! With Pocket you can create a reading list of articles from the Internet.  -Every time I see an article that looks interesting, I save it to Pocket using its Chrome Extension. Later on, I will read it and If I found it useful enough, I will use the "Archive" function of Pocket to permanently save that article and clean up my Pocket inbox. +我尝试了很多应用程序,从简单的 GitHub Gists 到 [Boostnote][12],直到我发现 [SnippetStore][13]。 -I try to keep the Reading list small enough and keep archiving information that I have dealt with. Pocket allows you to tag articles which will make it simpler to search articles for a particular topic later in time. +SnippetStore 是一个开源的代码片段管理应用。SnippetStore 与其他产品的区别在于其简单性。您可以按语言或标签整理片段,并且可以拥有多个文件片段。它不完美,但是可以用。例如,Boostnote 具有更多功能,但我更喜欢 SnippetStore 组织内容的简单方法。 -You can also save a copy of the article in Pocket servers in case of the original site disappears, but you will need Pocket Premium for that. +对于我每天使用的缩写和片段,我更喜欢使用我的编辑器 / IDE 的代码片段功能,因为它更便于使用。我使用 SnippetStore 更像是作为编码示例的参考。 -Pocket also have a "Discover" feature which suggests similar articles based on the articles you have saved. This is a great way to find new content to read. +[Cacher][14] 也是一个有趣的选择,因为它与许多编辑器进行了集成,他有一个命令行工具,并使用 Gi​​tHub Gists 作为后端,但其专业计划为 6 美元/月,我觉这有点太贵。 -### Snippet Management with SnippetStore +### 用 DevHints 管理速查表 -From GitHub, to Stack Overflow answers, to blog posts, its common to find some nice code snippets that you want to save for later. It could be some nice algorithm implementation, an useful script or an example of how to do X in Y language. +[Devhints][15] 是由 Rico Sta. Cruz 创建的一个速查表集合。它是开源的,是用 Jekyll 生成的,Jekyll 是最受欢迎的静态站点生成器之一。 -I tried many apps from simple GitHub Gists to [Boostnote][12] until I discovered [SnippetStore][13]. +这些速查表是用 Markdown 编写的,带有一些额外的格式化支持,例如支持列。 -SnippetStore is an open source snippet management app. What distinguish SnippetStore from others is its simplicity. You can organize snippets by Language or Tags and you can have multi file snippets. Its not perfect but it gets the job done. Boostnote, for example has more features, but I prefer the simpler way of organizing content of SnippetStore. +我非常喜欢其界面的外观,并且不像可以在 [Cheatography][16] 等网站上找到 PDF 或图像格式的速查表, Markdown 非常容易添加新内容并保持更新和进行版本控制。 -For abbreviations and snippets that I use on a daily basis, I prefer to use my Editor / IDE snippets feature as it is more convenient to use. I use SnippetStore more like a reference of coding examples. +因为它是开源,我创建了自己的分叉版本,删除了一些我不需要的速查表,并添加了更多。 -[Cacher][14] is also an interesting alternative, since it has integrations with many editors, have a cli tool and uses GitHub Gists as backend, but 6$/month for its pro plan, its too much IMO. +我使用速查表作为如何使用某些库或编程语言或记住一些命令的参考。速查表的单个页面非常方便,例如,可以列出特定编程语言的所有基本语法。 -### Managing cheat sheets with DevHints - -[Devhints][15] is a collection of cheat sheets created by Rico Sta. Cruz. Its open source and powered by Jekyll, one of the most popular static site generator. - -The cheat sheets are written in Markdown with some extra formatting goodies like support for columns. - -I really like the looks of the interface and being Markdown makes in incredibly easy to add new content and keep it updated and in version control, unlike cheat sheets in PDF or Image format, that you can find on sites like [Cheatography][16]. - -As it is open source I have created my own fork, removed some cheat sheets that I dont need and add some more. - -I use cheat sheets as reference of how to use some library or programming language or to remember some commands. Its very handy to have a single page, with all the basic syntax of a specific programming language for example. - -I am still experimenting with this but its working great so far. +我仍在尝试这个工具,但到目前为止它的工作很好。 ### Diigo -[Diigo][17] allows you to Annotate and Highlight parts of websites. I use it to annotate important information when studying new topics or to save particular paragraphs from articles, Stack Overflow answers or inspirational quotes from Twitter! ;) +[Diigo][17] 允许您注释和突出显示部分网站。我在研究新东西时使用它来注释重要信息,或者从文章、Stack Overflow 答案或来自 Twitter 的鼓舞人心的引语中保存特定段落!;) * * * -And thats it. There might be some overlap in terms of functionality in some of the tools, but like I said in the beginning, this is an always evolving workflow, as I am always experimenting and searching for ways to improve and be more productive. +就这些了。某些工具的功能方面可能存在一些重叠,但正如我在开始时所说的那样,这是一个不断演进的工作流程,因为我一直在尝试和寻找改进和提高工作效率的方法。 -What about you? How to you organize your Knowledge?. Please feel free to comment below. +你呢?是如何组织你的知识的?请随时在下面发表评论。 -Thank you for reading. +谢谢你的阅读。 ------------------------------------------------------------------------ -作者简介: - -Bruno Paz -Web Engineer. Expert in #PHP and @Symfony Framework. Enthusiast about new technologies. Sports and @FCPorto fan! +作者简介:Bruno Paz,Web 工程师,专精 #PHP 和 @Symfony 框架。热心于新技术。喜欢运动,@FCPorto 的粉丝! -------------------------------------------------------------------------------- via: https://dev.to/brpaz/how-do-i-organize-my-knowledge-as-a-software-engineer-4387 -作者:[ Bruno Paz][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +作者:[Bruno Paz][a] 选题:[oska874](https://github.com/oska874) +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 8009d8203b0db20d1031b0984444628ce5de99c8 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 8 Jan 2019 15:30:13 +0800 Subject: [PATCH 246/322] PRF:20181029 How I organize my knowledge as a Software Engineer.md --- ...181029 How I organize my knowledge as a Software Engineer.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20181029 How I organize my knowledge as a Software Engineer.md b/sources/talk/20181029 How I organize my knowledge as a Software Engineer.md index cb447b476d..73a46af506 100644 --- a/sources/talk/20181029 How I organize my knowledge as a Software Engineer.md +++ b/sources/talk/20181029 How I organize my knowledge as a Software Engineer.md @@ -1,4 +1,4 @@ -我怎样如软件工程师一样组织知识 +怎样如软件工程师一样组织知识 ========== 总体上说,软件开发和技术是以非常快的速度发展的领域,所以持续学习是必不可少的。在互联网上花几分钟找一下,在 Twitter、媒体、RSS 订阅、Hacker News 和其它专业网站和社区等地方,就可以从文章、案例研究、教程、代码片段、新应用程序和信息中找到大量有用的信息。 From dfe542ca54c4685394ec35fb785021e46b77e06b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 8 Jan 2019 15:30:55 +0800 Subject: [PATCH 247/322] PRF:20181029 How I organize my knowledge as a Software Engineer.md --- ...ize my knowledge as a Software Engineer.md | 111 ++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 translated/talk/20181029 How I organize my knowledge as a Software Engineer.md diff --git a/translated/talk/20181029 How I organize my knowledge as a Software Engineer.md b/translated/talk/20181029 How I organize my knowledge as a Software Engineer.md new file mode 100644 index 0000000000..73a46af506 --- /dev/null +++ b/translated/talk/20181029 How I organize my knowledge as a Software Engineer.md @@ -0,0 +1,111 @@ +怎样如软件工程师一样组织知识 +========== + +总体上说,软件开发和技术是以非常快的速度发展的领域,所以持续学习是必不可少的。在互联网上花几分钟找一下,在 Twitter、媒体、RSS 订阅、Hacker News 和其它专业网站和社区等地方,就可以从文章、案例研究、教程、代码片段、新应用程序和信息中找到大量有用的信息。 + +保存和组织所有这些信息可能是一项艰巨的任务。在这篇文章中,我将介绍一些我用来组织信息的工具。 + +我认为在知识管理方面非常重要的一点就是避免锁定在特定平台。我使用的所有工具都允许以标准格式(如 Markdown 和 HTML)导出数据。 + +请注意,我的流程并不完美,我一直在寻找新工具和方法来优化它。每个人都不同,所以对我有用的东西可能不适合你。 + + +### 用 NotionHQ 做知识库 + +对我来说,知识管理的基本部分是拥有某种个人知识库或维基。这是一个你可以以有组织的方式保存链接、书签、备注等的地方。 + +我使用 [NotionHQ][7] 做这件事。我使用它来记录各种主题,包括资源列表,如通过编程语言分组的优秀的库或教程,为有趣的博客文章和教程添加书签等等,不仅与软件开发有关,而且与我的个人生活有关。 + +我真正喜欢 NotionHQ 的是,创建新内容是如此简单。你可以使用 Markdown 编写它并将其组织为树状。 + +这是我的“开发”工作区的顶级页面: + +[![Image](https://res.cloudinary.com/practicaldev/image/fetch/s--uMbaRUtu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://i.imgur.com/kRnuvMV.png)][8] + +NotionHQ 有一些很棒的其他功能,如集成了电子表格/数据库和任务板。 + +如果您想认真使用 NotionHQ,您将需要订阅付费个人计划,因为免费计划有所限制。我觉得它物有所值。NotionHQ 允许将整个工作区导出为 Markdown 文件。导出功能存在一些重要问题,例如丢失页面层次结构,希望 Notion 团队可以改进这一点。 + +作为一个免费的替代方案,我可能会使用 [VuePress][9] 或 [GitBook][10] 来托管我自己的知识库。 + +### 用 Pocket 保存感兴趣的文章 + +[Pocket][11] 是我最喜欢的应用之一!使用 Pocket,您可以创建一个来自互联网上的文章的阅读列表。每当我看到一篇看起来很有趣的文章时,我都会使用 Chrome 扩展程序将其保存到 Pocket。稍后,我会阅读它,如果我发现它足够有用,我将使用 Pocket 的“存档”功能永久保存该文章并清理我的 Pocket 收件箱。 + +我尽量保持这个阅读清单足够小,并存档我已经处理过的信息。Pocket 允许您标记文章,以便以后更轻松地搜索特定主题的文章。 + +如果原始网站消失,您还可以在 Pocket 服务器中保存文章的副本,但是您需要 Pocket Premium 订阅计划。 + +Pocket 还具有“发现”功能,根据您保存的文章推荐类似的文章。这是找到可以阅读的新内容的好方法。 + +### 用 SnippetStore 做代码片段管理 + +从 GitHub 到 Stack Overflow 的答案,到博客文章,经常能找到一些你想要保存备用的好代码片段。它可能是一些不错的算法实现、一个有用的脚本或如何在某种语言中执行某种操作的示例。 + +我尝试了很多应用程序,从简单的 GitHub Gists 到 [Boostnote][12],直到我发现 [SnippetStore][13]。 + +SnippetStore 是一个开源的代码片段管理应用。SnippetStore 与其他产品的区别在于其简单性。您可以按语言或标签整理片段,并且可以拥有多个文件片段。它不完美,但是可以用。例如,Boostnote 具有更多功能,但我更喜欢 SnippetStore 组织内容的简单方法。 + +对于我每天使用的缩写和片段,我更喜欢使用我的编辑器 / IDE 的代码片段功能,因为它更便于使用。我使用 SnippetStore 更像是作为编码示例的参考。 + +[Cacher][14] 也是一个有趣的选择,因为它与许多编辑器进行了集成,他有一个命令行工具,并使用 Gi​​tHub Gists 作为后端,但其专业计划为 6 美元/月,我觉这有点太贵。 + +### 用 DevHints 管理速查表 + +[Devhints][15] 是由 Rico Sta. Cruz 创建的一个速查表集合。它是开源的,是用 Jekyll 生成的,Jekyll 是最受欢迎的静态站点生成器之一。 + +这些速查表是用 Markdown 编写的,带有一些额外的格式化支持,例如支持列。 + +我非常喜欢其界面的外观,并且不像可以在 [Cheatography][16] 等网站上找到 PDF 或图像格式的速查表, Markdown 非常容易添加新内容并保持更新和进行版本控制。 + +因为它是开源,我创建了自己的分叉版本,删除了一些我不需要的速查表,并添加了更多。 + +我使用速查表作为如何使用某些库或编程语言或记住一些命令的参考。速查表的单个页面非常方便,例如,可以列出特定编程语言的所有基本语法。 + +我仍在尝试这个工具,但到目前为止它的工作很好。 + +### Diigo + +[Diigo][17] 允许您注释和突出显示部分网站。我在研究新东西时使用它来注释重要信息,或者从文章、Stack Overflow 答案或来自 Twitter 的鼓舞人心的引语中保存特定段落!;) + +* * * + +就这些了。某些工具的功能方面可能存在一些重叠,但正如我在开始时所说的那样,这是一个不断演进的工作流程,因为我一直在尝试和寻找改进和提高工作效率的方法。 + +你呢?是如何组织你的知识的?请随时在下面发表评论。 + +谢谢你的阅读。 + +------------------------------------------------------------------------ + +作者简介:Bruno Paz,Web 工程师,专精 #PHP 和 @Symfony 框架。热心于新技术。喜欢运动,@FCPorto 的粉丝! + +-------------------------------------------------------------------------------- + +via: https://dev.to/brpaz/how-do-i-organize-my-knowledge-as-a-software-engineer-4387 + +作者:[Bruno Paz][a] +选题:[oska874](https://github.com/oska874) +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://brunopaz.net/ +[1]:https://dev.to/brpaz +[2]:http://twitter.com/brunopaz88 +[3]:http://github.com/brpaz +[4]:https://dev.to/t/knowledge +[5]:https://dev.to/t/learning +[6]:https://dev.to/t/development +[7]:https://www.notion.so/ +[8]:https://res.cloudinary.com/practicaldev/image/fetch/s--uMbaRUtu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://i.imgur.com/kRnuvMV.png +[9]:https://vuepress.vuejs.org/ +[10]:https://www.gitbook.com/?t=1 +[11]:https://getpocket.com/ +[12]:https://boostnote.io/ +[13]:https://github.com/ZeroX-DG/SnippetStore +[14]:https://www.cacher.io/ +[15]:https://devhints.io/ +[16]:https://cheatography.com/ +[17]:https://www.diigo.com/index From 4b55f878b51d3c3cb05b9a8c0e84d1d3bc134af6 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 8 Jan 2019 15:31:29 +0800 Subject: [PATCH 248/322] PUB:20181029 How I organize my knowledge as a Software Engineer.md @wxy https://linux.cn/article-10425-1.html --- ...20181029 How I organize my knowledge as a Software Engineer.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/20181029 How I organize my knowledge as a Software Engineer.md (100%) diff --git a/translated/talk/20181029 How I organize my knowledge as a Software Engineer.md b/published/20181029 How I organize my knowledge as a Software Engineer.md similarity index 100% rename from translated/talk/20181029 How I organize my knowledge as a Software Engineer.md rename to published/20181029 How I organize my knowledge as a Software Engineer.md From d26664d1742a96b2f114b998e9568aa5221eba5a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 8 Jan 2019 18:36:30 +0800 Subject: [PATCH 249/322] PRF:20181219 Solve a puzzle at the Linux command line with nudoku.md @geekpi --- ...e at the Linux command line with nudoku.md | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/translated/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md b/translated/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md index a76fbbd50c..8e247e2c55 100644 --- a/translated/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md +++ b/translated/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Solve a puzzle at the Linux command line with nudoku) @@ -9,29 +9,33 @@ 在 Linux 命令行中使用 nudoku 解决谜题 ====== -数独是简单的逻辑游戏,它可以在任何地方玩,包括在 Linux 终端中。 + +> 数独是简单的逻辑游戏,它可以在任何地方玩,包括在 Linux 终端中。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-nudoku.png?itok=OS2o4Rot) -欢迎回到我们为期 24 天的 Linux 命令行玩具日历。如果这是你第一次访问该系列,你甚至可能会问自己什么是命令行玩具。我们在考虑中,但一般来说,它可能是一个游戏,或任何简单的消遣,可以帮助你在终端玩得开心。 +欢迎回到我们为期 24 天的 Linux 命令行玩具日历。如果这是你第一次访问该系列,你甚至可能会问什么是命令行玩具。我们在考虑中,但一般来说,它可能是一个游戏,或任何简单的消遣,可以帮助你在终端玩得开心。 很可能你们中的一些人之前已经看过我们日历中的各种玩具,但我们希望每个人至少见到一件新事物。 -每年圣诞节,我的婆婆都会给我妻子一本数独日历。它接着会在我们的咖啡桌上呆上一年。每天都是一张单独的表格(星期六和星期日除外,它们合并在一页上),这样你每天都有一个新的谜题,同时还有一本能用的日历。 +每年圣诞节,我的岳母都会给我妻子一本数独日历。它接着会在我们的咖啡桌上呆上一年。每天都是一张单独的表格(星期六和星期日除外,它们合并在一页上),这样你每天都有一个新的谜题,同时还有一本能用的日历。 问题在于在实际中它是一本很好的谜题,但不是一本好的日历,因为事实证明有些日子的题目比其他日子更难,我们没有以每天一个的速度解决它们。然后,我们会在懒散的周日来解决这周堆积的谜题。 既然我在这个系列的一部分中介绍过[日历][1],那么在这里介绍数独也是公平的,除了我们的命令行版本是解耦的,因此将来很容易就能完成它。 -我在 Fedora 的默认仓库中找到了 **nudoku**,因此安装它就像下面这样简单: +我在 Fedora 的默认仓库中找到了 `nudoku`,因此安装它就像下面这样简单: ``` $ sudo dnf install nudoku ``` -安装完后,只需输入 **nudoku** 即可启动它,之后的操作就很明了。如果你以前从未玩过数独,它它很容易:你只需要确保每行、每列、每个 3x3 构成的方块里都包含了 1-9 的所有数字。 +安装完后,只需输入 `nudoku` 即可启动它,之后的操作就很明了。如果你以前从未玩过数独,它它很容易:你只需要确保每行、每列、每个 3x3 构成的方块里都包含了 1-9 的所有数字。 + +你可在 [Github][2] 中找到 GPLv3 许可的 `nudoku` 源码 -你可在 [Github][2] 中找到 GPLv3 许可的 **nudoku** 源码 ![](https://opensource.com/sites/default/files/uploads/linux-toy-nudoku-animated.gif) + 你有特别喜欢的命令行小玩具需要我介绍的吗?我们的日历基本上满了,但我们仍然希望在新的一年中展示一些很酷的命令行玩具。请在评论中留言,我会查看的。记得让我知道你对今天玩具的看法。 一定要看看昨天的玩具,[使用 Linux 终端庆祝丰年][3],记得明天回来! @@ -43,7 +47,7 @@ via: https://opensource.com/article/18/12/linux-toy-nudoku 作者:[Jason Baker][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -51,4 +55,4 @@ via: https://opensource.com/article/18/12/linux-toy-nudoku [b]: https://github.com/lujun9972 [1]: https://opensource.com/article/18/12/linux-toy-cal [2]: https://github.com/jubalh/nudoku -[3]: https://opensource.com/article/18/12/linux-toy-figlet \ No newline at end of file +[3]: https://opensource.com/article/18/12/linux-toy-figlet From d59f966ed25f67a596ef135393da248ad06c14ea Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 8 Jan 2019 18:37:10 +0800 Subject: [PATCH 250/322] PUB:20181219 Solve a puzzle at the Linux command line with nudoku.md @geekpi https://linux.cn/article-10426-1.html --- ...19 Solve a puzzle at the Linux command line with nudoku.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181219 Solve a puzzle at the Linux command line with nudoku.md (97%) diff --git a/translated/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md b/published/20181219 Solve a puzzle at the Linux command line with nudoku.md similarity index 97% rename from translated/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md rename to published/20181219 Solve a puzzle at the Linux command line with nudoku.md index 8e247e2c55..714a6c7819 100644 --- a/translated/tech/20181219 Solve a puzzle at the Linux command line with nudoku.md +++ b/published/20181219 Solve a puzzle at the Linux command line with nudoku.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10426-1.html) [#]: subject: (Solve a puzzle at the Linux command line with nudoku) [#]: via: (https://opensource.com/article/18/12/linux-toy-nudoku) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) From b84437f4932f9cc0d05d5df014ce223f6123f669 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 9 Jan 2019 08:58:25 +0800 Subject: [PATCH 251/322] translated --- ...nux terminal to celebrate a banner year.md | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 translated/tech/20181218 Use your Linux terminal to celebrate a banner year.md diff --git a/translated/tech/20181218 Use your Linux terminal to celebrate a banner year.md b/translated/tech/20181218 Use your Linux terminal to celebrate a banner year.md new file mode 100644 index 0000000000..6b9a1d1108 --- /dev/null +++ b/translated/tech/20181218 Use your Linux terminal to celebrate a banner year.md @@ -0,0 +1,100 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use your Linux terminal to celebrate a banner year) +[#]: via: (https://opensource.com/article/18/12/linux-toy-figlet) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +使用你的 Linux 终端庆祝新年 +====== +想让你的终端被记住么?将它打在横幅上,不要错过。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-figlet.png?itok=o4XmTL-b) + + +欢迎再次来到为期 24 天的 Linux 命令行玩具日历。如果这是你第一次访问该系列,你甚至可能会问自己什么是命令行玩具。我们也在思考,但一般来说,它可能是一个游戏,或任何简单的消遣,可以帮助你在终端玩得开心。 + +很可能你们中的一些人之前已经看过我们日历中的各种玩具,但我们希望每个人至少见到一件新事物。 + +今天的玩具是 **figlet**,一个在 Linux 终端上以横幅形式打印文本的程序。 + +你可能会再标准仓库中找到 **figlet**。在我的 Fedora 上,这意味着安装就像下面这样简单: + +``` +$ sudo dnf install figlet +``` + +之后,只需使用程序的名称来调用它。你可以以交互方式使用它,或者将一些文本通过管道输入,如下所示: + +``` +echo "Hello world" | figlet + _ _ _ _ _ _ +| | | | ___| | | ___ __ _____ _ __| | __| | +| |_| |/ _ \ | |/ _ \ \ \ /\ / / _ \| '__| |/ _` | +| _ | __/ | | (_) | \ V V / (_) | | | | (_| | +|_| |_|\___|_|_|\___/ \_/\_/ \___/|_| |_|\__,_| +``` + +**figlet** 有许多不同的字体。要查看可用的字体,请尝试使用命令 **showfigfonts**。在我这里显示了十几个。我在下面复制了一些我的最爱。 + +``` +block : + +_| _| _| +_|_|_| _| _|_| _|_|_| _| _| +_| _| _| _| _| _| _|_| +_| _| _| _| _| _| _| _| +_|_|_| _| _|_| _|_|_| _| _| + + +bubble : + _ _ _ _ _ _ + / \ / \ / \ / \ / \ / \ +( b | u | b | b | l | e ) + \_/ \_/ \_/ \_/ \_/ \_/ + + +lean : + + _/ + _/ _/_/ _/_/_/ _/_/_/ + _/ _/_/_/_/ _/ _/ _/ _/ + _/ _/ _/ _/ _/ _/ +_/ _/_/_/ _/_/_/ _/ _/ + + +script : + + o + , __ ,_ _ _|_ +/ \_/ / | | |/ \_| + \/ \___/ |_/|_/|__/ |_/ + /| + \| +``` + +你可以在项目的[主页][1]上找到有关 **figlet** 的更多信息。我下载的版本是以 MIT 许可开源的。 + +你会发现 **figlet** 不是唯一的 Linux 终端横幅打印机。另外一个你可以选择的是 [toilet][2],它有自己的一套 ASCII 艺术风格的打印选项。 + +你有特别喜欢的命令行小玩具需要我介绍的吗?我们的日历基本上满了,但我们仍然希望在新的一年中展示一些很酷的命令行玩具。请在评论中留言,我会查看的。记得让我知道你对今天玩具的看法。 + +一定要看看昨天的玩具,[使用 asciiquarium 在终端中游泳][3],记得明天回来! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-figlet + +作者:[Jason Baker][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jason-baker +[b]: https://github.com/lujun9972 +[1]: http://www.figlet.org/ +[2]: http://caca.zoy.org/wiki/toilet +[3]: https://opensource.com/article/18/12/linux-toy-asciiquarium \ No newline at end of file From 297006a8177e1be8ba957498af29901939c448e5 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 9 Jan 2019 09:03:05 +0800 Subject: [PATCH 252/322] translating --- ...181128 Turn an old Linux desktop into a home media center.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181128 Turn an old Linux desktop into a home media center.md b/sources/tech/20181128 Turn an old Linux desktop into a home media center.md index f87750b513..eed213a42e 100644 --- a/sources/tech/20181128 Turn an old Linux desktop into a home media center.md +++ b/sources/tech/20181128 Turn an old Linux desktop into a home media center.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: subject: (Turn an old Linux desktop into a home media center) From d547ea53bf24b010ac1fa16138d6426f00583969 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Wed, 9 Jan 2019 12:37:16 +0800 Subject: [PATCH 253/322] =?UTF-8?q?=E7=94=B3=E8=AF=B7=E7=BF=BB=E8=AF=91201?= =?UTF-8?q?80614=20An=20introduction=20to=20the=20Tornado=20Python=20web?= =?UTF-8?q?=20app=20framework.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4 An introduction to the Tornado Python web app framework.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20180614 An introduction to the Tornado Python web app framework.md b/sources/tech/20180614 An introduction to the Tornado Python web app framework.md index 9c9e5c9500..74fdecb56c 100644 --- a/sources/tech/20180614 An introduction to the Tornado Python web app framework.md +++ b/sources/tech/20180614 An introduction to the Tornado Python web app framework.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MjSeven) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: subject: (An introduction to the Tornado Python web app framework) From ce96576e612d2f6441a6599b71798cd01ee81acf Mon Sep 17 00:00:00 2001 From: belitex Date: Wed, 9 Jan 2019 15:21:07 +0800 Subject: [PATCH 254/322] =?UTF-8?q?=20=E7=BF=BB=E8=AF=91=E7=94=B3=E9=A2=86?= =?UTF-8?q?=EF=BC=9AGCC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...09 GCC- Optimizing Linux, the Internet, and Everything.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sources/talk/20181009 GCC- Optimizing Linux, the Internet, and Everything.md b/sources/talk/20181009 GCC- Optimizing Linux, the Internet, and Everything.md index e7ac8d6c39..70405d6c70 100644 --- a/sources/talk/20181009 GCC- Optimizing Linux, the Internet, and Everything.md +++ b/sources/talk/20181009 GCC- Optimizing Linux, the Internet, and Everything.md @@ -1,3 +1,5 @@ +translating by belitex + GCC: Optimizing Linux, the Internet, and Everything ====== @@ -62,7 +64,6 @@ GCC was first released on March 22, 1987 by Richard Stallman, the founder of the There has been a lot of discussion about the licensing of GCC, most of which confuses rather than enlightens. GCC is distributed under the GNU General Public License version 3 or later with the Runtime Library Exception. This is a copyleft license, which means that derivative work can only be distributed under the same license terms. GPLv3 is intended to protect GCC from being made proprietary and requires that changes to GCC code are made available freely and openly. To the ‘end user’ the compiler is just the same as any other; using GCC makes no difference to any licensing choices you might make for your own code. [19] - -------------------------------------------------------------------------------- via: https://www.linux.com/blog/2018/10/gcc-optimizing-linux-internet-and-everything @@ -78,5 +79,5 @@ via: https://www.linux.com/blog/2018/10/gcc-optimizing-linux-internet-and-everyt [b]: https://github.com/lujun9972 [1]: https://www.openacc.org/tools [2]: /files/images/gccjpg-0 -[3]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/gcc_0.jpg?itok=HbGnRqWX (performance) +[3]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/gcc_0.jpg?itok=HbGnRqWX "performance" [4]: https://www.linux.com/licenses/category/used-permission From aa1cbdc5a60d50a23c2e70100495333c1304c04c Mon Sep 17 00:00:00 2001 From: Rachel Date: Wed, 9 Jan 2019 15:58:53 +0800 Subject: [PATCH 255/322] Translating --- .../20180108 5 arcade-style games in your Linux repository.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180108 5 arcade-style games in your Linux repository.md b/sources/tech/20180108 5 arcade-style games in your Linux repository.md index 88c4e958d7..4e802bfbf0 100644 --- a/sources/tech/20180108 5 arcade-style games in your Linux repository.md +++ b/sources/tech/20180108 5 arcade-style games in your Linux repository.md @@ -1,3 +1,4 @@ +Scoutydren is translating. 5 arcade-style games in your Linux repository ====== From b984a7cefb8771a139c907ae65bfb82f19ef6d57 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 9 Jan 2019 18:49:51 +0800 Subject: [PATCH 256/322] PRF:20181218 Use your Linux terminal to celebrate a banner year.md @geekpi --- ...nux terminal to celebrate a banner year.md | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/translated/tech/20181218 Use your Linux terminal to celebrate a banner year.md b/translated/tech/20181218 Use your Linux terminal to celebrate a banner year.md index 6b9a1d1108..f64124eee0 100644 --- a/translated/tech/20181218 Use your Linux terminal to celebrate a banner year.md +++ b/translated/tech/20181218 Use your Linux terminal to celebrate a banner year.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Use your Linux terminal to celebrate a banner year) @@ -9,17 +9,18 @@ 使用你的 Linux 终端庆祝新年 ====== -想让你的终端被记住么?将它打在横幅上,不要错过。 -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-figlet.png?itok=o4XmTL-b) +> 想让你的终端被记住么?将它打在横幅上,不要错过。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-figlet.png?itok=o4XmTL-b) 欢迎再次来到为期 24 天的 Linux 命令行玩具日历。如果这是你第一次访问该系列,你甚至可能会问自己什么是命令行玩具。我们也在思考,但一般来说,它可能是一个游戏,或任何简单的消遣,可以帮助你在终端玩得开心。 很可能你们中的一些人之前已经看过我们日历中的各种玩具,但我们希望每个人至少见到一件新事物。 -今天的玩具是 **figlet**,一个在 Linux 终端上以横幅形式打印文本的程序。 +今天的玩具是 `figlet`,一个在 Linux 终端上以横幅形式打印文本的程序。 -你可能会再标准仓库中找到 **figlet**。在我的 Fedora 上,这意味着安装就像下面这样简单: +你可能会再标准仓库中找到 `figlet`。在我的 Fedora 上,这意味着安装就像下面这样简单: ``` $ sudo dnf install figlet @@ -36,7 +37,7 @@ echo "Hello world" | figlet |_| |_|\___|_|_|\___/ \_/\_/ \___/|_| |_|\__,_| ``` -**figlet** 有许多不同的字体。要查看可用的字体,请尝试使用命令 **showfigfonts**。在我这里显示了十几个。我在下面复制了一些我的最爱。 +`figlet` 有许多不同的字体。要查看可用的字体,请尝试使用命令 `showfigfonts`。在我这里显示了十几个。我在下面复制了一些我的最爱。 ``` block : @@ -74,9 +75,9 @@ script : \| ``` -你可以在项目的[主页][1]上找到有关 **figlet** 的更多信息。我下载的版本是以 MIT 许可开源的。 +你可以在项目的[主页][1]上找到有关 `figlet` 的更多信息。我下载的版本是以 MIT 许可开源的。 -你会发现 **figlet** 不是唯一的 Linux 终端横幅打印机。另外一个你可以选择的是 [toilet][2],它有自己的一套 ASCII 艺术风格的打印选项。 +你会发现 `figlet` 不是唯一的 Linux 终端横幅打印机。另外一个你可以选择的是 [toilet][2],它有一套自己的 ASCII 艺术风格的打印选项。 你有特别喜欢的命令行小玩具需要我介绍的吗?我们的日历基本上满了,但我们仍然希望在新的一年中展示一些很酷的命令行玩具。请在评论中留言,我会查看的。记得让我知道你对今天玩具的看法。 @@ -89,7 +90,7 @@ via: https://opensource.com/article/18/12/linux-toy-figlet 作者:[Jason Baker][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -97,4 +98,4 @@ via: https://opensource.com/article/18/12/linux-toy-figlet [b]: https://github.com/lujun9972 [1]: http://www.figlet.org/ [2]: http://caca.zoy.org/wiki/toilet -[3]: https://opensource.com/article/18/12/linux-toy-asciiquarium \ No newline at end of file +[3]: https://opensource.com/article/18/12/linux-toy-asciiquarium From 3b6bf63b54e5f8c6b5f637058a0cd2f929dfa007 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 9 Jan 2019 18:50:24 +0800 Subject: [PATCH 257/322] PUB:20181218 Use your Linux terminal to celebrate a banner year.md @geekpi https://linux.cn/article-10428-1.html --- ...1218 Use your Linux terminal to celebrate a banner year.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181218 Use your Linux terminal to celebrate a banner year.md (98%) diff --git a/translated/tech/20181218 Use your Linux terminal to celebrate a banner year.md b/published/20181218 Use your Linux terminal to celebrate a banner year.md similarity index 98% rename from translated/tech/20181218 Use your Linux terminal to celebrate a banner year.md rename to published/20181218 Use your Linux terminal to celebrate a banner year.md index f64124eee0..035577a5ef 100644 --- a/translated/tech/20181218 Use your Linux terminal to celebrate a banner year.md +++ b/published/20181218 Use your Linux terminal to celebrate a banner year.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10428-1.html) [#]: subject: (Use your Linux terminal to celebrate a banner year) [#]: via: (https://opensource.com/article/18/12/linux-toy-figlet) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) From c26388f4f07ec1aa92515234626fef50d5406bbd Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 9 Jan 2019 22:04:36 +0800 Subject: [PATCH 258/322] PRF:20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md @qhwdw --- ...y - Raspberry Pi- Lesson 0 Introduction.md | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/translated/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md b/translated/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md index 8f4f6a4bcc..e5754cdc89 100644 --- a/translated/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md +++ b/translated/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md @@ -1,40 +1,38 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) -[#]: reviewer: () -[#]: publisher: () -[#]: url: () +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) [#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 0 Introduction) [#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html) [#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) -计算机实验室 – 树莓派:课程 0:简介 +计算机实验室 – 树莓派:课程 0 简介 ====== 这个课程简介不包含实践内容,但它解释了一个操作系统的基本概念、汇编代码、和其它很重要的一些基本原理。如果你想直接进入实践环节,跳过本课程并不会有什么问题。 ### 1、操作系统 -一个操作系统就是一个非常复杂的程序。它的任务就是组织安排计算机上的其它程序,包括共享计算机的时间、内存、硬件和其它资源。你可能听说过的一些比较大的桌面操作系统家族有 GNU/Linux、Mac OS X 和 Microsoft Windows。其它的设备比如电话,也需要操作系统,它可能使用的操作系统是 Android、iOS 和 [Windows Phone][https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html#note1] +操作系统就是一个非常复杂的程序。它的任务就是组织安排计算机上的其它程序,包括共享计算机的时间、内存、硬件和其它资源。你可能听说过的一些比较大的桌面操作系统家族有 GNU/Linux、Mac OS X 和 Microsoft Windows。其它的设备比如电话,也需要操作系统,它可能使用的操作系统是 Android、iOS 和 [Windows Phone](https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html#note1)。 -由于操作系统是用来与计算机系统上的硬件进行交互的,所以它必须有系统上硬件专有的内容。为了能让操作系统适用于各种类型的计算机,发明了 **驱动程序** 的概念。驱动程序是为了能够让操作系统与特定的硬件进行交互而添加(并可删除)到操作系统上的一小部分代码。在本课程中,我们并不涉及如何创建可删除的驱动程序,而是专注于特定的一个硬件:树莓派。 +由于操作系统是用来与计算机系统上的硬件进行交互的,所以它必须了解系统上硬件专有的信息。为了能让操作系统适用于各种类型的计算机,发明了 **驱动程序** 的概念。驱动程序是为了能够让操作系统与特定的硬件进行交互而添加(并可删除)到操作系统上的一小部分代码。在本课程中,我们并不涉及如何创建可删除的驱动程序,而是专注于特定的一个硬件:树莓派。 操作系统有各种不同的设计方式,在本课程中,我们只触及操作系统设计的皮毛。本课程中,我们主要专注于操作系统与各种硬件的交互部分,因为这经常是比较棘手的部分,并且也是在网络上文档和帮助最少的部分。 ### 2、汇编代码 -``` -一个处理器每秒可以执行上百万的指令,但是这些指令必须要简单。 -``` +> 处理器每秒可以执行上百万的指令,但是这些指令必须要简单。 -本课程几乎要完全靠汇编代码来写。汇编代码非常接近计算机的底层。计算机其实是靠一个叫处理器的设备来工作的,处理器能够执行像加法这样的简单任务,还有一组叫做 **RAM** 的芯片,它能够用来保存数字。当计算机通电后,处理器执行程序员给定的一系列指令,这将导致内存中的数字发生变化,以及与连接的硬件进行交互。汇编代码只是将这些机器命令转换为人类可读的文本。 +本课程几乎要完全靠汇编代码来写。汇编代码非常接近计算机的底层。计算机其实是靠一个叫处理器的设备来工作的,处理器能够执行像加法这样的简单任务,还有一组叫做 RAM 的芯片,它能够用来保存数字。当计算机通电后,处理器执行程序员给定的一系列指令,这将导致内存中的数字发生变化,以及与连接的硬件进行交互。汇编代码只是将这些机器命令转换为人类可读的文本。 -常规的编程就是,程序员使用编程语言,比如 C++、Java、C#、Basic、等等来写代码,然后一个叫编译器的程序将程序员写的代码转换成汇编代码,然后进一步转换为[二进制代码][https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html#note2]。二进制代码才是计算机真正能够理解的东西,但它是人类无法读取的东西。汇编代码比二进制代码好一点,至少它的命令是人类可读的,但它仍然让人很沮丧。请记住,你用汇编代码写的每个命令都是处理器可以直接认识的,因此这些命令设计的很简单,因为物理电路必须能够处理每个命令。 +常规的编程就是,程序员使用编程语言,比如 C++、Java、C#、Basic 等等来写代码,然后一个叫编译器的程序将程序员写的代码转换成汇编代码,然后进一步转换为[二进制代码](https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html#note2)。二进制代码才是计算机真正能够理解的东西,但它是人类无法读取的东西。汇编代码比二进制代码好一点,至少它的命令是人类可读的,但它仍然让人很沮丧。请记住,你用汇编代码写的每个命令都是处理器可以直接认识的,因此这些命令设计的很简单,因为物理电路必须能够处理每个命令。 ![Compiler process][1] 和普通编程一样,也有很多不同的汇编代码编程语言,但与普通编程不一样的是,每个汇编编程语言是面对不同的处理器的,每种处理器设计为去理解不同的语言。因此,用一个针对某种机器设计的汇编语言所写的汇编代码,是不能在其它种类的机器上运行的。很多情况下,这都是一个大灾难,因此每个程序都必须在使用它的不同种类的机器上重写一遍,但对于操作系统,这不是个问题,因为在不同的硬件上它必须得重写。尽管如此,大多数操作系统都是用 C++ 或 C 来写的,这样它们就可以很容易地在不同种类的硬件上使用,只需要重写那些必须用汇编代码来实现的部分即可。 -现在,你已经准备好进入第一节课了,它是 [课程 1:OK01][2] +现在,你已经准备好进入第一节课了,它是 [课程 1 OK01][2] -------------------------------------------------------------------------------- @@ -43,7 +41,7 @@ via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.htm 作者:[Robert Mullins][a] 选题:[lujun9972][b] 译者:[qhwdw](https://github.com/qhwdw) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 23f4104d1a40de6f308824ec3f7ffbdf628a336b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 9 Jan 2019 22:05:11 +0800 Subject: [PATCH 259/322] PUB:20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md @qhwdw https://linux.cn/article-10429-1.html --- ...mputer Laboratory - Raspberry Pi- Lesson 0 Introduction.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md (98%) diff --git a/translated/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md b/published/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md similarity index 98% rename from translated/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md rename to published/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md index e5754cdc89..0e108b4f15 100644 --- a/translated/tech/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md +++ b/published/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (qhwdw) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10429-1.html) [#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 0 Introduction) [#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html) [#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) From 1779c949dd1418b4673f108fd1029af94b13fbc7 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 9 Jan 2019 22:54:14 +0800 Subject: [PATCH 260/322] PRF:20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md --- ...Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md b/published/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md index 0e108b4f15..a9442dc04c 100644 --- a/published/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md +++ b/published/20120104 Computer Laboratory - Raspberry Pi- Lesson 0 Introduction.md @@ -7,7 +7,7 @@ [#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/introduction.html) [#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) -计算机实验室 – 树莓派:课程 0 简介 +计算机实验室之树莓派:课程 0 简介 ====== 这个课程简介不包含实践内容,但它解释了一个操作系统的基本概念、汇编代码、和其它很重要的一些基本原理。如果你想直接进入实践环节,跳过本课程并不会有什么问题。 From e9168c8a9c990848284f82760268910607917987 Mon Sep 17 00:00:00 2001 From: dianbanjiu Date: Wed, 9 Jan 2019 23:24:18 +0800 Subject: [PATCH 261/322] translated --- ...Programs Installed From Source In Linux.md | 200 ------------------ ...Programs Installed From Source In Linux.md | 200 ++++++++++++++++++ 2 files changed, 200 insertions(+), 200 deletions(-) delete mode 100644 sources/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md create mode 100644 translated/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md diff --git a/sources/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md b/sources/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md deleted file mode 100644 index 1d3f35beaf..0000000000 --- a/sources/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md +++ /dev/null @@ -1,200 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( dianbanjiu ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (An Easy Way To Remove Programs Installed From Source In Linux) -[#]: via: (https://www.ostechnix.com/an-easy-way-to-remove-programs-installed-from-source-in-linux/) -[#]: author: (SK https://www.ostechnix.com/author/sk/) - -An Easy Way To Remove Programs Installed From Source In Linux -====== - -![](https://www.ostechnix.com/wp-content/uploads/2018/12/stow-1-720x340.jpg) - -Not all programs available in the official or third-party repositories, so you can’t install them using the regular package managers. Some times, you have to install the programs by manually compiling from source. As you may already know, when you install programs from source, the package files will be copied to multiple locations, such as **/usr/local/bin** , **/usr/local/etc/** , on the filesystem. If the installed program from source doesn’t have a built-in uninstaller, it is going to be a tedious task to remove the packages when you don’t need it anymore. You may need to spend couple (or several) minutes to find those package files and remove them manually. This is what I have been doing up until I stumbled upon a utility named **“GNU Stow”**. Thankfully, Stow has a fantastic way to easily manage programs installed from source. - -To quote the official website, - -> **GNU Stow is a symlink farm manager which takes distinct packages of software and/or data located in separate directories on the filesystem, and makes them appear to be installed in the same place.** - -To put this simply, Stow helps you to keep the package files organized in a way to easily manageable. In this method, the files will not be copied to multiple locations. Instead, all files are saved in a specific folder, usually under the program name itself, and Stow creates symbolic links to all the programs’ files into the appropriate places. For example, **/usr/local/bin** could contain symlinks to files within **/usr/local/stow/vim/bin** , **/usr/local/stow/python/bin** etc., and likewise recursively for any other subdirectories such as **…/share** , **…/man** , and so on. In this tutorial, I will show you how to easily manage programs installed from source using Stow with a practical example. Read on. - -### Installing GNU Stow - -GNU Stow is available in the default repositories of popular Linux operating systems. - -On **Arch Linux** and its variants, run the following command to install Stow. - -``` -$ sudo pacman -S stow -``` - -On **Debian** , **Ubuntu** , **Linux Mint** : - -``` -$ sudo apt install stow -``` - -On **Fedora** : - -``` -$ sudo dnf install stow -``` - -On **RHEL/CentOS** : - -``` -$ sudo yum install epel-release - -$ sudo yum install stow -``` - -### Easily Remove Programs Installed From Source In Linux - -As I already mentioned earlier, all program files of a package will be saved in a root folder located in **/usr/local/stow/**. Under this root or parent directory, each package will be saved in its own private sub-directory. For example, if we install Vim editor from source, all program files and directories related to Vim will be saved under **/usr/local/stow/vim** folder. If you install python from source, all files related to python will be kept under **/usr/local/stow/python** and so on. - -Let me install a program, for example **hello** , from source. - -First download the ‘hello’ program’s tarball. - -``` -$ wget http://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz -``` - -Extract the downloaded tarball using command: - -``` -$ tar -zxvf hello-2.10.tar.gz -``` - -The above command will create a directory named ‘hello-2.10’ in the current working directory and extract all contents in it. - -Switch to the extracted directory: - -``` -$ cd hello-2.10/ -``` - -Run the following command with –prefix option. - -``` -$ ./configure --prefix=/usr/local/stow/hello -``` - -The above command will save the build files in the specified location i.e **/usr/local/stow/hello** in our case. - -Finally, build and install the hello program using the following commands: - -``` -$ make - -$ sudo make install -``` - -That’s it. The hello program has been installed in **/usr/local/stow/hello/** location. You can verify it with ‘ls’ command as shown below. - -``` -$ ls /usr/local/stow/hello/ -bin share -``` - -Finally, go to the **/usr/local/stow/** directory and run the following command to generate the necessary symlinks. - -``` -$ cd /usr/local/stow/ - -$ sudo stow hello -``` - -All done! - -What just happened is all the files and directories contained in the hello package have been symlinked to the directory **/usr/local/**. In other words, **/usr/local/stow/hello/bin** has been symlinked to **/usr/local/bin** and **/usr/local/stow/hello/share** has been symlinked to **/usr/local/share** and **/usr/local/stow/hello/share/man** has been symlinked to **/usr/local/share/man** and so on. - -You can verify them using ‘ls’ command: - -``` -$ ls /usr/local/bin/ -hello -``` - -Let us check if the hello program is working or not using command: - -``` -$ hello -Hello, world! -``` - -Yeah, it is working!! - -Similarly, you can install programs as described above under its own sub-directory. - -Here is the contents of the Stow root directory: - -``` -$ tree /usr/local/stow/ -``` - -![][2] - -See? The hello program is installed /usr/local/stow/hello/ location. Like wise, all packages will be kept under their own directory. - -Here comes the main part. Let us remove the hello program. To do so, go to **/usr/local/stow/** directory: - -``` -$ cd /usr/local/stow/ -``` - -..and run the following command: - -``` -$ sudo stow --delete hello -``` - -The hello program has just been removed. You can verify if it is really removed using command: - -``` -$ hello --bash: /usr/local/bin/hello: No such file or directory -``` - -![][3] - -See? Hello program is removed! - -Please note that Stow has removed the symlinks only. All program files and directories related to hello program are still available in **/usr/local/stow/hello** folder. So, you can install the hello program again without having to download the actual source file. If you don’t want it anymore, simply delete the folder. - -``` -$ sudo rm -fr /usr/local/stow/hello/ -``` - -To know more details about Stow, refer the man pages. - -``` -$ man stow -``` - - -Stow helps you to uninstall the programs as easily as you install them. If you are wondering how to effectively manage a lot of programs installed from source, GNU Stow is one such program to make this task a lot easier. Give it a try, you won’t be disappointed. - -And, that’s all for now. Hope this was useful. More good stuffs to come. Stay tuned! - -Cheers! - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/an-easy-way-to-remove-programs-installed-from-source-in-linux/ - -作者:[SK][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.ostechnix.com/author/sk/ -[b]: https://github.com/lujun9972 -[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[2]: http://www.ostechnix.com/wp-content/uploads/2018/12/tree-command.png -[3]: http://www.ostechnix.com/wp-content/uploads/2018/12/hello-world.png diff --git a/translated/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md b/translated/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md new file mode 100644 index 0000000000..f33ff7af14 --- /dev/null +++ b/translated/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md @@ -0,0 +1,200 @@ +[#]: collector: (lujun9972) +[#]: translator: ( dianbanjiu ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (An Easy Way To Remove Programs Installed From Source In Linux) +[#]: via: (https://www.ostechnix.com/an-easy-way-to-remove-programs-installed-from-source-in-linux/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +在 Linux 中移除从源中安装的程序的一种简单的方法 +====== + +![](https://www.ostechnix.com/wp-content/uploads/2018/12/stow-1-720x340.jpg) + +不是所有的程序都可以在官方或者第三方库中可用,因此你不能使用常规的包管理来安装它们。有时你不得不从源代码中手动构建这些程序。就跟你已经知道的一样,当你从源代码中安装一个程序的时候,这个包文件将会复制到本地的多个位置,例如 **/usr/local/bin**,**/usr/local/etc/**。如果从源代码中安装的程序没有内建的卸载器,当你不再需要这个程序的时候,卸载它就会很麻烦。你可能会话费双倍(甚至更多)的时间找出这些包文件然后手动删除它们。我以前一直是这样做的,直到我发现了 **GNU Stow**。谢天谢地,Stow 有一个很棒的方法可以轻松管理从源代码安装的程序。 + + +引用官方网站里的一段介绍, + +> **GNU Stow 是一个符号链接管理器,它可以收集文件系统上不同目录中的不同软件和/或数据包,使它们看起来像是一个整体** + +简单来说,Stow 帮助你把这些程序文件以一种容易管理的方式组织在了一起。在这个方法中,文件将不会被复制到多个位置。所有的这些文件都会被保存在一个特定的文件夹中,通常是以程序名命名的,然后 Stow 会在一个合适的位置为所有的程序文件创建符号连接。比如 **/usr/local/bin** 中会包含 **/usr/local/stow/vim/bin**,**/usr/local/stow/python/bin** 中文件的符号链接。并且同样递归地用于其他的任何的子目录,例如 **.../share**,**.../man**,等等。在这篇教程中,我将会举例教你如何轻松地使用 Stow 管理从源中安装的程序。 + +### 安装 GNU Stow + +GNU Stow 在流行 Linux 操作系统的默认库中都可用。 + +在 **Arch Linux** 及它的衍生版本中,运行下面的命令安装 Stow。 + +``` +$ sudo pacman -S stow +``` + +在 **Debian**,**Ubuntu**,**Linux Mint** 上: + +``` +$ sudo apt install stow +``` + +在 **Fedora** 上: + +``` +$ sudo dnf install stow +``` +在 **RHEL/CentOS** 上: + +``` +$ sudo yum install epel-release + +$ sudo yum install stow +``` + +### 在 Linux 上轻松移除从源代码安装的程序 + +就像我之前提到的,所有包的程序文件都将被保存在位于 **/usr/local/stow/** 的一个根文件夹。在这个根文件夹或者父目录之下,每个包都将保存在对应的子目录中。例如,如果我们从源代码中安装了 Vim 编辑器,所有关联到 Vim 的程序文件和目录都将保存在 **/usr/local/stow/vim** 文件夹之下。如果你从源代码中安装了 Python,所有关联到 python 的文件都会保存在 **/usr/local/stow/python** 之下。 + +我现在从源代码中来安装一个叫做 **hello** 的程序。 + +首先下载 ‘hello’ 程序的压缩包。 + +``` +$ wget http://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz +``` + +使用下面的命令解压压缩包: + +``` +$ tar -zxvf hello-2.10.tar.gz +``` + +上面的命令将会在当前工作目录下创建一个叫做 ‘hello-2.10’ 的目录,并且提取压缩包中的所有内容到其中去。 + +切换到这个目录当中: + +``` +$ cd hello-2.10/ +``` + +运行下面的命令,并且添加 -prefix 选项。 + +``` +$ ./configure --prefix=/usr/local/stow/hello +``` + +上面的命令将会保存构建文件到一个指定位置,在这个例子中是 **/usr/local/stow/hello**。 + +最后,使用下面的命令构建并安装 hello 这个程序: + +``` +$ make + +$ sudo make install +``` + +就这样。hello 这个程序就已经安装在 **/usr/local/stow/hello/** 这个位置了。你可以使用下面的 ‘ls’ 命令确认一下。 + +``` +$ ls /usr/local/stow/hello/ +bin share +``` + +最后,进入 **/usr/local/stow/** 目录,运行下面的命令来生成必要的符号链接。 + +``` +$ cd /usr/local/stow/ + +$ sudo stow hello +``` + +大功告成! + +刚才那一步是将包含在 hello 这个程序中的所有文件或者目录创建了链接到 **/usr/local/** 目录中。换一种说法, **/usr/local/stow/hello/bin** 已经链接到 **/usr/local/share**,以及 **/usr/local/stow/hello/share/man** 已经链接到 **/usr/local/share**,还有 **/usr/local/stow/hello/share/man** 已经链接到 **/usr/local/share/man**。 + +你可以使用 ‘ls’ 命令来确认一下: + +``` +$ ls /usr/local/bin/ +hello +``` + +可以使用下面的命令来确认 hello 这个程序是否可以正常工作了: + +``` +$ hello +Hello, world! +``` + +很好,它已经开始工作了!! + +类似地,你可以像上面描述的那样安装程序到它对应的子目录下。 + +下面是 Stow 根目录包含的内容: + +``` +$ tree /usr/local/stow/ +``` + +![][2] + +看,hello 这个程序已经安装在 /usr/local/stow/hello/ 下。同样地,所有的包都将保存在它们对应的目录之下。 + +下面进入主要环节,移除 hello 这个程序。首先进入 **/usr/local/stow/** 目录: + +``` +$ cd /usr/local/stow/ +``` + +.. 然后运行下面的命令: + +``` +$ sudo stow --delete hello +``` + +hello 这个程序就会被移除了。你可以使用下面的命令确认它是否真的被移除了: + +``` +$ hello +-bash: /usr/local/bin/hello: No such file or directory +``` + +![][3] + +看, Hello 已经被移除了! + +请注意 Stow 仅仅只移除了符号链接。所有与 hello 这个程序相关的文件或者目录还保存在 **/usr/local/stow/hello** 目录下。所以你无需再次下载源文件就可以再次安装 hello 这个程序。如果你不再需要它了,直接删除这个文件夹即可。 + +``` +$ sudo rm -fr /usr/local/stow/hello/ +``` + +想了解更多 Stow 的细节,请参阅 man 手册。 + +``` +$ man stow +``` + + +Stow 可以像安装程序一样轻松地帮你移除它。如果你想知道如何高效的管理很多从源代码中安装的程序,GNU Stow 就是一个使得这个任务更加轻松的一个选择,尝试一下,你一定不会失望的。 + +这就是所有的内容了,希望对你有所帮助。还有更多干活即将到来,可以期待一下的! + +祝近祺! + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/an-easy-way-to-remove-programs-installed-from-source-in-linux/ + +作者:[SK][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: http://www.ostechnix.com/wp-content/uploads/2018/12/tree-command.png +[3]: http://www.ostechnix.com/wp-content/uploads/2018/12/hello-world.png From 49da1fe38c0b3a7eb302a51bc6edca24bfc0bbd2 Mon Sep 17 00:00:00 2001 From: runningwater Date: Thu, 10 Jan 2019 00:44:16 +0800 Subject: [PATCH 262/322] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20170921 The Rise and Rise of JSON.md | 102 ------------------ .../20170921 The Rise and Rise of JSON.md | 102 ++++++++++++++++++ 2 files changed, 102 insertions(+), 102 deletions(-) delete mode 100644 sources/talk/20170921 The Rise and Rise of JSON.md create mode 100644 translated/talk/20170921 The Rise and Rise of JSON.md diff --git a/sources/talk/20170921 The Rise and Rise of JSON.md b/sources/talk/20170921 The Rise and Rise of JSON.md deleted file mode 100644 index f6d54edfc9..0000000000 --- a/sources/talk/20170921 The Rise and Rise of JSON.md +++ /dev/null @@ -1,102 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (runningwater) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: subject: (The Rise and Rise of JSON) -[#]: via: ( https://twobithistory.org/2017/09/21/the-rise-and-rise-of-json.html) -[#]: author: (https://twobithistory.org) -[#]: url: ( ) - -The Rise and Rise of JSON -====== -JSON has taken over the world. Today, when any two applications communicate with each other across the internet, odds are they do so using JSON. It has been adopted by all the big players: Of the ten most popular web APIs, a list consisting mostly of APIs offered by major companies like Google, Facebook, and Twitter, only one API exposes data in XML rather than JSON. Twitter, to take an illustrative example from that list, supported XML until 2013, when it released a new version of its API that dropped XML in favor of using JSON exclusively. JSON has also been widely adopted by the programming rank and file: According to Stack Overflow, a question and answer site for programmers, more questions are now asked about JSON than about any other data interchange format. - -![][1] - -XML still survives in many places. It is used across the web for SVGs and for RSS and Atom feeds. When Android developers want to declare that their app requires a permission from the user, they do so in their app’s manifest, which is written in XML. XML also isn’t the only alternative to JSON—some people now use technologies like YAML or Google’s Protocol Buffers. But these are nowhere near as popular as JSON. For the time being, JSON appears to be the go-to format for communicating with other programs over the internet. - -JSON’s dominance is surprising when you consider that as recently as 2005 the web world was salivating over the potential of “Asynchronous JavaScript and XML” and not “Asynchronous JavaScript and JSON.” It is of course possible that this had nothing to do with the relative popularity of the two formats at the time and reflects only that “AJAX” must have seemed a more appealing acronym than “AJAJ.” But even if some people were already using JSON instead of XML in 2005 (and in fact not many people were yet), one still wonders how XML’s fortunes could have declined so precipitously that a mere decade or so later “Asynchronous JavaScript and XML” has become an ironic misnomer. What happened in that decade? How did JSON supersede XML in so many applications? And who came up with this data format now depended on by engineers and systems all over the world? - -### The Birth of JSON - -The first JSON message was sent in April of 2001. Since this was a historically significant moment in computing, the message was sent from a computer in a Bay-Area garage. Douglas Crockford and Chip Morningstar, co-founders of a technology consulting company called State Software, had gathered in Morningstar’s garage to test out an idea. - -Crockford and Morningstar were trying to build AJAX applications well before the term “AJAX” had been coined. Browser support for what they were attempting was not good. They wanted to pass data to their application after the initial page load, but they had not found a way to do this that would work across all the browsers they were targeting. - -Though it’s hard to believe today, Internet Explorer represented the bleeding edge of web browsing in 2001. As early as 1999, Internet Explorer 5 supported a primordial form of XMLHttpRequest, which programmers could access using a framework called ActiveX. Crockford and Morningstar could have used this technology to fetch data for their application, but they could not have used the same solution in Netscape 4, another browser that they sought to support. So Crockford and Morningstar had to use a different system that worked in both browsers. - -The first JSON message looked like this: - -``` - -``` - -Only a small part of the message resembles JSON as we know it today. The message itself is actually an HTML document containing some JavaScript. The part that resembles JSON is just a JavaScript object literal being passed to a function called `receive()`. - -Crockford and Morningstar had decided that they could abuse an HTML frame to send themselves data. They could point a frame at a URL that would return an HTML document like the one above. When the HTML was received, the JavaScript would be run, passing the object literal back to the application. This worked as long as you were careful to sidestep browser protections preventing a sub-window from accessing its parent; you can see that Crockford and Mornginstar did that by explicitly setting the document domain. (This frame-based technique, sometimes called the hidden frame technique, was commonly used in the late 90s before the widespread implementation of XMLHttpRequest.) - -The amazing thing about the first JSON message is that it’s not obviously the first usage of a new kind of data format at all. It’s just JavaScript! In fact the idea of using JavaScript this way is so straightforward that Crockford himself has said that he wasn’t the first person to do it—he claims that somebody at Netscape was using JavaScript array literals to communicate information as early as 1996. Since the message is just JavaScript, it doesn’t require any kind of special parsing. The JavaScript interpreter can do it all. - -The first ever JSON message actually ran afoul of the JavaScript interpreter. JavaScript reserves an enormous number of words—there are 64 reserved words as of ECMAScript 6—and Crockford and Morningstar had unwittingly used one in their message. They had used `do` as a key, but `do` is reserved. Since JavaScript has so many reserved words, Crockford decided that, rather than avoid using all those reserved words, he would just mandate that all JSON keys be quoted. A quoted key would be treated as a string by the JavaScript interpreter, meaning that reserved words could be used safely. This is why JSON keys are quoted to this day. - -Crockford and Morningstar realized they had something that could be used in all sorts of applications. They wanted to name their format “JSML”, for JavaScript Markup Language, but found that the acronym was already being used for something called Java Speech Markup Language. So they decided to go with “JavaScript Object Notation”, or JSON. They began pitching it to clients but soon found that clients were unwilling to take a chance on an unknown technology that lacked an official specification. So Crockford decided he would write one. - -In 2002, Crockford bought the domain [JSON.org][2] and put up the JSON grammar and an example implementation of a parser. The website is still up, though it now includes a prominent link to the JSON ECMA standard ratified in 2013. After putting up the website, Crockford did little more to promote JSON, but soon found that lots of people were submitting JSON parser implementations in all sorts of different programming languages. JSON’s lineage clearly tied it to JavaScript, but it became apparent that JSON was well-suited to data interchange between arbitrary pairs of languages. - -### Doing AJAX Wrong - -JSON got a big boost in 2005. That year, a web designer and developer named Jesse James Garrett coined the term “AJAX” in a blog post. He was careful to stress that AJAX wasn’t any one new technology, but rather “several technologies, each flourishing in its own right, coming together in powerful new ways.” AJAX was the name that Garrett was giving to a new approach to web application development that he had noticed gaining favor. His blog post went on to describe how developers could leverage JavaScript and XMLHttpRequest to build new kinds of applications that were more responsive and stateful than the typical web page. He pointed to Gmail and Flickr as examples of websites already relying on AJAX techniques. - -The “X” in “AJAX” stood for XML, of course. But in a follow-up Q&A post, Garrett pointed to JSON as an entirely acceptable alternative to XML. He wrote that “XML is the most fully-developed means of getting data in and out of an AJAX client, but there’s no reason you couldn’t accomplish the same effects using a technology like JavaScript Object Notation or any similar means of structuring data.” - -Developers indeed found that they could easily use JSON to build AJAX applications and many came to prefer it to XML. And so, ironically, the interest in AJAX led to an explosion in JSON’s popularity. It was around this time that JSON drew the attention of the blogosphere. - -In 2006, Dave Winer, a prolific blogger and the engineer behind a number of XML-based technologies such as RSS and XML-RPC, complained that JSON was reinventing XML for no good reason. Though one might think that a contest between data interchange formats would be unlikely to engender death threats, Winer wrote: - -> No doubt I can write a routine to parse [JSON], but look at how deep they went to re-invent, XML itself wasn’t good enough for them, for some reason (I’d love to hear the reason). Who did this travesty? Let’s find a tree and string them up. Now. - -It’s easy to understand Winer’s frustration. XML has never been widely loved. Even Winer has said that he does not love XML. But XML was designed to be a system that could be used by everyone for almost anything imaginable. To that end, XML is actually a meta-language that allows you to define domain-specific languages for individual applications—RSS, the web feed technology, and SOAP (Simple Object Access Protocol) are examples. Winer felt that it was important to work toward consensus because of all the benefits a common interchange format could bring. He felt that XML’s flexibility should be able to accommodate everybody’s needs. And yet here was JSON, a format offering no benefits over XML except those enabled by throwing out the cruft that made XML so flexible. - -Crockford saw Winer’s blog post and left a comment on it. In response to the charge that JSON was reinventing XML, Crockford wrote, “The good thing about reinventing the wheel is that you can get a round one.” - -### JSON vs XML - -By 2014, JSON had been officially specified by both an ECMA standard and an RFC. It had its own MIME type. JSON had made it to the big leagues. - -Why did JSON become so much more popular than XML? - -On [JSON.org][2], Crockford summarizes some of JSON’s advantages over XML. He writes that JSON is easier for both humans and machines to understand, since its syntax is minimal and its structure is predictable. Other bloggers have focused on XML’s verbosity and “the angle bracket tax.” Each opening tag in XML must be matched with a closing tag, meaning that an XML document contains a lot of redundant information. This can make an XML document much larger than an equivalent JSON document when uncompressed, but, perhaps more importantly, it also makes an XML document harder to read. - -Crockford has also claimed that another enormous advantage for JSON is that JSON was designed as a data interchange format. It was meant to carry structured information between programs from the very beginning. XML, though it has been used for the same purpose, was originally designed as a document markup language. It evolved from SGML (Standard Generalized Markup Language), which in turn evolved from a markup language called Scribe, intended as a word processing system similar to LaTeX. In XML, a tag can contain what is called “mixed content,” or text with inline tags surrounding words or phrases. This recalls the image of an editor marking up a manuscript with a red or blue pen, which is arguably the central metaphor of a markup language. JSON, on the other hand, does not support a clear analogue to mixed content, but that means that its structure can be simpler. A document is best modeled as a tree, but by throwing out the document idea Crockford could limit JSON to dictionaries and arrays, the basic and familiar elements all programmers use to build their programs. - -Finally, my own hunch is that people disliked XML because it was confusing, and it was confusing because it seemed to come in so many different flavors. At first blush, it’s not obvious where the line is between XML proper and its sub-languages like RSS, ATOM, SOAP, or SVG. The first lines of a typical XML document establish the XML version and then the particular sub-language the XML document should conform to. That is a lot of variation to account for already, especially when compared to JSON, which is so straightforward that no new version of the JSON specification is ever expected to be written. The designers of XML, in their attempt to make XML the one data interchange format to rule them all, fell victim to that classic programmer’s pitfall: over-engineering. XML was so generalized that it was hard to use for something simple. - -In 2000, a campaign was launched to get HTML to conform to the XML standard. A specification was published for XML-compliant HTML, thereafter known as XHTML. Some browser vendors immediately started supporting the new standard, but it quickly became obvious that the vast HTML-producing public were unwilling to revise their habits. The new standard called for stricter validation of XHTML than had been the norm for HTML, but too many websites depended on HTML’s forgiving rules. By 2009, an attempt to write a second version of the XHTML standard was aborted when it became clear that the future of HTML was going to be HTML5, a standard that did not insist on XML compliance. - -If the XHTML effort had succeeded, then maybe XML would have become the common data format that its designers hoped it would be. Imagine a world in which HTML documents and API responses had the exact same structure. In such a world, JSON might not have become as ubiquitous as it is today. But I read the failure of XHTML as a kind of moral defeat for the XML camp. If XML wasn’t the best tool for HTML, then maybe there were better tools out there for other applications also. In that world, our world, it is easy to see how a format as simple and narrowly tailored as JSON could find great success. - -If you enjoyed this post, more like it come out every two weeks! Follow [@TwoBitHistory][3] on Twitter or subscribe to the [RSS feed][4] to make sure you know when a new post is out. - --------------------------------------------------------------------------------- - -via: https://twobithistory.org/2017/09/21/the-rise-and-rise-of-json.html - -作者:[Two-Bit History][a] -选题:[lujun9972][b] -译者:[runningwater](https://github.com/runningwater) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://twobithistory.org -[b]: https://github.com/lujun9972 -[1]: https://twobithistory.org/images/json.svg -[2]: http://JSON.org -[3]: https://twitter.com/TwoBitHistory -[4]: https://twobithistory.org/feed.xml diff --git a/translated/talk/20170921 The Rise and Rise of JSON.md b/translated/talk/20170921 The Rise and Rise of JSON.md new file mode 100644 index 0000000000..e5eb3b2dd6 --- /dev/null +++ b/translated/talk/20170921 The Rise and Rise of JSON.md @@ -0,0 +1,102 @@ +[#]: collector: (lujun9972) +[#]: translator: (runningwater) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (The Rise and Rise of JSON) +[#]: via: ( https://twobithistory.org/2017/09/21/the-rise-and-rise-of-json.html) +[#]: author: (https://twobithistory.org) +[#]: url: ( ) + +JSON 的兴起与崛起 +====== +JSON 已经占领了全世界。当今,任何两个应用程序彼此通过网络通信时,它们很有可能在使用 JSON。它已被所有大型企业所采用:十大最受欢迎的 web API 接口(主要由 Google、Facebook 和 Twitter 提供的)列表中,仅仅只有一个 API 接口是以 XML 的格式开放数据的。Twitter 给这个 API 添加了一个说明性示例:XML 格式的支持到 2013 年结束,到时候会发布一个新版本的 API,取消 XML 格式,转而使用 JSON。JSON 也在程序编码级别和文件存储上被广泛采用:在 Stack Overflow(一个面向程序员的问答网站)上,现在更多的是关于 JSON 的问题,而不是其他的数据交换格式。 + +![][1] + +XML 仍然在很多地方存在。在网页上有 SVG 和 RSS 订阅服务、Atom 提供商。Android 开发者想要获得用户权限许可时,需要在其 APP 的 `manifest` 文件中声明。此文件是 XML 格式的。XML 的替代品也不仅仅只有 JSON,现在有很多人在使用 YAML 或 Google 的 Protocol Buffers 等技术,但这些技术的受欢迎程度远不如 JSON。目前来看,JSON 是应用程序在网络之间通信的首选协议格式。 +考虑到自 2005 年来网站编程世界对 “异步 JavaScript 和 XML” 而非 “异步 JavaScript 和 JSON” 技术潜力的垂涎欲滴状态,你可以发现 JSON 在其中的主导地位是如此让人惊讶。当然了,这可能与这两种通信格式的受欢迎程度无关,仅反映出 “AJAX” 似乎比 “AJAJ” 更具吸引力。但是,即使在 2015 年时有好些人已经用 JSON 来取代 XML 了(实际上还没有很多人),我们不禁要问 XML 的噩运来的如此之快,以至于短短十年左右,“异步 JavaScript 和 XML” 这个名称就成为一个很讽刺的误称。那个十年发生了什么?JSON 怎么会在那么多应用程序中取代了 XML?现在被全世界工程师和系统所使用、依赖的这种数据格式是谁提出的? + +### JSON 之诞生 + +2001 年 4 月,首个 JSON 格式的消息被发送。此消息是从旧金山湾区某车库的一台计算机发出的,这是计算机历史上重要的的时刻。Douglas Crockford 和 Chip Morningstar 是一家名为 State Software 的技术咨询公司的联合创始人,他们当时聚集在 Morningstar 的车库里测试某个想法,发出了此消息。 + +在 “AJAX” 这个术语被创造之前, Crockford 和 Morningstar 就已经在尝试构建好用的 AJAX 应用程序了。可是浏览器对其兼容性不好。他们想要在初始页面加载后就将数据传递给应用程序,但其目标要针对所有的浏览器,这就实现不了。 + +这在今天看来不太可信,但是要记得 2001 年的时候 Internet Explorer(IE)代表了网页浏览器的最前沿技术产品。早在 1999 年的时候,Internet Explorer 5 就支持 `XMLHttpRequest 对象原型`,开发者可以使用名为 ActiveX 的框架来访问此对象。 Crockford 和 Morningstar 可能是使用此技术来获取数据,但是在 Netscape 4 中(这是他们想要支持的另一种浏览器)就无法使用这种解决方案。为此 Crockford 和 Morningstar 只得开发不同的系统程序以兼容不同的浏览器。 + +第一条 JSON 消息如下所示: + +``` + +``` + +消息中只有一小部分类似于今天我们所知的 JSON,本身其实是一个包含有 JavaScript 的 HTML 文档。类似于 JSON 的部分只是传递给名为`receive()` 的函数的 JavaScript 对象。 + +Crockford 和 Morningstar 决定滥用 HTML 的 frame,以发送数据。敲入 URL 返回的 HTML 文档(如上所示)可以指向一个 frame 标签。当接收到 HTML 时,JavaScript 代码段一运行,就可以把数据对象如实地传递回应用程序。只要小心的回避浏览器保护策略,即子窗口不允许访问父窗口,这种技术就可以正常运行无误。可以看到 Crockford 和 Mornginstar 通过明确地设置文档域这种方法来达到其目的。(这种基于 frame 的技术,有时称为隐藏 frame 技术,通常在90年代后期,即广泛使用 XMLHttpRequest 技术之前使用。) + +关于第一个 JSON 消息的惊人之处在于它显然不是第一次就使用新的数据格式。它仅仅是 JavaScript!实际上,以此使用 JavaScript 的想法如此简单,Crockford 自己也说过他不是第一个这样做的人。他声称 Netscape 公司的某人早在 1996 年就使用 JavaScript 数组文字来交换信息。因为消息就是 JavaScript 本身,其不需要任何特殊解析工作,JavaScript 解释器就可搞定一切。 + +最初的 JSON 信息实际上与 JavaScript 解释器发生了冲突。JavaScript 使用了大量的单词来做为保留字(ECMAScript 6 版本的就有 64 个保留字),Crockford 和 Morningstar 无意中在其 JSON 中引入了一个保留字。他们使用了 `do` 这个关键字,但 `do` 是解释器中的保留字。因为 JavaScript 使用的保留字太多了,Crockford 做了决定:既然不可避免的要使用到这些保留字,那就要求所有的 JSON 关键字都加上引号。被引起来的关键字会被 JavaScript 解释器识别成字符串,其意味着那些保留字也可以放心安全的使用。这就为什么今天 JSON 关键字都要用引号引起来的原因。 + +Crockford 和 Morningstar 意识到这技术可以应用于各类应用系统。想给其命名为 “JSML”,即 JavaScript 标记语言,但发现这个缩写已经被叫做 Java 标记语言的所使用了。因此他们决定采用 “JavaScript Object Notation” 或 JSON 命名。他们开始向客户推销,但很快发现客户不愿意冒险使用缺乏官方规范的未知技术。所以 Crockford 决定写一个规范。 + +2002 年,Crockford 买下了 [JSON.org][2] 域名,放上了 JSON 语法及一个解释器的实例例子。网站仍然在运行,现在已经包含有 2013 年正式批准的 JSON ECMA 标准的显著链接。在网站建立后,Crockford 并没有过多的推广,但很快发现很多人都在提交各种不同编程语言的 JSON 解析器实现。JSON 的血统明显与 JavaScript 相关联,但很明显 JSON 非常适合于不同语言之间的数据交换。 + + +### AJAX 导致的误会 + +2005 年,JSON 有了一次大扩展。那一年,一位名叫 Jesse James Garrett 的网页设计师和开发人员在博客文章中创造了 “AJAX” 一词。他很谨慎地强调:AJAX 并不是新技术,而是 “好几种技术以某种强大的新方式汇集,其中的各技术各自发展。” AJAX 是 Garrett 给 Web 应用程序开发的新方法(其正获得青睐)的命名。他的博客文章接着描述了开发人员如何利用 JavaScript 和 XMLHttpRequest 对象构建新的应用程序,这些应用程序比传统的网页更具响应性和状态性。 他还举了 Gmail 和 Flickr的网站已经使用 AJAX 技术的例子。 + +当然了,“AJAX” 中的 “X” 代表 XML。但在随后的问答帖子中,Garrett 指出,JSON 可以完全替代 XML。他写道:虽然 XML 是 AJAX 客户端进行数据输入输出的最完善的技术,但要实现同样的效果,也可以使用像 JavaScript Object Notation (JSON)或任何类似的结构数据方法等技术。 + +开发者确实发现在构建 AJAX 应用程序时可以很容易的使用 JSON,并且很多人也开始喜欢上 XML。具有讽刺意味的是,对 AJAX 的兴趣逐渐的导致了 JSON 的普及。大约在这个时候,JSON 引起了博客圈的注意。 + +2006 年,Dave Winer,一位高产的博主,也是许多基于 XML 技术(如 RSS 和 XML-RPC)的后端开发工程师,他抱怨到 JSON 毫无疑问的正在重新发明 XML。虽然他认为数据交换格式之间的竞争不会导致某一技术的消亡,其写到: + +> 让我们来比较下重构某结构数据的深度及难度,由于某些原因(我很想听听原因),XML 自身做的并不好,所以毫无疑问地,我会写一个例程来解析 JSON 格式的数据。谁想干这荒谬之事?查找一棵树然后把节点串起来。可以立马试试。 + +很容易理解 Winer 的挫败感,事实上并没有太多人喜欢 XML。甚至 Winer 也说过他不喜欢 XML。但 XML 已被设计成一个可供任何人使用,并且几乎能想象到的事情都可以做到的系统。最终,XML 实际上是一门元语言,允许你为特定应用程序自定义特定域的语言。如 RSS、web feed 技术和 SOAP(简单对象访问协议)就是自定义的例子。Winer 认为由于通用交换格式所带来的好处,努力达成共识就很重要了。XML 的灵活性应该能满足任何人的需求,然而这里是 JSON 格式,其并不比 XML 更具优势,但其抛弃了 XML 中不好的设计,可以使 XML 更加的灵活。 + +Crockford 阅读了 Winer 的这篇文章并留下了评论。为了回应 JSON 重新发明 XML 的指责,Crockford 写到:重造轮子的好处是可以得到一个更好的轮子。 + +### JSON 与 XML 对比 + +到 2014 年,JSON 已经由 ECMA 标准和 RFC 官方正式认可。它有自己的 MIME 类型。JSON 已经进入了大联盟时代。 + +为什么 JSON 比 XML 更受欢迎? + +在 [JSON.org][2] 网站上,Crockford 总结了一些 JSON 的优势。他写到,JSON 的语法很小,其结构可预测,因此 JSON 更容易被人类和机器理解。其他博主不得不关注 XML 的冗长啰嗦及“尖括号负担”。XML 中每个开始标记都必须与结束标记匹配,这意味着 XML 文档包含大量的冗余信息。在未压缩时,XML 文档的体积比同信息量 JSON 文档的体积大很多,但是,更重要的,这也使 XML 文档更难以阅读。 + +Crockford 还声称 JSON 的另一个巨大优势是其被设计为数据交换格式。从一开始,它的目的就是在应用程序间传递结构化信息的。而 XML 呢,虽然也可以使用来传递数据,但其最初被设计为文档标记语言。它从 SGML(通用标准标记语言)演变而来,后来又从称为 Scribe 的标记语言是发展,旨在发展成类似于 LaTeX 一样的文字处理系统。XML 中,一个标签可以包含有所谓的“混合内容”或包含有围绕单词、短语的内嵌标签的文本。这会让人浮现出一副用红蓝笔记录的手稿画面,这是标记语言核心思想的形象比喻。另一方面,JSON 不支持对混合内容模型清晰构建,但也意味着它的结构足够简单。一份文档最好的建模就是一棵树,但 JSON 抛弃了文档的思想,Crockford 将 JSON 抽象限制为字典和数组,这是所有程序员构建程序时都会使用的最基本也最熟悉的元素。 + +最后,我认为人们不喜欢 XML 是因为它让人困惑。它让人迷惑的地方就是有很多不同的风格。乍一看,XML 本身及其子语言(如 RSS、ATOM、SOAP 或 SVG)之间的界限并不明显。通用 XML 文档创建的版本做为第一个基线,然后特定的子语言 XML 版本应该在这基础上变动。这就有需要变化需要考虑的了,特别是跟 JSON 做比较。JSON 的是如此简单,以至于 JSON 新版本规范甚至都不用重写。XML 的设计者试图将 XML 做为唯一的数据交换格式以支配所有格式,会掉入那个经典程序员的陷阱:过度工程化。XML 非常笼统及概念化,所以很难于简单的使用。 + +在 2000 年的时候,推出了一场活动,以使 HTML 符合 XML 标准。发布了一份符合 XML 标准的 HTML 开发规范,这就此后很出名的 XHTML。虽然一些浏览器供应商立即开始支持这个新标准,但也很明显,大部分基于 HTML 技术的开发者不愿意改变他们的习惯。新标准要求对 XHTML 文档进行严格的验证,而不是基于 HTML 的基准。但大多的网站都是依赖于 HTML 的宽容规则的。到 2009 年的时候,试图编写第二版本的 XHTML 标准已经流产,因为未来已清晰可见, HTML 将会发展为 HTML5(一种不强制要求接受 XML 规则的标准)。 + +如果 XHTML 的努力取得了成功,那么 XML 可能会成为其设计者希望的通用数据格式。想象一下,HTML 文档和 API 响应具有完全相同结构的世界。在这样的世界中,JSON 可能不会像现在一样普遍存在。但我读懂了, XHTML 的失败是 XML 阵营的一种道德失败。如果 XML 不是 HTML 的最佳工具,那么为了其他应用程序,也许会有更好的工具出现。在这个世界,我们的世界,很容易看到像 JSON 格式这样的足够简单、量体裁衣才能获得更大的成功。 + +如果你喜欢这博文,每两周会更新一次! 请在 Twitter 上关注 [@TwoBitHistory] [3] 或订阅 [RSS feed] [4], 以确保得到更新的通知。 + +-------------------------------------------------------------------------------- + +via: https://twobithistory.org/2017/09/21/the-rise-and-rise-of-json.html + +作者:[Two-Bit History][a] +选题:[lujun9972][b] +译者:[runningwater](https://github.com/runningwater) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://twobithistory.org +[b]: https://github.com/lujun9972 +[1]: https://twobithistory.org/images/json.svg +[2]: http://JSON.org +[3]: https://twitter.com/TwoBitHistory +[4]: https://twobithistory.org/feed.xml From 87f5817ae1fd72be56f496efbd551a7fb9e12e63 Mon Sep 17 00:00:00 2001 From: lctt-bot Date: Wed, 9 Jan 2019 17:00:31 +0000 Subject: [PATCH 263/322] =?UTF-8?q?Revert=20"=E6=8C=89=E7=85=A7=E6=96=B0?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E7=9A=84=E6=A0=BC=E5=BC=8F=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E4=BA=86=E4=BF=AE=E6=94=B9"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 4aa8c8b3ab82d775ebb54d0bf892ce8b0725de0d. --- .../20181127 What the open source community means to me.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sources/talk/20181127 What the open source community means to me.md b/sources/talk/20181127 What the open source community means to me.md index b092c1c33e..ec4d8f7a6d 100644 --- a/sources/talk/20181127 What the open source community means to me.md +++ b/sources/talk/20181127 What the open source community means to me.md @@ -1,5 +1,7 @@ +translating by seriouszyx + [#]: collector: (lujun9972) -[#]: translator: (seriouszyx) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: subject: (What the open source community means to me) From 98d66e63ad196c120917d130466a1814dc48c872 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 10 Jan 2019 08:45:55 +0800 Subject: [PATCH 264/322] translated --- ...ake your way across your Linux terminal.md | 52 ------------------- ...ake your way across your Linux terminal.md | 52 +++++++++++++++++++ 2 files changed, 52 insertions(+), 52 deletions(-) delete mode 100644 sources/tech/20181210 Snake your way across your Linux terminal.md create mode 100644 translated/tech/20181210 Snake your way across your Linux terminal.md diff --git a/sources/tech/20181210 Snake your way across your Linux terminal.md b/sources/tech/20181210 Snake your way across your Linux terminal.md deleted file mode 100644 index 32c4aba096..0000000000 --- a/sources/tech/20181210 Snake your way across your Linux terminal.md +++ /dev/null @@ -1,52 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Snake your way across your Linux terminal) -[#]: via: (https://opensource.com/article/18/12/linux-toy-snake) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) - -Snake your way across your Linux terminal -====== -Python isn't the only snake you'll find at the Linux command line with this classic 1970s game remake. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-snake.png?itok=oNhqUTDu) - -Welcome back to the Linux command-line toys advent calendar. If this is your first visit to the series, you might be asking yourself what a command-line toy even is. It's hard to say exactly, but my definition is anything that helps you have fun at the terminal. - -We've been on a roll with games over the weekend, and it was fun, so let's look at one more game today, Snake! - -Snake is an oldie but goodie; versions of it have been around seemingly forever. The first version I remember playing was one called [Nibbles][1] that came packaged with [QBasic][2] in the 1990s, and was probably pretty important to my understanding of what a programming language even was. Here I had the source code to a game that I could modify and just see what happens, and maybe learn something about what all of those funny little words that made up a programming language were all about. - -Today's [Snake][3] is written in Go, and while it's simple, it's just as much fun as the original. Like most simple old games, there are a ton of versions to choose from. In Snake's case, there's even a version in the classic [bsdgames][4] package that's almost certainly packaged for your distribution. - -But what I like about this version of Snake is that it's packaged for Docker so I can easily run it in one line from my terminal without worrying about anything disto-specific. That, and it makes use of 15 randomized food emojis for the snake to eat. I'm a sucker for food emojis. Anyway, give it a try using: - -``` -$ docker run -ti dyego/snake-game -``` - -This Snake is licensed as open source under an MIT license, and you can check out the source code [on GitHub][3]. -![](https://opensource.com/sites/default/files/uploads/linux-toy-snake-animated.gif) -Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. - -Check out yesterday's toy, [Powers of two, powers of Linux: 2048 at the command line][5], and check back tomorrow for another! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-snake - -作者:[Jason Baker][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/jason-baker -[b]: https://github.com/lujun9972 -[1]: https://en.wikipedia.org/wiki/Nibbles_(video_game) -[2]: https://en.wikipedia.org/wiki/QBasic -[3]: https://github.com/DyegoCosta/snake-game -[4]: https://github.com/vattam/BSDGames -[5]: https://opensource.com/article/18/12/linux-toy-2048 diff --git a/translated/tech/20181210 Snake your way across your Linux terminal.md b/translated/tech/20181210 Snake your way across your Linux terminal.md new file mode 100644 index 0000000000..a9525a9970 --- /dev/null +++ b/translated/tech/20181210 Snake your way across your Linux terminal.md @@ -0,0 +1,52 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Snake your way across your Linux terminal) +[#]: via: (https://opensource.com/article/18/12/linux-toy-snake) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +在 Linux 终端中玩贪吃蛇 +====== +有了这个 20 世纪 70 年代的经典重制游戏,Python 将不再是你在 Linux 终端能发现的唯一的“蛇”。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-snake.png?itok=oNhqUTDu) + +欢迎回到 Linux 命令行玩具日历。如果这是你第一次访问该系列,你可能会问自己甚至是命令行玩具。这很难确切地说,但我的定义是任何可以帮助你在终端玩得开心的东西。 + +我们这周都在介绍游戏,这很有趣,接着让我们看下今天的游戏,贪吃蛇! + +贪吃蛇是一个古老又很好的游戏。它的版本似乎一直存在着。我记得我第一次玩得版本是 20 世纪 90 年代与 [QBasic][2] 一起打包发布的 [Nibbles][1],它对我理解什么是编程语言起了很重要的作用。我有游戏的源码,我可以修改并查看会发生什么,并学习到一些组成这个编程语言的有趣词汇究竟是什么意思。 + +今天的[贪吃蛇][3]是用 Go 写的,它很简单并且和原版的游戏一样有趣。像大多数简单的老游戏一样,它有很多版本可供选择。这今天的贪吃蛇中,甚至还有一个经典的 [bsdgames][4] 形式的包,它几乎一定为你的发行版打包了。 + +但我喜欢的是用 Docker 打包的贪吃蛇,因为我可以轻松地在命令行中运行,而不用担心发行版相关的问题。这个版本使用 15 个随机的食物 emoji 图案让蛇来吃。我玩得不好。不管怎样,请试一下: + +``` +$ docker run -ti dyego/snake-game +``` + +这个贪吃蛇以 MIT 许可证开源,你可在 [Github][3] 取得源码。 +![](https://opensource.com/sites/default/files/uploads/linux-toy-snake-animated.gif) +你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。请在评论区留言,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 + +请查看昨天的玩具,[数字 2 的力量,Linux 的力量:在命令行中玩 2048][5],记得明天再来! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-snake + +作者:[Jason Baker][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jason-baker +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Nibbles_(video_game) +[2]: https://en.wikipedia.org/wiki/QBasic +[3]: https://github.com/DyegoCosta/snake-game +[4]: https://github.com/vattam/BSDGames +[5]: https://opensource.com/article/18/12/linux-toy-2048 \ No newline at end of file From 6b677ae39598b21a2eb68e61141d01905674f846 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 10 Jan 2019 08:49:11 +0800 Subject: [PATCH 265/322] translating --- ... Powers of two, powers of Linux- 2048 at the command line.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181209 Powers of two, powers of Linux- 2048 at the command line.md b/sources/tech/20181209 Powers of two, powers of Linux- 2048 at the command line.md index da1b241713..1c7d61329f 100644 --- a/sources/tech/20181209 Powers of two, powers of Linux- 2048 at the command line.md +++ b/sources/tech/20181209 Powers of two, powers of Linux- 2048 at the command line.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From ae82e4e8db2ce4ddb1ebede97abed6d224ba81a5 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 10 Jan 2019 11:16:50 +0800 Subject: [PATCH 266/322] =?UTF-8?q?=E5=9B=9E=E6=94=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20181127 What the open source community means to me.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sources/talk/20181127 What the open source community means to me.md b/sources/talk/20181127 What the open source community means to me.md index ec4d8f7a6d..a0f85846c9 100644 --- a/sources/talk/20181127 What the open source community means to me.md +++ b/sources/talk/20181127 What the open source community means to me.md @@ -1,12 +1,10 @@ -translating by seriouszyx - [#]: collector: (lujun9972) [#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: subject: (What the open source community means to me) [#]: via: (https://opensource.com/article/18/11/what-open-source-community-means-me) -[#]: author: ([Florian Effenberger](https://opensource.com/users/floeff)) +[#]: author: (Florian Effenberger https://opensource.com/users/floeff) [#]: url: ( ) What the open source community means to me From e3476218ac47ef2449b86d5119236780d1db6918 Mon Sep 17 00:00:00 2001 From: belitex Date: Thu, 10 Jan 2019 14:29:08 +0800 Subject: [PATCH 267/322] =?UTF-8?q?=E5=8F=96=E6=B6=88=E7=BF=BB=E8=AF=91GCC?= =?UTF-8?q?:Optimizing=20Linux,the=20Internet,and=20Everything?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...81009 GCC- Optimizing Linux, the Internet, and Everything.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/sources/talk/20181009 GCC- Optimizing Linux, the Internet, and Everything.md b/sources/talk/20181009 GCC- Optimizing Linux, the Internet, and Everything.md index 70405d6c70..a0f6acbc39 100644 --- a/sources/talk/20181009 GCC- Optimizing Linux, the Internet, and Everything.md +++ b/sources/talk/20181009 GCC- Optimizing Linux, the Internet, and Everything.md @@ -1,5 +1,3 @@ -translating by belitex - GCC: Optimizing Linux, the Internet, and Everything ====== From d2cc6ea9da6e0c296b0c0dddc3548cdfb92e1c1d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 10 Jan 2019 23:11:56 +0800 Subject: [PATCH 268/322] PRF:20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md @qhwdw --- ...GP - Part 7- Protecting Online Accounts.md | 95 ++++++------------- 1 file changed, 30 insertions(+), 65 deletions(-) diff --git a/translated/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md b/translated/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md index 4cf1f321c1..2d136e324e 100644 --- a/translated/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md +++ b/translated/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md @@ -1,98 +1,72 @@ 保护代码完整性(七):保护在线帐户 ====== +> 在这个系列的最后一篇当中,我们将为你展示如何用双因子认证保护你的在线账户。 + ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/online-pgp.jpg?itok=BWc_Bk6q) + 到目前为止,本系列教程已经提供了 PGP 的实用指南,包括基本概念和工具、生成和保护你的密钥的步骤。如果你错过了前面的文章,可以通过下面的链接查看。在本系列的最后一篇文章中,我们将为你保护在线帐户提供一个额外的指南,保护在线帐户是当今非常重要的一件事情。 -[第一部分:基本概念和工具][1] +- [第一部分:基本概念和工具][1] +- [第二部分:生成你的主密钥][2] +- [第三部分:生成 PGP 子密钥][3] +- [第四部分:将主密钥移到离线存储中][4] +- [第五部分:将子密钥移到硬件设备中][5] +- [第六部分:在 Git 中使用 PGP][6] -[第二部分:生成你的主密钥][2] - -[第三部分:生成 PGP 子密钥][3] - -[第四部分:将主密钥移到离线存储中][4] - -[第五部分:将子密钥移到硬件设备中][5] - -[第六部分:在 Git 中使用 PGP][6] - -### 清单 +#### 清单 * 取得一个具备 U2F 功能的设备(必要) - * 为你的在线帐户启用双因子认证(必要) - * GitHub/GitLab - * Google - * 社交媒体 - * 使用 U2F 作为主验证机制,使用 TOTP 作为备选(必要) - - - #### 考虑事项 -你可能注意到,很多在线开发者身份是捆绑了你的 email 地址。如果有人能够访问你的邮箱,他们就能够去做一些对你会产生危害的事情,进而会损害你作为自由软件开发者的声誉。应该像保护你的 PGP 密钥那样保护你的 email 地址。 +你可能注意到,很多在线开发者身份是捆绑了 email 地址的。如果有人能够访问你的邮箱,他们就能够去做一些对你会产生危害的事情,进而会损害你作为自由软件开发者的声誉。应该像保护你的 PGP 密钥那样保护你的 email 地址。 ##### 使用 Fido U2F 的双因子认证 -[双因子认证][7] 是一种提升帐户安全性的机制,它除了要求用户名和密码之外,还要求一个物理令牌。它的目标是即便在有人窃取了你的密码(通过按键记录器、肩窥攻击、或其它方式)的情况下,仍然能确保你的帐户安全,他们在没有得到你的一个专用的物理设备(“必备”的那个因子)的情况下,始终不能获取你的帐户。 +[双因子认证][7] 是一种提升帐户安全性的机制,它除了要求用户名和密码之外,还要求一个物理令牌。它的目标是即便在有人窃取了你的密码(通过按键记录器、肩窥攻击或其它方式)的情况下,仍然能确保你的帐户安全,他们在没有得到你的一个专用的物理设备(“必备”的那个因子)的情况下,始终不能获取你的帐户。 广为人知的双因子认证机制有: * 基于 SMS 的验证 - - * 借助智能手机应用的基于时间的一次性令牌(TOTP),比如 "Google Authenticator" 或类似解决方案 - + * 借助智能手机应用程序的基于时间的一次性令牌(TOTP),比如 Google Authenticator 或类似解决方案 * 支持 Fido U2F 的硬件令牌 - - - 基于 SMS 的验证很容易配置,但是它有如下的缺点:它在没有手机信号的地方无法使用(比如,建筑物的地下室),并且如果攻击者能够阻断或转向 SMS 信息,这种方式可能就会失败,比如通过克隆你的 SIM 卡。 -基于 TOTP 的多因子认证提供了比 SMS 更好的安全保护,但它也有一些重要的缺点(在你能够找到一个合适的令牌之前,你只能在智能手机中添加那么多令牌)。此外,还不能避免一个事实,那就是你的密钥最终还是保存在你的智能手机中 —— 它是一个复杂的、全球连接的设备,它有可能还没有及时从制造商那儿收到安全补丁。 +基于 TOTP 的多因子认证提供了比 SMS 更好的安全保护,但它也有一些重要的缺点(你要在智能手机中添加的那么多令牌中找到正确的那个)。此外,还不能避免一个事实,那就是你的密钥最终还是保存在你的智能手机中 —— 它是一个复杂的、全球连接的设备,它有可能还没有及时从制造商那儿收到安全补丁。 -更重要的是,不论是使用 TOTP 还是 SMS 的方法保护你免受诱骗攻击 —— 如果诱骗攻击者能够窃取你的帐户密码和双因子令牌,他们就可以在合法的站点上使用它们,访问你的帐户。 +更重要的是,不论是使用 TOTP 还是 SMS 的方法来保护你免受诱骗攻击 —— 如果诱骗攻击者能够窃取你的帐户密码和双因子令牌,他们就可以在合法的站点上使用它们,访问你的帐户。 [Fido U2F][8] 是一个按标准开发的专用设备,它能够提供双因子认证机制来对付诱骗攻击。U2F 协议在 USB 令牌中保存每个站点的的唯一密钥,如果你在任何合法站点以外的地方尝试使用它,它将阻止你,以防范偶然让攻击者获得你的密码和一次性令牌。 Chrome 和 Firefox 都支持 U2F 双因子认证,希望其它浏览器也能够提供对 U2F 的支持。 -##### 获得一个支持 Fido U2F 功能的令牌 +#### 获得一个支持 Fido U2F 功能的令牌 支持 U2F 的硬件令牌的 [可选目标很多][9],但如果你已经订购了一个支持智能卡的物理设备,那么你最好的选择就是 Yubikey 4,它两者都支持。 -##### 启用你的在线帐户的双因子认证 +#### 启用你的在线帐户的双因子认证 -你要确定你想去启用的选项,你的 email 提供商已经使用了(特别是 Google,它对 U2F 的支持非常好)。其它的站点这个功能应该是启用了: +你要确定想启用双因子认证的在线账户,你的 email 提供商已经使用了(特别是 Google,它对 U2F 的支持非常好)。其它的站点这个功能应该是启用了: * GitHub:当你上传你的 PGP 公钥时,你应该要想到,如果其他人能够获得访问你的帐户,他们可以用他们自己的 PGP 公钥替换掉你的 PGP 公钥。如果在 GitHub 上发布代码,你应该使用 U2F 认证来保护你的帐户安全。 - * GitLab:理由同上 - * Google:如果你有 google 帐户,你就惊奇地发现,许多帐户都允许以 Google 帐户来代替站点专用的认证来登入它们。 - * Facebook:理由同上,许多在线站点都提供一个选择让你以 Facebook 的帐户来认证。即便你不使用 Facebook 也应该使用双因子认证来保护你的 Facebook 帐户。 - * 你认为必要的其它站点。查看 [dongleauth.info][10] 去找找灵感。 - - - -##### 如有可能,配置 TOTP 作为备选 +#### 如有可能,配置 TOTP 作为备选 许多站点都允许你配置多个双因子认证机制,推荐的设置是: * U2F 令牌作为主认证机制 - - * TOTP 手机 app 作为辅助认证机制 - - - + * TOTP 手机应用作为辅助认证机制 通过这种方式,即便你丢失了你的 U2F 令牌,你仍然能够重新获取对你的帐户的访问。或者,你可以注册多个 U2F 令牌(即:你可以用一个便宜的令牌仅用它做 U2F,并且将它用作备份)。 @@ -101,44 +75,35 @@ Chrome 和 Firefox 都支持 U2F 双因子认证,希望其它浏览器也能 到目前为止,你已经完成了下列的重要任务: 1. 创建你的开发者身份并使用 PGP 加密来保护它。 - 2. 通过将你的主密钥移到一个离线存储中并将子密钥移到一个外置硬件设备中的方式来配置你的环境,让窃取你的身份变得极为困难。 - 3. 配置你的 Git 环境去确保任何使用你项目的人都能够验证仓库的完整性和它的整个历史。 - 4. 使用双因子认证强化你的在线帐户。 - - - 在安全保护方面,你已经做的很好了,但是你还应该去阅读以下的主题: - * 如何去强化你的团队沟通(在这个仓库中查看相关文档)。你的项目开发和治理决策的要求应该和保护提交代码那样去保护,如果不这样做,应该确保你的团队沟通是可信任的,并且所有决策的完整性是可验证的。 - - * 如何去强化你的工作站的安全(在这个仓库中查看相关文档)。你的目标是最小化可能导致项目代码被污染的危险或你的开发者身份被窃的行为。 - + * 如何去强化你的团队沟通。你的项目开发和治理决策的要求应该和保护提交代码那样去保护,如果不这样做,应该确保你的团队沟通是可信任的,并且所有决策的完整性是可验证的。 + * 如何去强化你的工作站的安全。你的目标是尽可能减少导致项目代码被污染的危险或你的开发者身份被窃的行为。 * 如何写出安全的代码(查看相关编程语言和你项目所使用的库的各种文档)。即便引入它的提交代码上有一个 PGP 签名,糟糕的、不安全的代码仍然是糟糕的、不安全的代码! - -------------------------------------------------------------------------------- via: https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-7-protecting-online-accounts 作者:[Konstantin Ryabitsev][a] -译者:[qhwdw](https://github.com/qhwdw) -校对:[校对者ID](https://github.com/校对者ID) 选题:[lujun9972](https://github.com/lujun9972) +译者:[qhwdw](https://github.com/qhwdw) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]:https://www.linux.com/users/mricon -[1]:https://www.linux.com/blog/learn/2018/2/protecting-code-integrity-pgp-part-1-basic-pgp-concepts-and-tools -[2]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-2-generating-and-protecting-your-master-pgp-key -[3]:https://www.linux.com/blog/learn/pgp/2018/2/protecting-code-integrity-pgp-part-3-generating-pgp-subkeys -[4]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-4-moving-your-master-key-offline-storage -[5]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-5-moving-subkeys-hardware-device -[6]:https://www.linux.com/blog/learn/pgp/2018/3/protecting-code-integrity-pgp-part-6-using-pgp-git +[1]:https://linux.cn/article-9524-1.html +[2]:https://linux.cn/article-9529-1.html +[3]:https://linux.cn/article-9607-1.html +[4]:https://linux.cn/article-10402-1.html +[5]:https://linux.cn/article-10415-1.html +[6]:https://linux.cn/article-10421-1.html [7]:https://en.wikipedia.org/wiki/Multi-factor_authentication [8]:https://en.wikipedia.org/wiki/Universal_2nd_Factor [9]:http://www.dongleauth.info/dongles/ From b2c24056035297d0c2bf5359f38c3787f1110f41 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 10 Jan 2019 23:12:16 +0800 Subject: [PATCH 269/322] PUB:20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md @qhwdw https://linux.cn/article-10432-1.html --- ...ode Integrity with PGP - Part 7- Protecting Online Accounts.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md (100%) diff --git a/translated/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md b/published/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md similarity index 100% rename from translated/tech/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md rename to published/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md From 88b1c2bcb8663235fe9d86ffaddeb802f02c1139 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 10 Jan 2019 23:14:09 +0800 Subject: [PATCH 270/322] PRF:20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md --- ...ting Code Integrity with PGP - Part 6- Using PGP with Git.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md b/published/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md index 688864d163..f87e1fee14 100644 --- a/published/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md +++ b/published/20180321 Protecting Code Integrity with PGP - Part 6- Using PGP with Git.md @@ -1,4 +1,4 @@ -保护代码完整性(六):在 Git 上使用 PGP +用 PGP 保护代码完整性(六):在 Git 上使用 PGP ====== > 我们继续我们的 PGP 实践系列,来看看签名标签的标签和提交,这可以帮你确保你的仓库没有被篡改。 From c596d70a313694873c9ccfbf420c58e1314901c1 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 10 Jan 2019 23:15:50 +0800 Subject: [PATCH 271/322] PRF:20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md --- ...e Integrity with PGP - Part 7- Protecting Online Accounts.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md b/published/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md index 2d136e324e..23a7dc54d0 100644 --- a/published/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md +++ b/published/20180327 Protecting Code Integrity with PGP - Part 7- Protecting Online Accounts.md @@ -1,4 +1,4 @@ -保护代码完整性(七):保护在线帐户 +用 PGP 保护代码完整性(七):保护在线帐户 ====== > 在这个系列的最后一篇当中,我们将为你展示如何用双因子认证保护你的在线账户。 From 7ceddea1f847235ba8a991c032d33fe7f73d416b Mon Sep 17 00:00:00 2001 From: Rachel Date: Fri, 11 Jan 2019 03:47:50 +0800 Subject: [PATCH 272/322] Update and rename sources/tech/20180108 5 arcade-style games in your Linux repository.md to translated/tech/20180108 5 arcade-style games in your Linux repository.md --- ...de-style games in your Linux repository.md | 99 ------------------- ...de-style games in your Linux repository.md | 97 ++++++++++++++++++ 2 files changed, 97 insertions(+), 99 deletions(-) delete mode 100644 sources/tech/20180108 5 arcade-style games in your Linux repository.md create mode 100644 translated/tech/20180108 5 arcade-style games in your Linux repository.md diff --git a/sources/tech/20180108 5 arcade-style games in your Linux repository.md b/sources/tech/20180108 5 arcade-style games in your Linux repository.md deleted file mode 100644 index 4e802bfbf0..0000000000 --- a/sources/tech/20180108 5 arcade-style games in your Linux repository.md +++ /dev/null @@ -1,99 +0,0 @@ -Scoutydren is translating. -5 arcade-style games in your Linux repository -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/arcade_game_gaming.jpg?itok=84Rjk_32) - -Gaming has traditionally been one of Linux's weak points. That has changed somewhat in recent years thanks to [Steam][1], [GOG][2], and other efforts to bring commercial games to multiple operating systems, but those games often are not open source. Sure, the games can be played on an open source operating system, but that is not good enough for an open source purist. - -So, can someone who uses only free and open source software find games that are polished enough to present a solid gaming experience without compromising their open source ideals? Absolutely! While most open source games are unlikely to rival some of the AAA commercial games developed with massive budgets, there are plenty of open source games, in many genres, that are fun to play and can be installed from the repositories of most major Linux distributions. - -I am starting this series of articles on open source games for Linux by looking at arcade-style games. In future articles, I plan to cover board & card, puzzle, racing, role-playing, and strategy & simulation games. - -### AstroMenace - -![](https://opensource.com/sites/default/files/u128651/astromenace.png) - -[AstroMenace][3] is a scrolling space shooter for the modern era. It began as a closed source game, but the code and art assets have since been released under open licenses. Gameplay is fairly typical for the style of game, but it features nice, modern 3D graphics. Ship and weapon upgrades can be purchased using the points earned from shooting down enemies. The difficulty level can be tweaked by changing a wide variety of options, so the game is approachable to new players while still offering a challenge to experienced ones. - -To install AstroMenace, run the following command: - - * On Fedora: `dnf install astromenace` - * On Debian/Ubuntu: `apt install astromenace` - - - -### Battle Tanks - -![](https://opensource.com/sites/default/files/u128651/battle_tanks.png) - -[Battle Tanks][4] is a fast-paced tank battle game with an overhead perspective. Players maneuver one of three different vehicle types around a map, collecting power-ups and trying to blow up their opponents. It has deathmatch, team deathmatch, capture the flag, and cooperative game modes. There are nine maps for the deathmatch and capture the flag modes and four maps for cooperative mode. The game supports split-screen local multiplayer for two players and local area network multiplayer for larger matches. Gameplay is fast-paced, and the default match length of five minutes is short, which makes Battle Tanks a nice choice for gamers who want something quick to play. - -To install Battle Tanks, run the following command: - - * On Fedora: `dnf install btanks` - * On Debian/Ubuntu: `apt install btanks` - - - -### M.A.R.S. - -![](https://opensource.com/sites/default/files/u128651/m.a.r.s.png) - -[M.A.R.S.][5] is a top-down space shooter with physics similar to the classic Asteroids arcade game. Players control a spaceship while shooting at their opponents, maneuvering around the screen, and avoiding planets and opponents' incoming fire. The standard death match and team death match modes are available, but there are other modes, like one that requires pushing a ball into the opposing team's home planet, that provide some variety to the gameplay options. It supports local multiplayer, but unfortunately network multiplayer has not been implemented. Since development on the game appears to have stalled, network multiplayer is not likely to appear at any point in the near future, but the game is still fun and playable without it. - -To install M.A.R.S., run the following command: - - * On Fedora: `dnf install marsshooter` - * On Debian/Ubuntu: `apt install marsshooter` - - - -### Neverball - -![](https://opensource.com/sites/default/files/u128651/neverball.png) - -With gameplay inspired by Sega's Super Monkey Ball, [Neverball][6] challenges the player to move a ball through a 3D playing field by moving the playing field, not the ball. The objective is to collect enough coins to open a level's exit and maneuver the ball to the exit before time runs out. There are seven different sets of levels, which range in difficulty from easy to impossible. The game can be played using the keyboard, mouse, or joystick. - -To install Neverball, run the following command: - - * On Fedora: `dnf install neverball` - * On Debian/Ubuntu: `apt install neverball` - - - -### SuperTux - -![](https://opensource.com/sites/default/files/u128651/supertux.png) - -[SuperTux][7] is a 2D platformer modeled after Nintendo's Super Mario Bros. games. Linux's mascot, Tux the Penguin, takes the place of Mario with eggs serving as the equivalent of Super Mario Bros.'s mushroom power-ups. When Tux is powered up with an egg, he can collect flowers that grant him extra abilities. The fire flower, which lets Tux throw fireballs, is the most common in the game's levels, but ice, air, and earth flowers are included in the game's code. Collecting star power-ups makes Tux temporarily invincible, just like in the Super Mario games. The default level set, Icy Island, is 30 levels, making the game approximately the same length as the original Super Mario Bros., but SuperTux also comes with several contributed level sets, including three bonus islands, a forest island, a Halloween island, and incubator and test levels. SuperTux has a built-in level editor, so users can create their own. - -To install SuperTux, run the following command: - - * On Fedora: `dnf install supertux` - * On Debian/Ubuntu: `apt install supertux` - - - -Did I miss one of your favorite open source arcade games? Share it in the comments below. -### About the author -Joshua Allen Holm - Joshua Allen Holm, MLIS, MEd, is one of Opensource.com's Community Moderators. Joshua's main interests are digital humanities, open access, and open educational resources. You can find Joshua on GitHub, GitLab, LinkedIn, and Zotero. He can reached at holmja@opensource.com. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/1/arcade-games-linux - -作者:[Joshua Allen Holm][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://opensource.com/users/holmja -[1]:http://store.steampowered.com/ -[2]:https://www.gog.com/ -[3]:http://www.viewizard.com/ -[4]:http://btanks.sourceforge.net/blog/about-game -[5]:http://mars-game.sourceforge.net/?page_id=10 -[6]:https://neverball.org/index.php -[7]:http://supertux.org/ diff --git a/translated/tech/20180108 5 arcade-style games in your Linux repository.md b/translated/tech/20180108 5 arcade-style games in your Linux repository.md new file mode 100644 index 0000000000..d92ac7a4e0 --- /dev/null +++ b/translated/tech/20180108 5 arcade-style games in your Linux repository.md @@ -0,0 +1,97 @@ +# 10款Linux街机游戏 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/arcade_game_gaming.jpg?itok=84Rjk_32) + +长久以来,游戏都是 Linux 的软肋。近些年,Steam,GOG等游戏发布平台上不少商业游戏都开始支持 Linux,这对于 Linux 的游戏生态来说是件好事,但是我们能在这些平台上玩到的游戏通常是不开源的商业作品。当然,这些游戏在一个开源的操作系统上运行,但对于一个开源提倡者来说这似乎还不够纯粹。 + +那么,我们能找到既免费开源又能给玩家带来完整游戏体验的优质游戏吗?当然!虽然绝大多数的开源游戏很难和3A 商业游戏大作竞争,但仍然有不少各种类型的开源游戏,不仅内容有趣而且直接可以通过几大 Linux 发行版本库中直接安装。 + +本文首先介绍 Linux 开源游戏中的街机类型游戏,在之后的文章中,我将介绍桌面和卡牌游戏,解谜游戏,竞速游戏,以及策略模拟游戏。 + +### AstroMenace 太空危机 + +![](https://opensource.com/sites/default/files/u128651/astromenace.png) + +[AstroMenace][3] 是一个近现代太空背景下的滚动页面射击游戏。开发初期它是一个闭源游戏,但它的代码和美术而后在开源证书下被公开。游戏玩法和大多数此类游戏大同小异,但它有质量极高的 3D 画面。飞船和武器更新可以通过击杀敌人所获得的点数购买。游戏的难度可以选择,因此适合新手以及想要追求挑战的硬核玩家。 + +安装 AstroMenace,你只需要在终端下运行以下指令: + +- Fedora 用户: `dnf install astromenace` +- Debian/Ubuntu 用户: `apt install astromenace` + +### Battle Tanks 坦克战役 + +![](https://opensource.com/sites/default/files/u128651/battle_tanks.png) + +[Battle Tanks][4] 是一个俯瞰式视角的快节奏坦克战斗游戏。玩家可以选择三种不同的陆地坦克,操纵其在地图上前行,收集道具并且尝试炸飞敌军。它有四种游戏模式,死亡竞赛(又称“死斗”),团队死斗,夺旗模式和合作模式。死斗和夺旗模式下,分别有8张地图可供玩家选择,合作模式则有4张。该游戏支持分屏本地双人游戏,以及在线多人竞技。游戏节奏很快,默认一次战役仅5分钟,因此Battle Tank十分适合想要利用零碎时间快速来一局的玩家。 + +安装 Battle Tanks,你只需要在终端下运行以下指令: + +- Fedora 用户: `dnf install btanks` +- Debian/Ubuntu 用户: `apt install btanks` + + + +### M.A.R.S. 火星 + +![](https://opensource.com/sites/default/files/u128651/m.a.r.s.png) + +[M.A.R.S.][5] 是一个自上而下的太空射击游戏,游戏机制类似传统街机游戏 “爆破彗星(Asteroids)”。玩家在操控一个太空船的同时向敌方射击并躲避敌军的弹幕射击。游戏有标准的死斗和团体死斗模式,除此之外也有更新鲜的比赛形式——例如在一个模式下,玩家需要控制一个球使其进入敌方母星。该游戏支持本地多人游戏,但遗憾的是不支持多人联机。该游戏的开发更新似乎已经停止,所以该游戏之后增加联机模式的几率很小,但就算没有联机支持,这个游戏仍然值得一试。 + +安装 M.A.R.S. ,你只需要在终端下运行以下指令: + +- Fedora 用户: `dnf install marsshooter`` +- Debian/Ubuntu 用户: ``apt install marsshooter` + + + +### Neverball 不存在之球 + +![](https://opensource.com/sites/default/files/u128651/neverball.png) + +[Neverball][6] 的游戏灵感来源自世嘉的 “超级猴子球(Super Monkey Ball)” ,玩家需要将一个球在3D球场上运动起来,但是玩家控制的不是球,而是球场。游戏任务是在规定的时限内,收集足够多的金币从而打开该关卡的出口并且将小球落进该洞中。游戏可以调整难度,从休闲到黑魂能适应不同的玩家需求。该游戏支持键盘/鼠标以及控制杆操作。 + +安装 Neverball, 你只需要在终端下运行以下指令: + +- Fedora 用户:`dnf install neverball` +- Debian/Ubuntu 用户:`apt install neverball` + + + +### SuperTux 超级Tux + +![](https://opensource.com/sites/default/files/u128651/supertux.png) + +[SuperTux][7] 是继任天堂超级马里奥后的一款 2D 的平台跳跃游戏。Linux 的吉祥物,企鹅 Tux 代替了马里奥,而鸡蛋对应着马里奥系列中的蘑菇能力提升。当 Tux 获得了鸡蛋得到了能力提升,他便可以收集花朵,而花朵可以带来新的附加特殊能力。火焰花在关卡中最为常见,收集了火焰花的 Tux 可以掷出火球。除此之外,冰冻花/空气花/土地花也在游戏的程序中。收集星星的能力提升能使 Tux 暂时变得隐形,就如同马里奥系列游戏。该游戏最基础的一组关卡,冰之岛也有 30 关之多,因此游戏的内容和流程和超级马里奥系列一般长。SuperTux 还有一些附加关卡,例如三个额外奖励小岛,一个森林之岛,一个万圣节岛,一个孵化处,以及很多测试关卡。SuperTux 有一个自带的关卡编辑器,所以玩家可以创建他们的原创关卡。 + +安装 SuperTux,你只需要在终端下运行以下指令: + +- Fedora 用户:`dnf install supertux` +- Debian/Ubuntu 用户: `apt install supertux` + + + +如果我没有在上文中提及你最喜欢的开源街机游戏,欢迎在评论中分享。 + +### 有关作者 + +Joshua Allen Holm - Joshua Allen Holm, MLIS, MEd, 是 Opensource.com 的社区协调者之一。他的主要兴趣有数字人文,学术开放以及公开教育资源。你可以在 GitHub,GitLab,LinkedIn 和 Zotero 上找到他。可以通过 holmja@opensource.com 联系到他。 + +------ + +via: https://opensource.com/article/18/1/arcade-games-linux + +作者:[Joshua Allen Holm][a] +译者:[Scoutydren](https://github.com/Scoutydren) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/holmja +[1]: http://store.steampowered.com/ +[2]: https://www.gog.com/ +[3]: http://www.viewizard.com/ +[4]: http://btanks.sourceforge.net/blog/about-game +[5]: http://mars-game.sourceforge.net/?page_id=10 +[6]: https://neverball.org/index.php +[7]: http://supertux.org/ From d8df97b646cbf76a5a54caf28d3716ced6777a5d Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 11 Jan 2019 08:59:59 +0800 Subject: [PATCH 273/322] translated --- ...How to create presentations with Beamer.md | 138 ------------------ ...How to create presentations with Beamer.md | 138 ++++++++++++++++++ 2 files changed, 138 insertions(+), 138 deletions(-) delete mode 100644 sources/tech/20190103 How to create presentations with Beamer.md create mode 100644 translated/tech/20190103 How to create presentations with Beamer.md diff --git a/sources/tech/20190103 How to create presentations with Beamer.md b/sources/tech/20190103 How to create presentations with Beamer.md deleted file mode 100644 index f6d910c348..0000000000 --- a/sources/tech/20190103 How to create presentations with Beamer.md +++ /dev/null @@ -1,138 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to create presentations with Beamer) -[#]: via: (https://opensource.com/article/19/1/create-presentations-beamer) -[#]: author: (Moshe Zadka https://opensource.com/users/moshez) - -How to create presentations with Beamer -====== -Beamer brings LaTeX's powerful typesetting features and ecosystem to creating slides. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bus_presentation.png?itok=CQeyO61b) - -[Beamer][1] is a LaTeX package for generating presentation slide decks. One of its nicest features is that it can take advantage of LaTeX's powerful typesetting system and all the other packages in its ecosystem. For example, I often use LaTeX's [listings][2] package in Beamer presentations that include code. - -### Starting a presentation - -To begin a Beamer document, enter: - -``` -\documentclass{beamer} -``` - -As you would with any other LaTeX document, add any packages you want to use. For example, to use the **listings** package, enter: - -``` -\usepackage{listings} -``` - -Place all content inside the **document** environment: - -``` -\begin{document} -``` - -Beamer documents are usually a sequence of **frame** environments. Frames that contain code should be marked **fragile** : - -``` -\begin{frame}[fragile] -``` - -Begin your frames with a title: - -``` -\frametitle{Function to Do Stuff} -``` - -### Testing your code before you present it - -One of the worst feelings in the world is giving a talk and realizing, as you walk through the code, that there is a glaring bug in it—maybe a misspelled keyword or an unclosed brace. - -The solution is to test code that is presented. In most presentation environments, this means creating a separate file, writing tests, then copying and pasting. - -However, with Beamer, there is a better way. Imagine you have a file named **do_stuff.py** that contains code. You can write tests for the **do_stuff.py** code in a second file, which you call **test_do_stuff.py** , and can exercise it with, say, [pytest][3]. However, most of the lines in **do_stuff.py** lack pedagogic value, like defining helper functions. - -To simplify things for your audience, you can import just the lines you want to talk about into the frame in your presentation : - -``` -\lstinputlisting[ -    language=Python, -    firstline=8, -    lastline=15 -]{do_stuff.py} -``` - -Since you will be talking through those lines (from 8 to 15), you don't need any other content on the slide. Close the frame: - -``` -\end{frame} -``` - -On the next slide, you want to show a usage example for the **do_stuff()** function you just presented: - -``` -\begin{frame}[fragile] -\frametitle{Calling Function to Do Stuff} -\lstinputlisting[ -    language=Python, -    firstline=17, -    lastline=19 -]{do_stuff.py} -\end{frame} -``` - -You use the same file, but this time you show the lines that call the function. Finally, close the document: - -``` -\end{document} -``` - -Assuming you have an appropriate Python file in **do_stuff.py** , this will produce a short two-slide presentation. - -Beamer also supports necessary features such as progressive revelation, showing only one bullet at a time to prevent the audience from being distracted by reading ahead.": **\pause** inside a list will divide bullets into pages: - -``` -\begin{frame} -Remember: -\begin{itemize} -\item This will show up on the first slide. \pause -\item This will show up on the -      second slide, as well as the preceding point. \pause -\item Finally, on the third slide, -       all three bullets will show up. -\end{frame} -``` - -### Creating handouts - -My favorite feature in Beamer is that you can set it to ignore everything outside a frame with **\documentclass[ignorenonframetext]{beamer}**. When I prepare a presentation, I leave off the top (where the document class is declared) and auto-generate two versions of it: one with Beamer that ignores all text outside any frame, which I use for my presentation, and one with a header like: - -``` -\documentclass{article} -\usepackage{beamerarticle} -``` - -which generates a handout—a PDF that has all the frames and all the text between them. - -When a conference organizer asks me to publish my slides, I include the original slide deck as a reference, but the main thing I like people to have is the handout, which has all the explanatory text that I don't want to include on the slide deck itself. - -When creating presentation slides, people often wonder whether it's better to optimize their materials for the presentation or for people who want to read them afterward. Fortunately, Beamer provides the best of both worlds. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/1/create-presentations-beamer - -作者:[Moshe Zadka][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/moshez -[b]: https://github.com/lujun9972 -[1]: https://www.overleaf.com/learn/latex/Beamer -[2]: https://www.overleaf.com/learn/latex/Code_listing -[3]: https://docs.pytest.org/en/latest/ diff --git a/translated/tech/20190103 How to create presentations with Beamer.md b/translated/tech/20190103 How to create presentations with Beamer.md new file mode 100644 index 0000000000..8e98d98561 --- /dev/null +++ b/translated/tech/20190103 How to create presentations with Beamer.md @@ -0,0 +1,138 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to create presentations with Beamer) +[#]: via: (https://opensource.com/article/19/1/create-presentations-beamer) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +如何使用 Beamer 创建演示文稿 +====== +Beamer 将 LaTeX 强大的排版功能和生态系统带进创建幻灯片中。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bus_presentation.png?itok=CQeyO61b) + +[Beamer][1] 是用于生成幻灯片的 LaTeX 包。它最棒的功能之一是它可以利用 LaTeX 强大的排版系统和其生态系统中的所有其他软件包。例如,我经常在包含代码的 Beamer 演示文稿中使用 LaTeX 的 [listings][2] 包。 + +### 创建演示文稿 + +要创建一个 Beamer 文档,输入: + +``` +\documentclass{beamer} +``` + +与任何其他 LaTeX 文档一样,添加你要使用的任何包。例如,要使用 **listings** 包,请输入: + +``` +\usepackage{listings} +``` + +将所有内容放在 **document** 环境中: + +``` +\begin{document} +``` + +Beamer 文档通常时是一系列的 **frame** 环境。包含代码的 frame 应该被标记为 **fragile**: + +``` +\begin{frame}[fragile] +``` + +使用标题开始你的 frame: + +``` +\frametitle{Function to Do Stuff} +``` + +### 开始演示前测试你的代码 + +世上最糟糕的感受之一你在演讲中说到代码时,突然发现了一个 bug—也许是拼错了关键词或者漏掉了括号。 + +解决方法之一就是测试演示的代码。在多数演示环境中,这意味着创建一个单独的文件、编写测试接着拷贝和粘贴。 + +然而,在 Beamer 中有一种更好的方法。想象一下,你有一个名为 **do_stuff.py** 的文件,其中包含代码。你可以在第二个文件中编写 **do_stuff.py** 代码的测试,你可以将其命名为 **test_do_stuff.py**,并且可以使用 [pytest][3] 测试。但是,**do_stuff.py**中的大多数行都缺乏教学价值,比如定义辅助函数。 + +要简化你受众看到的东西,你可在演示文稿中只导入你要讨论的行到 frame 中: + +``` +\lstinputlisting[ + language=Python, + firstline=8, + lastline=15 +]{do_stuff.py} +``` + +由于你会对这几行(从 8 到 15)进行讨论,因此幻灯片上不需要任何其他内容。结束 frame: + +``` +\end{frame} +``` + +在下一张幻灯片中,你想展示刚才的 **do_stuff()** 函数的用法示例: + +``` +\begin{frame}[fragile] +\frametitle{Calling Function to Do Stuff} +\lstinputlisting[ + language=Python, + firstline=17, + lastline=19 +]{do_stuff.py} +\end{frame} +``` + +你使用相同的文件,但这次显示调用该函数的行。最后,结束 document: + +``` +\end{document} +``` + +假设你在 **do_stuff.py** 中有一个合适的 Python 文件,这将生成一个含有 2 页的幻灯片。 + +Beamer 还支持必要的功能如渐进式演示,每次给观众展示一部分以免受到前面的打扰。在行中放入 ”**\pause**“ 会将页面分成不同的部分: + +``` +\begin{frame} +Remember: +\begin{itemize} +\item This will show up on the first slide. \pause +\item This will show up on the + second slide, as well as the preceding point. \pause +\item Finally, on the third slide, + all three bullets will show up. +\end{frame} +``` + +### 创建讲义 + +Beamer 中我最喜欢的功能是你可以用 **\documentclass[ignorenonframetext]{beamer}** 设置忽略 frame 外的所有内容。当我准备演示文稿时,我离开顶部(声明文档类的位置)并自动生成它的两个版本:我的演示稿使用 Beamer 忽略任何 frame 之外的所有文本,另一个含有类似这样的头: + +``` +\documentclass{article} +\usepackage{beamerarticle} +``` + +这会生成一份讲义—一份含有所有 frame 和它们之间文字的 PDF。 + +当会议组织者要求我发布我的幻灯片时,我会包含原始幻灯片作为参考,但我希望人们拿到的是讲义,它包含了所有我不想在幻灯片上写的解释部分。 + +在创建幻灯片时,人们经常想是要为演讲优化资料还是方便那些想要日后阅读的人。幸运的是,Beamer 提供了两全其美的办法。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/create-presentations-beamer + +作者:[Moshe Zadka][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/moshez +[b]: https://github.com/lujun9972 +[1]: https://www.overleaf.com/learn/latex/Beamer +[2]: https://www.overleaf.com/learn/latex/Code_listing +[3]: https://docs.pytest.org/en/latest/ \ No newline at end of file From e8d606490124bf8d2077588623cb931667b961ea Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 11 Jan 2019 09:11:27 +0800 Subject: [PATCH 274/322] translating --- sources/tech/20181211 Winterize your Bash prompt in Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181211 Winterize your Bash prompt in Linux.md b/sources/tech/20181211 Winterize your Bash prompt in Linux.md index bae5837a2c..c952f0c18d 100644 --- a/sources/tech/20181211 Winterize your Bash prompt in Linux.md +++ b/sources/tech/20181211 Winterize your Bash prompt in Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From b86fc5e81392c3d7c31419032613070a33cb8916 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 11 Jan 2019 09:55:37 +0800 Subject: [PATCH 275/322] PRF:20180108 5 arcade-style games in your Linux repository.md @Scoutydren --- ...de-style games in your Linux repository.md | 53 ++++++++----------- 1 file changed, 23 insertions(+), 30 deletions(-) diff --git a/translated/tech/20180108 5 arcade-style games in your Linux repository.md b/translated/tech/20180108 5 arcade-style games in your Linux repository.md index d92ac7a4e0..98ace98e05 100644 --- a/translated/tech/20180108 5 arcade-style games in your Linux repository.md +++ b/translated/tech/20180108 5 arcade-style games in your Linux repository.md @@ -1,81 +1,74 @@ -# 10款Linux街机游戏 +5 款 Linux 街机游戏 +================ ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/arcade_game_gaming.jpg?itok=84Rjk_32) -长久以来,游戏都是 Linux 的软肋。近些年,Steam,GOG等游戏发布平台上不少商业游戏都开始支持 Linux,这对于 Linux 的游戏生态来说是件好事,但是我们能在这些平台上玩到的游戏通常是不开源的商业作品。当然,这些游戏在一个开源的操作系统上运行,但对于一个开源提倡者来说这似乎还不够纯粹。 +长久以来,游戏都是 Linux 的软肋。近些年,Steam、GOG 等游戏发布平台上不少商业游戏都开始支持 Linux,这对于 Linux 的游戏生态来说是件好事,但是我们能在这些平台上玩到的游戏通常是不开源的商业作品。当然,这些游戏在一个开源的操作系统上运行,但对于一个开源提倡者来说这似乎还不够纯粹。 -那么,我们能找到既免费开源又能给玩家带来完整游戏体验的优质游戏吗?当然!虽然绝大多数的开源游戏很难和3A 商业游戏大作竞争,但仍然有不少各种类型的开源游戏,不仅内容有趣而且直接可以通过几大 Linux 发行版本库中直接安装。 +那么,我们能找到既自由开源又能给玩家带来完整游戏体验的优质游戏吗?当然!虽然绝大多数的开源游戏很难和 3A 商业游戏大作竞争,但仍然有不少各种类型的开源游戏,不仅内容有趣而且直接可以通过几大 Linux 发行版本库中直接安装。 本文首先介绍 Linux 开源游戏中的街机类型游戏,在之后的文章中,我将介绍桌面和卡牌游戏,解谜游戏,竞速游戏,以及策略模拟游戏。 -### AstroMenace 太空危机 +### 太空危机AstroMenace ![](https://opensource.com/sites/default/files/u128651/astromenace.png) -[AstroMenace][3] 是一个近现代太空背景下的滚动页面射击游戏。开发初期它是一个闭源游戏,但它的代码和美术而后在开源证书下被公开。游戏玩法和大多数此类游戏大同小异,但它有质量极高的 3D 画面。飞船和武器更新可以通过击杀敌人所获得的点数购买。游戏的难度可以选择,因此适合新手以及想要追求挑战的硬核玩家。 +[太空危机][3] 是一个近现代太空背景下的滚动页面射击游戏。开发初期它是一个闭源游戏,但它的代码和素材而后以开源许可证发布了。游戏玩法和大多数此类游戏大同小异,但它有质量极高的 3D 画面。飞船和武器升级可以通过击杀敌人所获得的点数购买。游戏的难度可以选择,因此适合新手以及想要追求挑战的硬核玩家。 -安装 AstroMenace,你只需要在终端下运行以下指令: +安装太空危机,你只需要在终端下运行以下指令: - Fedora 用户: `dnf install astromenace` - Debian/Ubuntu 用户: `apt install astromenace` -### Battle Tanks 坦克战役 +### 坦克战役Battle Tanks ![](https://opensource.com/sites/default/files/u128651/battle_tanks.png) -[Battle Tanks][4] 是一个俯瞰式视角的快节奏坦克战斗游戏。玩家可以选择三种不同的陆地坦克,操纵其在地图上前行,收集道具并且尝试炸飞敌军。它有四种游戏模式,死亡竞赛(又称“死斗”),团队死斗,夺旗模式和合作模式。死斗和夺旗模式下,分别有8张地图可供玩家选择,合作模式则有4张。该游戏支持分屏本地双人游戏,以及在线多人竞技。游戏节奏很快,默认一次战役仅5分钟,因此Battle Tank十分适合想要利用零碎时间快速来一局的玩家。 +[坦克战役][4] 是一个俯瞰式视角的快节奏坦克战斗游戏。玩家可以选择三种不同的陆地坦克,操纵其在地图上前行,收集道具并且尝试炸飞敌军。它有四种游戏模式,死亡竞赛(又称“死斗”)、团队死斗、夺旗模式和合作模式。死斗和夺旗模式下,分别有 9 张地图可供玩家选择,合作模式则有 4 张。该游戏支持分屏本地双人游戏,以及在线多人竞技。游戏节奏很快,默认一次战役仅 5 分钟,因此,坦克战役十分适合想要利用零碎时间快速来一局的玩家。 -安装 Battle Tanks,你只需要在终端下运行以下指令: +安装坦克战役,你只需要在终端下运行以下指令: - Fedora 用户: `dnf install btanks` - Debian/Ubuntu 用户: `apt install btanks` - - -### M.A.R.S. 火星 +### 火星M.A.R.S. ![](https://opensource.com/sites/default/files/u128651/m.a.r.s.png) -[M.A.R.S.][5] 是一个自上而下的太空射击游戏,游戏机制类似传统街机游戏 “爆破彗星(Asteroids)”。玩家在操控一个太空船的同时向敌方射击并躲避敌军的弹幕射击。游戏有标准的死斗和团体死斗模式,除此之外也有更新鲜的比赛形式——例如在一个模式下,玩家需要控制一个球使其进入敌方母星。该游戏支持本地多人游戏,但遗憾的是不支持多人联机。该游戏的开发更新似乎已经停止,所以该游戏之后增加联机模式的几率很小,但就算没有联机支持,这个游戏仍然值得一试。 +[火星][5] 是一个自上而下的太空射击游戏,游戏机制类似传统街机游戏 “爆破彗星Asteroids”。玩家在操控一个太空船的同时向敌方射击并躲避敌军的弹幕射击。游戏有标准的死斗和团体死斗模式,除此之外也有更新鲜的比赛形式 —— 例如在一个模式下,玩家需要控制一个球使其进入敌方母星。该游戏支持本地多人游戏,但遗憾的是不支持多人联机。该游戏的开发更新似乎已经停止,所以该游戏之后增加联机模式的几率很小,但就算没有联机支持,这个游戏仍然值得一试。 -安装 M.A.R.S. ,你只需要在终端下运行以下指令: +安装火星,你只需要在终端下运行以下指令: -- Fedora 用户: `dnf install marsshooter`` -- Debian/Ubuntu 用户: ``apt install marsshooter` +- Fedora 用户: `dnf install marsshooter` +- Debian/Ubuntu 用户: `apt install marsshooter` - - -### Neverball 不存在之球 +### 不存在之球Neverball ![](https://opensource.com/sites/default/files/u128651/neverball.png) -[Neverball][6] 的游戏灵感来源自世嘉的 “超级猴子球(Super Monkey Ball)” ,玩家需要将一个球在3D球场上运动起来,但是玩家控制的不是球,而是球场。游戏任务是在规定的时限内,收集足够多的金币从而打开该关卡的出口并且将小球落进该洞中。游戏可以调整难度,从休闲到黑魂能适应不同的玩家需求。该游戏支持键盘/鼠标以及控制杆操作。 +[不存在之球][6] 的游戏灵感来源自世嘉的 “超级猴子球Super Monkey Ball” ,玩家需要将一个球在 3D 球场上运动起来,但是玩家控制的不是球,而是球场。游戏任务是在规定的时限内,收集足够多的金币从而打开该关卡的出口并且将小球落进该洞中。游戏可以调整难度,从休闲到难以超乎想象,可以适应不同的玩家需求。该游戏支持键盘/鼠标以及控制杆操作。 -安装 Neverball, 你只需要在终端下运行以下指令: +安装不存在之球,你只需要在终端下运行以下指令: - Fedora 用户:`dnf install neverball` - Debian/Ubuntu 用户:`apt install neverball` - - -### SuperTux 超级Tux +### 超级 TuxSuperTux ![](https://opensource.com/sites/default/files/u128651/supertux.png) -[SuperTux][7] 是继任天堂超级马里奥后的一款 2D 的平台跳跃游戏。Linux 的吉祥物,企鹅 Tux 代替了马里奥,而鸡蛋对应着马里奥系列中的蘑菇能力提升。当 Tux 获得了鸡蛋得到了能力提升,他便可以收集花朵,而花朵可以带来新的附加特殊能力。火焰花在关卡中最为常见,收集了火焰花的 Tux 可以掷出火球。除此之外,冰冻花/空气花/土地花也在游戏的程序中。收集星星的能力提升能使 Tux 暂时变得隐形,就如同马里奥系列游戏。该游戏最基础的一组关卡,冰之岛也有 30 关之多,因此游戏的内容和流程和超级马里奥系列一般长。SuperTux 还有一些附加关卡,例如三个额外奖励小岛,一个森林之岛,一个万圣节岛,一个孵化处,以及很多测试关卡。SuperTux 有一个自带的关卡编辑器,所以玩家可以创建他们的原创关卡。 +[超级 Tux][7] 是继任天堂超级马里奥后的一款 2D 的平台跳跃游戏。Linux 的吉祥物企鹅 Tux 代替了马里奥,而鸡蛋对应着马里奥系列中的蘑菇能力提升。当 Tux 获得了鸡蛋得到了能力提升,它便可以收集花朵,而花朵可以带来新的附加特殊能力。火焰花在关卡中最为常见,收集了火焰花的 Tux 可以掷出火球。除此之外,冰冻花/空气花/土地花也在游戏的程序中。收集星星的能力提升能使 Tux 暂时变得隐形,就如同马里奥系列游戏。该游戏最基础的一组关卡,冰之岛也有 30 关之多,因此游戏的内容和流程和超级马里奥系列一般长。SuperTux 还有一些附加关卡,例如三个额外奖励小岛、一个森林之岛、一个万圣节岛、一个孵化处,以及很多测试关卡。SuperTux 有一个自带的关卡编辑器,所以玩家可以创建他们的原创关卡。 -安装 SuperTux,你只需要在终端下运行以下指令: +安装超级 Tux,你只需要在终端下运行以下指令: - Fedora 用户:`dnf install supertux` - Debian/Ubuntu 用户: `apt install supertux` - - 如果我没有在上文中提及你最喜欢的开源街机游戏,欢迎在评论中分享。 ### 有关作者 -Joshua Allen Holm - Joshua Allen Holm, MLIS, MEd, 是 Opensource.com 的社区协调者之一。他的主要兴趣有数字人文,学术开放以及公开教育资源。你可以在 GitHub,GitLab,LinkedIn 和 Zotero 上找到他。可以通过 holmja@opensource.com 联系到他。 +Joshua Allen Holm - 是 Opensource.com 的社区协调者之一。他的主要兴趣有数字人文、学术开放以及公开教育资源。你可以在 GitHub、GitLab、LinkedIn 和 Zotero 上找到他。可以通过 holmja@opensource.com 联系到他。 ------ @@ -83,7 +76,7 @@ via: https://opensource.com/article/18/1/arcade-games-linux 作者:[Joshua Allen Holm][a] 译者:[Scoutydren](https://github.com/Scoutydren) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 92c1178998efe924dcaec19ea11ecebdac278bec Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 11 Jan 2019 09:56:01 +0800 Subject: [PATCH 276/322] PUB:20180108 5 arcade-style games in your Linux repository.md @Scoutydren https://linux.cn/article-10433-1.html --- .../20180108 5 arcade-style games in your Linux repository.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180108 5 arcade-style games in your Linux repository.md (100%) diff --git a/translated/tech/20180108 5 arcade-style games in your Linux repository.md b/published/20180108 5 arcade-style games in your Linux repository.md similarity index 100% rename from translated/tech/20180108 5 arcade-style games in your Linux repository.md rename to published/20180108 5 arcade-style games in your Linux repository.md From 21712e7b526efe9dbfb5097053d1a3ea87a3ad9f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 11 Jan 2019 17:20:38 +0800 Subject: [PATCH 277/322] TSL:20180302 How to manage your workstation configuration with Ansible.md --- ... workstation configuration with Ansible.md | 170 ------------------ ... workstation configuration with Ansible.md | 143 +++++++++++++++ 2 files changed, 143 insertions(+), 170 deletions(-) delete mode 100644 sources/tech/20180302 How to manage your workstation configuration with Ansible.md create mode 100644 translated/tech/20180302 How to manage your workstation configuration with Ansible.md diff --git a/sources/tech/20180302 How to manage your workstation configuration with Ansible.md b/sources/tech/20180302 How to manage your workstation configuration with Ansible.md deleted file mode 100644 index fd24cd48ed..0000000000 --- a/sources/tech/20180302 How to manage your workstation configuration with Ansible.md +++ /dev/null @@ -1,170 +0,0 @@ -How to manage your workstation configuration with Ansible -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb) - -Configuration management is a very important aspect of both server administration and DevOps. The "infrastructure as code" methodology makes it easy to deploy servers in various configurations and dynamically scale an organization's resources to keep up with user demands. But less attention is paid to individual administrators who want to automate the setup of their own laptops and desktops (workstations). - -In this series, I'll show you how to automate your workstation setup via [Ansible][1] , which will allow you to easily restore your entire configuration if you want or need to reload your machine. In addition, if you have multiple workstations, you can use this same approach to make the configuration identical on each. In this first article, we'll set up basic configuration management for our personal or work computers and set the foundation for the rest of the series. By the end of this article, you'll have a working setup to benefit from right away. Each article will automate more things and grow in complexity. - -### Why Ansible? - -Many configuration management solutions are available, including Salt Stack, Chef, and Puppet. I prefer Ansible because it's lighter in terms of resource utilization, its syntax is easier to read, and when harnessed properly it can revolutionize your configuration management. Ansible's lightweight nature is especially relevant to the topic at hand, because we may not want to run an entire server just to automate the setup of our laptops and desktops. Ideally, we want something fast; something we can use to get up and running quickly should we need to restore our workstations or synchronize our configuration between multiple machines. My specific method for Ansible (which I'll demonstrate in this article) is perfect for this—there's no server to maintain. You just download your configuration and run it. - -### My approach - -Typically, Ansible is run from a central server. It utilizes an inventory file, which is a text file that contains a list of all the hosts and their IP addresses or domain names we want Ansible to manage. This is great for static environments, but it is not ideal for workstations. The reason being we really don't know what the status of our workstations will be at any one moment. Perhaps I powered down my desktop or my laptop may be suspended and stowed in my bag. In either case, the Ansible server would complain, as it can't reach my machines if they are offline. We need something that's more of an on-demand approach, and the way we'll accomplish that is by utilizing `ansible-pull`. The `ansible-pull` command, which is part of Ansible, allows you to download your configuration from a Git repository and apply it immediately. You won't need to maintain a server or an inventory list; you simply run the `ansible-pull` command, feed it a Git repository URL, and it will do the rest for you. - -### Getting started - -First, install Ansible on the computer you want it to manage. One problem is that a lot of distributions ship with an older version. I can tell you from experience you'll definitely want the latest version available. New features are introduced into Ansible quite frequently, and if you're running an older version, example syntax you find online may not be functional because it's using features that aren't implemented in the version you have installed. Even point releases have quite a few new features. One example of this is the `dconf` module, which is new to Ansible as of 2.4. If you try to utilize syntax that makes use of this module, unless you have 2.4 or newer it will fail. In Ubuntu and its derivatives, we can easily install the latest version of Ansible with the official personal package archive ([PPA][2]). The following commands will do the trick: -``` -sudo apt-get install software-properties-common - -sudo apt-add-repository ppa:ansible/ansible - -sudo apt-get update - -sudo apt-get install ansible - -``` - -If you're not using Ubuntu, [consult Ansible's documentation][3] on how to obtain it for your platform. - -Next, we'll need a Git repository to hold our configuration. The easiest way to satisfy this requirement is to create an empty repository on GitHub, or you can utilize your own Git server if you have one. To keep things simple, I'll assume you're using GitHub, so adjust the commands if you're using something else. Create a repository in GitHub; you'll end up with a repository URL that will be similar to this: -``` -git@github.com:/ansible.git - -``` - -Clone that repository to your local working directory (ignore any message that complains that the repository is empty): -``` -git clone git@github.com:/ansible.git - -``` - -Now we have an empty repository we can work with. Change your working directory to be inside the repository (`cd ./ansible` for example) and create a file named `local.yml` in your favorite text editor. Place the following configuration in that file: -``` -- hosts: localhost - -  become: true - -  tasks: - -  - name: Install htop - -    apt: name=htop - -``` - -The file you just created is known as a **playbook** , and the instruction to install `htop` (a package I arbitrarily picked to serve as an example) is known as a **play**. The playbook itself is a file in the YAML format, which is a simple to read markup language. A full walkthrough of YAML is beyond the scope of this article, but you don't need to have an expert understanding of it to be proficient with Ansible. The configuration is easy to read; by simply looking at this file, you can easily glean that we're installing the `htop` package. Pay special attention to the `apt` module on the last line, which will only work on Debian-based systems. You can change this to `yum` instead of `apt` if you're using a Red Hat platform or change it to `dnf` if you're using Fedora. The `name` line simply gives information regarding our task and will be shown in the output. Therefore, you'll want to make sure the name is descriptive so it's easy to find if you need to troubleshoot multiple plays. - -Next, let's commit our new file to our repository: -``` -git add local.yml - -git commit -m "initial commit" - -git push origin master - -``` - -Now our new playbook should be present in our repository on GitHub. We can apply the playbook we created with the following command: -``` -sudo ansible-pull -U https://github.com//ansible.git - -``` - -If executed properly, the `htop` package should be installed on your system. You might've seen some warnings near the beginning that complain about the lack of an inventory file. This is fine, as we're not using an inventory file (nor do we need to for this use). At the end of the output, it will give you an overview of what it did. If `htop` was installed properly, you should see `changed=1` on the last line of the output. - -How did this work? The `ansible-pull` command uses the `-U` option, which expects a repository URL. I gave it the `https` version of the repository URL for security purposes because I don't want any hosts to have write access back to the repository (`https` is read-only by default). The `local.yml` playbook name is assumed, so we didn't need to provide a filename for the playbook—it will automatically run a playbook named `local.yml` if it finds it in the repository's root. Next, we used `sudo` in front of the command since we are modifying the system. - -Let's go ahead and add additional packages to our playbook. I'll add two additional packages so that it looks like this: -``` -- hosts: localhost - -  become: true - -  tasks: - -  - name: Install htop - -    apt: name=htop - - - -  - name: Install mc - -    apt: name=mc - -    - -  - name: Install tmux - -    apt: name=tmux - -``` - -I added additional plays (tasks) for installing two other packages, `mc` and `tmux`. It doesn't matter what packages you choose to have this playbook install; I just picked these arbitrarily. You should install whichever packages you want all your systems to have. The only caveat is that you have to know that the packages exist in the repository for your distribution ahead of time. - -Before we commit and apply this updated playbook, we should clean it up. It will work fine as it is, but (to be honest) it looks kind of messy. Let's try installing all three packages in just one play. Replace the contents of your `local.yml` with this: -``` -- hosts: localhost - -  become: true - -  tasks: - -  - name: Install packages - -    apt: name={{item}} - -    with_items: - -      - htop - -      - mc - -      - tmux - -``` - -Now that looks cleaner and more efficient. We used `with_items` to consolidate our package list into one play. If we want to add additional packages, we simply add another line with a hyphen and a package name. Consider `with_items` to be similar to a `for` loop. Every package we list will be installed. - -Commit our new changes back to the repository: -``` -git add local.yml - -git commit -m "added additional packages, cleaned up formatting" - -git push origin master - -``` - -Now we can run our playbook to benefit from the new configuration: -``` -sudo ansible-pull -U https://github.com//ansible.git - -``` - -Admittedly, this example doesn't do much yet; all it does is install a few packages. You could've installed these packages much faster just using your package manager. However, as this series continues, these examples will become more complex and we'll automate more things. By the end, the Ansible configuration you'll create will automate more and more tasks. For example, the one I use automates the installation of hundreds of packages, sets up `cron` jobs, handles desktop configuration, and more. - -From what we've accomplished so far, you can probably already see the big picture. All we had to do was create a repository, put a playbook in that repository, then utilize the `ansible-pull` command to pull down that repository and apply it to our machine. We didn't need to set up a server. In the future, if we want to change our config, we can pull down the repo, update it, then push it back to our repository and apply it. If we're setting up a new machine, we only need to install Ansible and apply the configuration. - -In the next article, we'll automate this even further via `cron` and some additional items. In the meantime, I've copied the code for this article into [my GitHub repository][4] so you can check your syntax against mine. I'll update the code as we go along. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/3/manage-workstation-ansible - -作者:[Jay LaCroix][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://opensource.com/users/jlacroix -[1]:https://www.ansible.com/ -[2]:https://launchpad.net/ubuntu/+ppas -[3]:http://docs.ansible.com/ansible/latest/intro_installation.html -[4]:https://github.com/jlacroix82/ansible_article diff --git a/translated/tech/20180302 How to manage your workstation configuration with Ansible.md b/translated/tech/20180302 How to manage your workstation configuration with Ansible.md new file mode 100644 index 0000000000..e987e4a05a --- /dev/null +++ b/translated/tech/20180302 How to manage your workstation configuration with Ansible.md @@ -0,0 +1,143 @@ +如何使用 Ansible 管理你的工作站配置 +====== + +> 在这个系列的第一篇中,学习一下管理笔记本电脑和台式机配置的基础。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb) + +配置管理是服务器管理和 DevOps 的一个非常重要的方面。“基础架构即代码infrastructure as code”方法可以轻松地以各种配置部署服务器,并动态扩展组织的资源以满足用户需求。但是,对于希望自动设置自己的笔记本电脑和台式机(工作站)的个人管理员的关注较少。 + +在本系列中,我将向你展示如何通过 [Ansible][1] 自动化你的工作站设置,如果你需要或需要重新安装你的机器,这可以让你轻松恢复整个配置。此外,如果你有多个工作站,则可以使用相同的方法在每个工作站上进行相同的配置。在第一篇文章中,我们将为个人或工作计算机设置基本的配置管理,并为本系列的其余部分奠定基础。到本文结束时,你将会因此得到一个可以运作的设置。每篇文章都会自动化更多内容并增加复杂性。 + +### 为什么用 Ansible? + +有许多配置管理解决方案,包括 Salt Stack、Chef 和 Puppet。我更喜欢 Ansible,因为它在资源利用方面更轻量级,语法更容易阅读,并且如果正确使用它可以彻底改变你的配置管理。Ansible 的轻量级特性与这个主题特别相关,因为我们可能不希望运行一整台服务器只是为了自动化我们的笔记本电脑和台式机的设置。一般我们总是想要快一些;我们可以使用某些东西来快速启动和运行,以在我们需要恢复的工作站或在多台机器之间同步我们的配置。我使用 Ansible 的具体方法(我将在本文中演示)非常适用于此:不需要服务器维护。你只需下载配置并运行它。 + +### 我的方法 + +通常,Ansible 运行于中央服务器。它使用一个库存清单inventory文件,该文件是一个文本文件,其中包含我们希望 Ansible 管理的所有主机及其 IP 地址或域名的列表。这对于静态环境非常有用,但对于工作站来说并不理想。原因是我们真的不知道我们的工作站在任一时刻的状态。也许我关闭了台式电脑或笔记本电脑可能会被挂起并放在我的包里。在任何一种情况下,Ansible 服务器都会抱怨,因为如果它们处于脱机状态,它就无法联系到我的机器。我们更需要的是按需方式,我们通过利用 `ansible-pull` 来实现这一目标。`ansible-pull` 命令是 Ansible 的一部分,允许你从 Git 仓库下载配置并立即应用它。你不需要维护服务器或库存清单;你只需运行 `ansible-pull` 命令,给它一个 Git 仓库 URL,它将为你完成剩下的工作。 + +### 起步 + +首先,在要管理的计算机上安装 Ansible。有一个问题是许多发行版都附带了旧版本的 Ansible。可以根据,你肯定希望获得最新版本。Ansible 中经常引入新功能,如果你运行的是旧版本,则你在网上找到的示例语法可能无法正常运行,因为它使用的功能未在你安装的版本中实现。甚至发布的小版本都有很多新功能。其中一个例子是 `dconf` 模块,它是从 Ansible 2.4 开始的新功能。如果你尝试使用使用此模块的语法,除非你使用 2.4 或更新版本,否则会失败。在 Ubuntu 及其衍生产品中,我们可以使用官方个人包存档([PPA][2])轻松安装最新版本的 Ansible。以下命令可以解决这个问题: + +``` +sudo apt-get install software-properties-common +sudo apt-add-repository ppa:ansible/ansible +sudo apt-get update +sudo apt-get install ansible +``` + +如果你没有使用 Ubuntu,请参阅 [Ansible 的文档][3] 了解如何为你的平台获取它。 + +接下来,我们需要一个 Git 仓库来保存我们的配置。满足此要求的最简单方法是在 GitHub 上创建一个空的仓库,或者如果有的话,也可以使用自己的 Git 服务器。为了简单起见,我假设你正在使用 GitHub,因此如果你正在使用其他仓库,请相应调整命令。在 GitHub 中创建一个仓库;你最终会得到一个与此类似的仓库 URL: + +``` +git@github.com:/ansible.git +``` +将该仓库克隆到你的本地工作目录(忽略任何抱怨仓库为空的消息): + +``` +git clone git@github.com:/ansible.git +``` + +现在我们有了一个可以使用的空仓库。将你的工作目录切换到仓库(例如 `cd ./ ansible`),并在你喜欢的文本编辑器中创建名为 `local.yml` 的文件。将以下配置放在该文件中: + +``` +- hosts: localhost +  become: true +  tasks: +  - name: Install htop +    apt: name=htop +``` + +你刚刚创建的文件被称为剧本playbook,安装 `htop` 的指令(我任意选择的一个包作为例子)被称为动作play。剧本本身是一个 YAML 格式的文件,它是一种易于阅读的标记语言。YAML 的完整讲述超出了本文的范围,但你无需专业理解即可熟练使用 Ansible。该配置易于阅读;只需查看此文件,你就可以轻松理解我们正在安装的 `htop` 软件包。要注意一下最后一行的 `apt` 模块,它只适用于基于 Debian 的系统。如果你使用的是 Red Hat 平台,你可以将其更改为 `yum` 而不是 `apt`,或者如果你正在使用 Fedora,则将其更改为 `dnf`。`name` 行只是提供有关我们任务的信息,并将显示在输出中。因此,你需要确保名称具有描述性,以便在需要对多个动作进行故障排除时很容易找到。 + +接下来,让我们将新文件提交到我们的仓库: + +``` +git add local.yml +git commit -m "initial commit" +git push origin master +``` + +现在我们的新剧本应该出现在我们的 GitHub 上的仓库中。我们可以使用以下命令应用我们创建的剧本: + +``` +sudo ansible-pull -U https://github.com//ansible.git +``` + +如果执行正确,`htop`包应该会安装在你的系统上。你可能会在开头附近看到一些警告,抱怨缺少库存清单文件。这很好,因为我们没有使用库存清单文件(我们也不需要这样做)。在输出结束时,它将概述它做的内容。如果 `htop` 安装正确,你应该在输出的最后一行看到 `changed = 1`。 + +它是如何工作的呢?`ansible-pull` 命令使用了 `-U` 选项,它需要一个存储库 URL。出于安全考虑,我给它提供了仓库 URL 的 https 版本,因为我不希望任何主机对仓库具有写访问权限(默认情况下 https 是只读的)。`local.yml` 是预设的剧本名称,因此我们不需要为剧本提供文件名:如果它在仓库的根目录中找到名为 `local.yml` 的剧本,它将自动运行它。接下来,我们在命令前面使用了 `sudo`,因为我们正在修改系统。 + +让我们继续为我们的剧本添加更多的包。我将添加两个包,使它看起来像这样: + +``` +- hosts: localhost +  become: true +  tasks: +  - name: Install htop +    apt: name=htop + +  - name: Install mc +    apt: name=mc +    +  - name: Install tmux +    apt: name=tmux +``` + +我添加了更多的动作(任务)来安装另外两个包,`mc` 和 `tmux`。在此剧本中选择安装的哪些软件包并不重要;我只是随意挑选这些。你应该安装你希望所有的系统都具有的软件包。唯一需要注意的是,在你分发前,你必须知道那个包存在于仓库中。 + +在我们提交并应用此更新的剧本之前,我们应该整理一下它。它可以很好地工作,但(说实话)它看起来有点混乱。让我们尝试在一个动作中安装所有三个包。用下面这个替换你的 `local.yml` 的内容: + +``` +- hosts: localhost +  become: true +  tasks: +  - name: Install packages +    apt: name={{item}} +    with_items: +      - htop +      - mc +      - tmux +``` + +现在看起来更干净、更有效率了。我们使用 `with_items` 将我们的包列表合并为一个动作。如果我们想要添加其他包,我们只需添加另一个带有连字符和包名称的行。可以把 `with_items` 看做类似于 `for` 循环。我们列出的每个包都将安装。 + +将我们的新更改提交回仓库: + +``` +git add local.yml +git commit -m "added additional packages, cleaned up formatting" +git push origin master +``` + +现在我们可以运行我们的剧本以接受新的新配置: + +``` +sudo ansible-pull -U https://github.com//ansible.git +``` + +不可否认,这个例子还没有做多少事情;它所做的就是安装一些软件包。你可以使用包管理器更快地安装这些包。然而,随着这个系列的继续,这些例子将变得更加复杂,我们将自动化更多的东西。最后,你将创建的 Ansible 配置将自动执行越来越多的任务。例如,我自己使用的那个可以自动安装数百个软件包,设置cron 作业,处理桌面配置等等。 + +从我们迄今为止所取得的成就来看,你可能已经有了大概了解。我们所要做的就是创建一个仓库,在该仓库中放置一个剧本,然后利用 `ansible-pull` 命令下拉该仓库并将其应用到我们的机器上。我们不需要设置服务器。将来,如果我们想要更改配置,我们可以拉取该仓库、更新它,然后将其推回到我们的仓库并应用它。如果我们要设置新机器,我们只需要安装 Ansible 并应用配置。 + +在下一篇文章中,我们将通过 cron 和一些其他项目进一步自动化。与此同时,我已将本文的代码复制到 +[我的 GitHub 仓库][4] 中,以便你可以用你的语法对比一下我的。随着我们的进展,我会不断更新代码。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/3/manage-workstation-ansible + +作者:[Jay LaCroix][a] +译者:[wxy](https://github.com/) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/jlacroix +[1]:https://www.ansible.com/ +[2]:https://launchpad.net/ubuntu/+ppas +[3]:http://docs.ansible.com/ansible/latest/intro_installation.html +[4]:https://github.com/jlacroix82/ansible_article From 957fe94834b85d4098102f319cedc6b11e6e0d7d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 11 Jan 2019 22:49:26 +0800 Subject: [PATCH 278/322] PRF:20180302 How to manage your workstation configuration with Ansible.md @wxy --- ... workstation configuration with Ansible.md | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/translated/tech/20180302 How to manage your workstation configuration with Ansible.md b/translated/tech/20180302 How to manage your workstation configuration with Ansible.md index e987e4a05a..017be8fefa 100644 --- a/translated/tech/20180302 How to manage your workstation configuration with Ansible.md +++ b/translated/tech/20180302 How to manage your workstation configuration with Ansible.md @@ -1,25 +1,25 @@ 如何使用 Ansible 管理你的工作站配置 ====== -> 在这个系列的第一篇中,学习一下管理笔记本电脑和台式机配置的基础。 +> 在这个系列的第一篇中,学习一下管理笔记本电脑和台式机配置的基础内容。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb) 配置管理是服务器管理和 DevOps 的一个非常重要的方面。“基础架构即代码infrastructure as code”方法可以轻松地以各种配置部署服务器,并动态扩展组织的资源以满足用户需求。但是,对于希望自动设置自己的笔记本电脑和台式机(工作站)的个人管理员的关注较少。 -在本系列中,我将向你展示如何通过 [Ansible][1] 自动化你的工作站设置,如果你需要或需要重新安装你的机器,这可以让你轻松恢复整个配置。此外,如果你有多个工作站,则可以使用相同的方法在每个工作站上进行相同的配置。在第一篇文章中,我们将为个人或工作计算机设置基本的配置管理,并为本系列的其余部分奠定基础。到本文结束时,你将会因此得到一个可以运作的设置。每篇文章都会自动化更多内容并增加复杂性。 +在本系列中,我将向你展示如何通过 [Ansible][1] 自动化你的工作站设置,如果你想要或需要重新安装你的机器,这可以让你轻松恢复整个配置。此外,如果你有多个工作站,则可以使用相同的方法在每个工作站上进行相同的配置。在第一篇文章中,我们将为个人或工作计算机设置基本的配置管理,并为本系列的其余部分奠定基础。到本文结束时,你将会因此得到一个可以工作的环境。本系列之后的每篇文章都会自动化更多内容并增加复杂性。 ### 为什么用 Ansible? -有许多配置管理解决方案,包括 Salt Stack、Chef 和 Puppet。我更喜欢 Ansible,因为它在资源利用方面更轻量级,语法更容易阅读,并且如果正确使用它可以彻底改变你的配置管理。Ansible 的轻量级特性与这个主题特别相关,因为我们可能不希望运行一整台服务器只是为了自动化我们的笔记本电脑和台式机的设置。一般我们总是想要快一些;我们可以使用某些东西来快速启动和运行,以在我们需要恢复的工作站或在多台机器之间同步我们的配置。我使用 Ansible 的具体方法(我将在本文中演示)非常适用于此:不需要服务器维护。你只需下载配置并运行它。 +有许多配置管理解决方案,包括 Salt Stack、Chef 和 Puppet。我更喜欢 Ansible,因为它在资源利用方面更轻量级,语法更容易阅读,并且如果正确使用它可以彻底改变你的配置管理。Ansible 的轻量级特性与这个主题特别相关,因为我们可能不希望运行一整台服务器而只是为了自动化我们的笔记本电脑和台式机的设置。一般我们总是想要快一些;我们可以使用某些东西来快速启动和运行,以在我们需要恢复的工作站或在多台机器之间同步我们的配置。我使用 Ansible 的具体方法(我将在本文中演示)非常适用于此,而不需要维护服务器。你只需下载配置并运行它。 ### 我的方法 -通常,Ansible 运行于中央服务器。它使用一个库存清单inventory文件,该文件是一个文本文件,其中包含我们希望 Ansible 管理的所有主机及其 IP 地址或域名的列表。这对于静态环境非常有用,但对于工作站来说并不理想。原因是我们真的不知道我们的工作站在任一时刻的状态。也许我关闭了台式电脑或笔记本电脑可能会被挂起并放在我的包里。在任何一种情况下,Ansible 服务器都会抱怨,因为如果它们处于脱机状态,它就无法联系到我的机器。我们更需要的是按需方式,我们通过利用 `ansible-pull` 来实现这一目标。`ansible-pull` 命令是 Ansible 的一部分,允许你从 Git 仓库下载配置并立即应用它。你不需要维护服务器或库存清单;你只需运行 `ansible-pull` 命令,给它一个 Git 仓库 URL,它将为你完成剩下的工作。 +通常,Ansible 运行于中央服务器。它使用一个库存清单inventory文件,该文件是一个文本文件,其中包含我们希望 Ansible 管理的所有主机及其 IP 地址或域名的列表。这对于静态环境非常有用,但对于工作站来说并不理想。原因是我们真的不知道我们的工作站在某一时刻的状态。也许我关闭了台式电脑,或者笔记本电脑可能会被挂起并放在我的包里。在任何一种情况下,Ansible 服务器都会抱怨,因为如果它们处于脱机状态,Ansible 就无法联系到我的机器。我们更需要的是按需方式,我们通过利用 `ansible-pull` 来实现这一目标。`ansible-pull` 命令是 Ansible 的一个命令,允许你从 Git 仓库下载配置并立即应用它。你不需要维护服务器或库存清单;你只需运行 `ansible-pull` 命令,给它一个 Git 仓库 URL,它将为你完成剩下的工作。 ### 起步 -首先,在要管理的计算机上安装 Ansible。有一个问题是许多发行版都附带了旧版本的 Ansible。可以根据,你肯定希望获得最新版本。Ansible 中经常引入新功能,如果你运行的是旧版本,则你在网上找到的示例语法可能无法正常运行,因为它使用的功能未在你安装的版本中实现。甚至发布的小版本都有很多新功能。其中一个例子是 `dconf` 模块,它是从 Ansible 2.4 开始的新功能。如果你尝试使用使用此模块的语法,除非你使用 2.4 或更新版本,否则会失败。在 Ubuntu 及其衍生产品中,我们可以使用官方个人包存档([PPA][2])轻松安装最新版本的 Ansible。以下命令可以解决这个问题: +首先,在要管理的计算机上安装 Ansible。有一个问题是许多发行版都附带了旧版本的 Ansible。根据经验,你肯定希望获得最新版本。Ansible 中经常引入新功能,如果你运行的是旧版本,则你在网上找到的示例语法可能无法正常运行,因为它使用的功能未在你安装的版本中实现。甚至发布的小版本都有很多新功能。其中一个例子是 `dconf` 模块,它是从 Ansible 2.4 开始的新功能。如果你尝试使用使用此模块的语法,除非你使用 2.4 或更新版本,否则会失败。在 Ubuntu 及其衍生产品中,我们可以使用官方个人包存档([PPA][2])轻松安装最新版本的 Ansible。以下命令可以解决这个问题: ``` sudo apt-get install software-properties-common @@ -35,13 +35,14 @@ sudo apt-get install ansible ``` git@github.com:/ansible.git ``` + 将该仓库克隆到你的本地工作目录(忽略任何抱怨仓库为空的消息): ``` git clone git@github.com:/ansible.git ``` -现在我们有了一个可以使用的空仓库。将你的工作目录切换到仓库(例如 `cd ./ ansible`),并在你喜欢的文本编辑器中创建名为 `local.yml` 的文件。将以下配置放在该文件中: +现在我们有了一个可以使用的空仓库。将你的工作目录切换到仓库(例如 `cd ./ansible`),并在你喜欢的文本编辑器中创建名为 `local.yml` 的文件。将以下配置放在该文件中: ``` - hosts: localhost @@ -51,7 +52,7 @@ git clone git@github.com:/ansible.git     apt: name=htop ``` -你刚刚创建的文件被称为剧本playbook,安装 `htop` 的指令(我任意选择的一个包作为例子)被称为动作play。剧本本身是一个 YAML 格式的文件,它是一种易于阅读的标记语言。YAML 的完整讲述超出了本文的范围,但你无需专业理解即可熟练使用 Ansible。该配置易于阅读;只需查看此文件,你就可以轻松理解我们正在安装的 `htop` 软件包。要注意一下最后一行的 `apt` 模块,它只适用于基于 Debian 的系统。如果你使用的是 Red Hat 平台,你可以将其更改为 `yum` 而不是 `apt`,或者如果你正在使用 Fedora,则将其更改为 `dnf`。`name` 行只是提供有关我们任务的信息,并将显示在输出中。因此,你需要确保名称具有描述性,以便在需要对多个动作进行故障排除时很容易找到。 +你刚刚创建的文件被称为剧本playbook,安装 `htop` 的指令(我任意选择的一个包作为例子)被称为动作play。剧本本身是一个 YAML 格式的文件,它是一种易于阅读的标记语言。对 YAML 的完整讲述超出了本文的范围,但你无需专业理解即可熟练使用 Ansible。该配置易于阅读;只需查看此文件,你就可以轻松理解我们正在安装的 `htop` 软件包。要注意一下最后一行的 `apt` 模块,它只适用于基于 Debian 的系统。如果你使用的是 Red Hat 平台,你可以将其更改为 `yum` 而不是 `apt`,或者如果你正在使用 Fedora,则将其更改为 `dnf`。`name` 行只是提供有关我们任务的信息,并将显示在输出中。因此,你需要确保名称具有描述性,以便在需要对多个动作进行故障排除时很容易找到。 接下来,让我们将新文件提交到我们的仓库: @@ -69,7 +70,7 @@ sudo ansible-pull -U https://github.com//ansible.git 如果执行正确,`htop`包应该会安装在你的系统上。你可能会在开头附近看到一些警告,抱怨缺少库存清单文件。这很好,因为我们没有使用库存清单文件(我们也不需要这样做)。在输出结束时,它将概述它做的内容。如果 `htop` 安装正确,你应该在输出的最后一行看到 `changed = 1`。 -它是如何工作的呢?`ansible-pull` 命令使用了 `-U` 选项,它需要一个存储库 URL。出于安全考虑,我给它提供了仓库 URL 的 https 版本,因为我不希望任何主机对仓库具有写访问权限(默认情况下 https 是只读的)。`local.yml` 是预设的剧本名称,因此我们不需要为剧本提供文件名:如果它在仓库的根目录中找到名为 `local.yml` 的剧本,它将自动运行它。接下来,我们在命令前面使用了 `sudo`,因为我们正在修改系统。 +它是如何工作的呢?`ansible-pull` 命令使用了 `-U` 选项,它需要一个仓库 URL。出于安全考虑,我给它提供了仓库 URL 的 https 版本,因为我不希望任何主机对仓库具有写访问权限(默认情况下 https 是只读的)。`local.yml` 是预设的剧本名称,因此我们不需要为剧本提供文件名:如果它在仓库的根目录中找到名为 `local.yml` 的剧本,它将自动运行它。接下来,我们在命令前面使用了 `sudo`,因为我们正在修改系统。 让我们继续为我们的剧本添加更多的包。我将添加两个包,使它看起来像这样: @@ -87,9 +88,9 @@ sudo ansible-pull -U https://github.com//ansible.git     apt: name=tmux ``` -我添加了更多的动作(任务)来安装另外两个包,`mc` 和 `tmux`。在此剧本中选择安装的哪些软件包并不重要;我只是随意挑选这些。你应该安装你希望所有的系统都具有的软件包。唯一需要注意的是,在你分发前,你必须知道那个包存在于仓库中。 +我添加了更多的动作(任务)来安装另外两个包,`mc` 和 `tmux`。在此剧本中选择安装的哪些软件包并不重要;我只是随意挑选这些。你应该安装你希望所有的系统都具有的软件包。唯一需要注意的是,在你分发前,你必须知道那个包存在于软件仓库中。 -在我们提交并应用此更新的剧本之前,我们应该整理一下它。它可以很好地工作,但(说实话)它看起来有点混乱。让我们尝试在一个动作中安装所有三个包。用下面这个替换你的 `local.yml` 的内容: +在我们提交并应用这个更新的剧本之前,我们应该整理一下它。它可以很好地工作,但(说实话)它看起来有点混乱。让我们尝试在一个动作中安装所有三个包。用下面这个替换你的 `local.yml` 的内容: ``` - hosts: localhost @@ -119,9 +120,9 @@ git push origin master sudo ansible-pull -U https://github.com//ansible.git ``` -不可否认,这个例子还没有做多少事情;它所做的就是安装一些软件包。你可以使用包管理器更快地安装这些包。然而,随着这个系列的继续,这些例子将变得更加复杂,我们将自动化更多的东西。最后,你将创建的 Ansible 配置将自动执行越来越多的任务。例如,我自己使用的那个可以自动安装数百个软件包,设置cron 作业,处理桌面配置等等。 +不可否认,这个例子还没有做多少事情;它所做的就是安装一些软件包。你可以使用包管理器更快地安装这些包。然而,随着这个系列的继续,这些例子将变得更加复杂,我们将自动化更多的东西。最后,你创建的 Ansible 配置将自动执行越来越多的任务。例如,我自己使用的那个配置可以自动安装数百个软件包、设置cron 作业、处理桌面配置等等。 -从我们迄今为止所取得的成就来看,你可能已经有了大概了解。我们所要做的就是创建一个仓库,在该仓库中放置一个剧本,然后利用 `ansible-pull` 命令下拉该仓库并将其应用到我们的机器上。我们不需要设置服务器。将来,如果我们想要更改配置,我们可以拉取该仓库、更新它,然后将其推回到我们的仓库并应用它。如果我们要设置新机器,我们只需要安装 Ansible 并应用配置。 +从我们迄今为止所取得的成就来看,你可能已经有了大概了解。我们所要做的就是创建一个仓库,在该仓库中放置一个剧本,然后利用 `ansible-pull` 命令拉取该仓库并将其应用到我们的机器上。我们不需要设置服务器。将来,如果我们想要更改配置,我们可以拉取该仓库、更新它,然后将其推回到我们的仓库并应用它。如果我们要设置新机器,我们只需要安装 Ansible 并应用配置。 在下一篇文章中,我们将通过 cron 和一些其他项目进一步自动化。与此同时,我已将本文的代码复制到 [我的 GitHub 仓库][4] 中,以便你可以用你的语法对比一下我的。随着我们的进展,我会不断更新代码。 @@ -132,7 +133,7 @@ via: https://opensource.com/article/18/3/manage-workstation-ansible 作者:[Jay LaCroix][a] 译者:[wxy](https://github.com/) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 1cbe2cf36175cff70fad37034551149d489d7a04 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 11 Jan 2019 22:49:59 +0800 Subject: [PATCH 279/322] PUB:20180302 How to manage your workstation configuration with Ansible.md @wxy https://linux.cn/article-10434-1.html --- ...2 How to manage your workstation configuration with Ansible.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180302 How to manage your workstation configuration with Ansible.md (100%) diff --git a/translated/tech/20180302 How to manage your workstation configuration with Ansible.md b/published/20180302 How to manage your workstation configuration with Ansible.md similarity index 100% rename from translated/tech/20180302 How to manage your workstation configuration with Ansible.md rename to published/20180302 How to manage your workstation configuration with Ansible.md From f64dd70496bf538405613adedfb9eaf0fb9dde30 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 12 Jan 2019 10:43:19 +0800 Subject: [PATCH 280/322] PRF:20181210 Snake your way across your Linux terminal.md @geekpi --- ...nake your way across your Linux terminal.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/translated/tech/20181210 Snake your way across your Linux terminal.md b/translated/tech/20181210 Snake your way across your Linux terminal.md index a9525a9970..d2fc1961a6 100644 --- a/translated/tech/20181210 Snake your way across your Linux terminal.md +++ b/translated/tech/20181210 Snake your way across your Linux terminal.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Snake your way across your Linux terminal) @@ -9,16 +9,18 @@ 在 Linux 终端中玩贪吃蛇 ====== -有了这个 20 世纪 70 年代的经典重制游戏,Python 将不再是你在 Linux 终端能发现的唯一的“蛇”。 + +> 有了这个 20 世纪 70 年代的经典重制游戏,Python 将不再是你在 Linux 终端能发现的唯一的“蛇”。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-snake.png?itok=oNhqUTDu) -欢迎回到 Linux 命令行玩具日历。如果这是你第一次访问该系列,你可能会问自己甚至是命令行玩具。这很难确切地说,但我的定义是任何可以帮助你在终端玩得开心的东西。 +欢迎回到 Linux 命令行玩具日历。如果这是你第一次访问该系列,你可能会问什么是命令行玩具。这很难确切地说,但我的定义是任何可以帮助你在终端玩得开心的东西。 我们这周都在介绍游戏,这很有趣,接着让我们看下今天的游戏,贪吃蛇! -贪吃蛇是一个古老又很好的游戏。它的版本似乎一直存在着。我记得我第一次玩得版本是 20 世纪 90 年代与 [QBasic][2] 一起打包发布的 [Nibbles][1],它对我理解什么是编程语言起了很重要的作用。我有游戏的源码,我可以修改并查看会发生什么,并学习到一些组成这个编程语言的有趣词汇究竟是什么意思。 +贪吃蛇是一个古老又很好的游戏,这些年一直有各种版本。我记得我第一次玩得版本是 20 世纪 90 年代与 [QBasic][2] 一起打包发布的 [Nibbles][1],它对我理解什么是编程语言起了很重要的作用。我有游戏的源码,我可以修改并查看会发生什么,并学习到一些组成这个编程语言的有趣词汇究竟是什么意思。 -今天的[贪吃蛇][3]是用 Go 写的,它很简单并且和原版的游戏一样有趣。像大多数简单的老游戏一样,它有很多版本可供选择。这今天的贪吃蛇中,甚至还有一个经典的 [bsdgames][4] 形式的包,它几乎一定为你的发行版打包了。 +今天的[贪吃蛇][3]是用 Go 写的,它很简单并且和原版的游戏一样有趣。像大多数简单的老游戏一样,它有很多版本可供选择。这今天的贪吃蛇中,甚至还有一个经典的 [bsdgames][4] 形式的包,它的发行版几乎一定有它。 但我喜欢的是用 Docker 打包的贪吃蛇,因为我可以轻松地在命令行中运行,而不用担心发行版相关的问题。这个版本使用 15 个随机的食物 emoji 图案让蛇来吃。我玩得不好。不管怎样,请试一下: @@ -27,7 +29,9 @@ $ docker run -ti dyego/snake-game ``` 这个贪吃蛇以 MIT 许可证开源,你可在 [Github][3] 取得源码。 + ![](https://opensource.com/sites/default/files/uploads/linux-toy-snake-animated.gif) + 你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。请在评论区留言,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 请查看昨天的玩具,[数字 2 的力量,Linux 的力量:在命令行中玩 2048][5],记得明天再来! @@ -39,7 +43,7 @@ via: https://opensource.com/article/18/12/linux-toy-snake 作者:[Jason Baker][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -49,4 +53,4 @@ via: https://opensource.com/article/18/12/linux-toy-snake [2]: https://en.wikipedia.org/wiki/QBasic [3]: https://github.com/DyegoCosta/snake-game [4]: https://github.com/vattam/BSDGames -[5]: https://opensource.com/article/18/12/linux-toy-2048 \ No newline at end of file +[5]: https://opensource.com/article/18/12/linux-toy-2048 From 739dae228527979915cf07a52d9a85708373b18f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 12 Jan 2019 10:43:37 +0800 Subject: [PATCH 281/322] PUB:20181210 Snake your way across your Linux terminal.md @geekpi https://linux.cn/article-10435-1.html --- .../20181210 Snake your way across your Linux terminal.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20181210 Snake your way across your Linux terminal.md (100%) diff --git a/translated/tech/20181210 Snake your way across your Linux terminal.md b/published/20181210 Snake your way across your Linux terminal.md similarity index 100% rename from translated/tech/20181210 Snake your way across your Linux terminal.md rename to published/20181210 Snake your way across your Linux terminal.md From 466f3d2042e3c5b6109c0ff68df1295530182e1a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 12 Jan 2019 10:44:21 +0800 Subject: [PATCH 282/322] PUB:20181210 Snake your way across your Linux terminal.md @geekpi https://linux.cn/article-10435-1.html --- .../20181210 Snake your way across your Linux terminal.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/published/20181210 Snake your way across your Linux terminal.md b/published/20181210 Snake your way across your Linux terminal.md index d2fc1961a6..3e2a22209c 100644 --- a/published/20181210 Snake your way across your Linux terminal.md +++ b/published/20181210 Snake your way across your Linux terminal.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10435-1.html) [#]: subject: (Snake your way across your Linux terminal) [#]: via: (https://opensource.com/article/18/12/linux-toy-snake) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) From 4d6eb09e2f628efa33d10b0b533a70627d822b01 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 12 Jan 2019 15:30:31 +0800 Subject: [PATCH 283/322] PRF:20181223 The Linux command line can fetch fun from afar.md @geekpi --- ...Linux command line can fetch fun from afar.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/translated/tech/20181223 The Linux command line can fetch fun from afar.md b/translated/tech/20181223 The Linux command line can fetch fun from afar.md index d9f64745f3..480736aeb7 100644 --- a/translated/tech/20181223 The Linux command line can fetch fun from afar.md +++ b/translated/tech/20181223 The Linux command line can fetch fun from afar.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (The Linux command line can fetch fun from afar) @@ -9,7 +9,9 @@ 能从远程获得乐趣的 Linux 命令 ====== -使用这些工具从远程了解天气、阅读资料等。 + +> 使用这些工具从远程了解天气、阅读资料等。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-remote.png?itok=mHm9POPi) 我们即将结束为期 24 天的 Linux 命令行玩具日历。希望你有一直在看,如果没有,请回到[开始][1],从头看过来。你会发现 Linux 终端有很多游戏、消遣和奇怪之处。 @@ -24,11 +26,11 @@ $ telnet towel.blinkenlights.nl ``` -我第一次看到它是十年之前,因此我对于它还存在优点惊奇。如果你还没看过,请留出一点时间看一下。你不会后悔的。 +我第一次看到它是十年之前,因此我对于它还存在有点惊奇。如果你还没看过,请留出一点时间看一下。你不会后悔的。 ![](https://opensource.com/sites/default/files/uploads/linux-toy-star-wars.png) -接下来,Opensource.com 的撰稿人 [Manuel Dewald][2] 提出了一种从终端获取当地天气的方法。它很简单,你只需安装 **curl**(或者,**wget**)。 +接下来,Opensource.com 的撰稿人 [Manuel Dewald][2] 提出了一种从终端获取当地天气的方法。它很简单,你只需安装 `curl`(或者,`wget`)。 ``` $ curl wttr.in @@ -36,7 +38,7 @@ $ curl wttr.in ![](https://opensource.com/sites/default/files/uploads/linux-toy-weather.png) -最后,在假期中虽然你可以从[命令行 Web 浏览器][3]浏览你喜欢的网站(包括 Opensource.com),但有一些我最喜欢的网站可以通过专用客户端更轻松地浏览。其中两个是 Reddit 和 Hacker News,我被推荐过一些它们的客户端,你可能也想尝试,它们都使用开源许可。我尝试过 [haxor-news][4] (Hacker News) 和 [rtv][5] (Reddit),它们都还不错。 +最后,在假期中虽然你可以从[命令行 Web 浏览器][3]浏览你喜欢的网站(包括 Opensource.com),但有一些我最喜欢的网站可以通过专用客户端更轻松地浏览。其中两个是 Reddit 和 Hacker News,有人推荐给我一些它们的客户端,你可能也想尝试,它们都使用开源许可。我尝试过 [haxor-news][4] (Hacker News) 和 [rtv][5] (Reddit),它们都还不错。 你有特别喜欢的命令行小玩具需要我介绍的吗?提交今年的建议有点晚了,但我们仍然希望在新的一年里有一些很酷的命令行玩具。请在下面的评论中告诉我,我会查看的。让我知道你对今天的玩具有何看法。 @@ -49,7 +51,7 @@ via: https://opensource.com/article/18/12/linux-toy-remote 作者:[Jason Baker][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -60,4 +62,4 @@ via: https://opensource.com/article/18/12/linux-toy-remote [3]: https://opensource.com/article/16/12/web-browsers-linux-command-line [4]: https://github.com/donnemartin/haxor-news [5]: https://github.com/michael-lazar/rtv -[6]: https://opensource.com/article/18/12/linux-toy-youtube-dl \ No newline at end of file +[6]: https://opensource.com/article/18/12/linux-toy-youtube-dl From 0d8199c4b7045697f881dd8ab383b03d1a4f3099 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 12 Jan 2019 15:31:25 +0800 Subject: [PATCH 284/322] PUB:20181223 The Linux command line can fetch fun from afar.md @geekpi https://linux.cn/article-10437-1.html --- ...20181223 The Linux command line can fetch fun from afar.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181223 The Linux command line can fetch fun from afar.md (97%) diff --git a/translated/tech/20181223 The Linux command line can fetch fun from afar.md b/published/20181223 The Linux command line can fetch fun from afar.md similarity index 97% rename from translated/tech/20181223 The Linux command line can fetch fun from afar.md rename to published/20181223 The Linux command line can fetch fun from afar.md index 480736aeb7..92b61d1721 100644 --- a/translated/tech/20181223 The Linux command line can fetch fun from afar.md +++ b/published/20181223 The Linux command line can fetch fun from afar.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10437-1.html) [#]: subject: (The Linux command line can fetch fun from afar) [#]: via: (https://opensource.com/article/18/12/linux-toy-remote) [#]: author: (Jason Baker https://opensource.com/users/jason-baker) From 3c3d2ce32f40805c075ff48ae1e06bae0f356344 Mon Sep 17 00:00:00 2001 From: LuMing <784315443@qq.com> Date: Sat, 12 Jan 2019 15:39:11 +0800 Subject: [PATCH 285/322] translated --- ...s To Find System-Server Uptime In Linux.md | 86 ++++++++++--------- 1 file changed, 46 insertions(+), 40 deletions(-) rename {sources => translated}/tech/20180503 11 Methods To Find System-Server Uptime In Linux.md (51%) diff --git a/sources/tech/20180503 11 Methods To Find System-Server Uptime In Linux.md b/translated/tech/20180503 11 Methods To Find System-Server Uptime In Linux.md similarity index 51% rename from sources/tech/20180503 11 Methods To Find System-Server Uptime In Linux.md rename to translated/tech/20180503 11 Methods To Find System-Server Uptime In Linux.md index a2060fb130..68ca8a1371 100644 --- a/sources/tech/20180503 11 Methods To Find System-Server Uptime In Linux.md +++ b/translated/tech/20180503 11 Methods To Find System-Server Uptime In Linux.md @@ -1,27 +1,27 @@ -LuMing is translating -11 Methods To Find System/Server Uptime In Linux +Linux 上查看系统/服务器运行时间的 11 种方法 ====== -Do you want to know, how long your Linux system has been running without downtime? when the system is up and what date. +你是否想知道自己的 Linux 系统除宕机外正常运行了多长时间?系统什么时候启动以及现在的日期? -There are multiple commands is available in Linux to check server/system uptime and most of users prefer the standard and very famous command called `uptime` to get this details. +Linux 上有多个查看服务器/系统运行时间的命令,大多数用户喜欢使用标准并且很有名的 `uptime` 命令获取这些具体的信息。 -Server uptime is not important for some people but it’s very important for server administrators when the server running with mission-critical applications such as online shopping portal, netbanking portal, etc,. +服务器的运行时间对一些用户来说不那么重要,但是当服务器运行诸如在线商城门户portal、网上银行门户等关键任务应用mission-critical applications时,它对于服务器管理员server adminstrators来说就至关重要。 -It must be zero downtime because if there is a down time then it will impact badly to million users. +它必须做到 0 宕机,因为一旦停机就会影响到数百万用户。 -As i told, many commands are available to check server uptime in Linux. In this tutorial we are going teach you how to check this using below 11 methods. +正如我所说,许多命令都可以让用户看到 Linux 服务器的运行时间。在这篇教程里我会教你如何使用下面 11 种方式来查看。 -Uptime means how long the server has been up since its last shutdown or reboot. +正常运行时间uptime指的是服务器自从上次关闭或重启以来经过的时间。 -The uptime command the fetch the details from `/proc` files and print the server uptime, the `/proc` file is not directly readable by humans. +`uptime` 命令获取 `/proc` 文件中的详细信息并输出正常运行时间,`/proc` 文件不能直接读取。 -The below commands will print how long the system has been running and up. It also shows some additional information. +以下这些命令会输出系统运行和启动的时间。也会显示一些额外的信息。 -### Method-1 : Using uptime Command +### 方法 1:使用 uptime 命令 -uptime command will tell how long the system has been running. It gives a one line display of the following information. +`uptime` 命令会告诉你系统运行了多长时间。它会用一行显示以下信息。 + +当前时间,系统运行时间,当前登录用户的数量,过去 1 分钟、5 分钟、15 分钟系统负载的均值。 -The current time, how long the system has been running, how many users are currently logged on, and the system load averages for the past 1, 5, and 15 minutes. ``` # uptime @@ -29,10 +29,9 @@ The current time, how long the system has been running, how many users are curre ``` -### Method-2 : Using w Command +### 方法 2:使用 w 命令 -w command provides a quick summary of every user logged into a computer, what each user is currently doing, -and what load all the activity is imposing on the computer itself. The command is a one-command combination of several other Unix programs: who, uptime, and ps -a. +`w` 命令为每个登录进系统的用户,每个用户当前所做的事情,所有活动的负载对计算机的影响提供了一个快速的概要。这个单一命令结合了多个 Unix 程序:who,uptime,和 ps -a。 ``` # w @@ -42,11 +41,11 @@ root pts/1 103.5.134.167 08:34 0.00s 0.01s 0.00s w ``` -### Method-3 : Using top Command +### 方法 3:使用 top 命令 -Top command is one of the basic command to monitor real-time system processes in Linux. It display system information and running processes information like uptime, average load, tasks running, number of users logged in, number of CPUs & cpu utilization, Memory & swap information. Run top command then hit E to bring the memory utilization in MB. +`top` 命令是 Linux 上监视实时系统进程的基础命令之一。它显示系统信息和运行进程的信息,例如正常运行时间,平均负载,运行的任务,登录用户数量,CPU 数量 & CPU 利用率,内存 & 交换空间信息。 -**Suggested Read :** [TOP Command Examples to Monitor Server Performance][1] +**推荐阅读:**[TOP 命令监视服务器性能的例子][1] ``` # top -c @@ -65,9 +64,10 @@ Swap: 2097148k total, 0k used, 2097148k free, 1098140k cached ``` -### Method-4 : Using who Command +### 方法 4:使用 who 命令 + +`who` 命令列出当前登录进计算机的用户。`who` 命令与 `w` 命令类似,但后者还包含额外的数据和统计信息。 -who command displays a list of users who are currently logged into the computer. The who command is related to the command w, which provides the same information but also displays additional data and statistics. ``` # who -b @@ -75,9 +75,10 @@ system boot 2018-04-12 02:48 ``` -### Method-5 : Using last Command +### 方法 5:使用 last 命令 + +`last` 命令列出最近登录过的用户。`last` 往回查找 `/var/log/wtmp` 文件并显示自从文件创建后登录进(出)的用户。 -The last command displays a list of last logged in users. Last searches back through the file /var/log/wtmp and displays a list of all users logged in (and out) since that file was created. ``` # last reboot -F | head -1 | awk '{print $5,$6,$7,$8,$9}' @@ -85,11 +86,12 @@ Thu Apr 12 02:48:04 2018 ``` -### Method-6 : Using /proc/uptime File +### 方法 6:使用 /proc/uptime 文件 -This file contains information detailing how long the system has been on since its last restart. The output of `/proc/uptime` is quite minimal. +这个文件中包含系统上次启动后运行时间的详细信息。`/proc/uptime` 的输出相当精简。 + +第一个数字是系统自从启动的总秒数。第二个数字是总时间中系统空闲所花费的时间,以秒为单位。 -The first number is the total number of seconds the system has been up. The second number is how much of that time the machine has spent idle, in seconds. ``` # cat /proc/uptime @@ -97,19 +99,21 @@ The first number is the total number of seconds the system has been up. The seco ``` -# date -d “$(Method-7 : Using tuptime Command +### 方法 7:使用 tuptime 命令 + +`tuptime` 是一个汇报系统运行时间的工具,输出历史信息并作以统计,保留重启之间的数据。和 `uptime` 命令很像,但输出更有意思一些。 -Tuptime is a tool for report the historical and statistical running time of the system, keeping it between restarts. Like uptime command but with more interesting output. ``` $ tuptime ``` -### Method-8 : Using htop Command +### 方法 8:使用 htop 命令 -htop is an interactive process viewer for Linux which was developed by Hisham using ncurses library. Htop have many of features and options compared to top command. +`htop` 是运行在 Linux 上一个由 Hisham 使用 ncurses 库开发的交互式进程查看器。`htop` 比起 `top` 有很多的特性和选项。 + +**推荐阅读:** [使用 Htop 命令监控系统资源][2] -**Suggested Read :** [Monitor system resources using Htop command][2] ``` # htop @@ -126,13 +130,13 @@ htop is an interactive process viewer for Linux which was developed by Hisham us ``` -### Method-9 : Using glances Command +### 方法 9:使用 glances 命令 -Glances is a cross-platform curses-based system monitoring tool written in Python. We can say all in one place, like maximum of information in a minimum of space. It uses psutil library to get information from your system. +`glances` 是一个跨平台基于 curses 使用 python 写的监控工具。我们可以说它非常强大,仅用一点空间就能获得很多信息。它使用 psutil 库从系统中获取信息。 -Glances capable to monitor CPU, Memory, Load, Process list, Network interface, Disk I/O, Raid, Sensors, Filesystem (and folders), Docker, Monitor, Alert, System info, Uptime, Quicklook (CPU, MEM, LOAD), etc,. +`glances` 可以监控 CPU,内存,负载,进程,网络接口,磁盘 I/O,磁盘阵列RAID,传感器,文件系统(与文件夹),容器,显示器,Alert 日志,系统信息,运行时间,快速查看Quicklook(CPU,内存等)。 -**Suggested Read :** [Glances (All in one Place)– An Advanced Real Time System Performance Monitoring Tool for Linux][3] +**推荐阅读:** [Glances (集大成)– Linux 上高级的实时系统运行监控工具][3] ``` glances @@ -157,9 +161,10 @@ sda1 9.46M 12K 0.0 4.9 1.78G 97.2M 6125 daygeek 0 S 1:36.57 0 0 /usr/lib/firefox ``` -### Method-10 : Using stat Command +### 方法 10:使用 stat 命令 + +`stat` 命令显示指定文件或文件系统的详细状态。 -stat command displays the detailed status of a particular file or a file system. ``` # stat /var/log/dmesg | grep Modify @@ -167,9 +172,10 @@ Modify: 2018-04-12 02:48:04.027999943 -0400 ``` -### Method-11 : Using procinfo Command +### 方法 11:使用 procinfo 命令 + +`procinfo` 从 `/proc` 文件夹下收集一些系统数据并将其很好的格式化输出在标准输出设备上。 -procinfo gathers some system data from the /proc directory and prints it nicely formatted on the standard output device. ``` # procinfo | grep Bootup @@ -183,7 +189,7 @@ via: https://www.2daygeek.com/11-methods-to-find-check-system-server-uptime-in-l 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) +译者:[LuuMing](https://github.com/LuuMing) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 74bf1a63035fea0cc74cb8ef90b7bf4d509734c6 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Sat, 12 Jan 2019 20:06:36 +0800 Subject: [PATCH 286/322] Translating --- ... Record Your Terminal Sessions As SVG Animations In Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md b/sources/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md index f25406a66a..7a50c13c20 100644 --- a/sources/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md +++ b/sources/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (zhs852) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d6497e0eee7e47acb26c15e7c789affbc14f5020 Mon Sep 17 00:00:00 2001 From: XYenChi <466530436@qq.com> Date: Sat, 12 Jan 2019 21:47:53 +0800 Subject: [PATCH 287/322] Update 20171222 10 keys to quick game development.md XYenChi is translating --- sources/talk/20171222 10 keys to quick game development.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/talk/20171222 10 keys to quick game development.md b/sources/talk/20171222 10 keys to quick game development.md index 02f4388044..50c8164ae0 100644 --- a/sources/talk/20171222 10 keys to quick game development.md +++ b/sources/talk/20171222 10 keys to quick game development.md @@ -1,3 +1,4 @@ +XYenChi is translating 10 keys to quick game development ====== ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb) From 4dbebf2cdffebd4f0b9fa9f5f88ad8fb44e605a3 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Sat, 12 Jan 2019 22:01:08 +0800 Subject: [PATCH 288/322] Translated --- ...nal Sessions As SVG Animations In Linux.md | 107 +++++++++--------- 1 file changed, 52 insertions(+), 55 deletions(-) diff --git a/sources/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md b/sources/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md index 7a50c13c20..45219568f8 100644 --- a/sources/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md +++ b/sources/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md @@ -7,96 +7,93 @@ [#]: via: (https://www.2daygeek.com/termtosvg-record-your-terminal-sessions-as-svg-animations-in-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -Termtosvg – Record Your Terminal Sessions As SVG Animations In Linux +Termtosvg – 将你在 Linux 终端中操作录制成 SVG 动画 ====== -By default everyone prefer history command to review/recall the previously entered commands in terminal. +一般人喜欢使用历史命令功能来查看/再次调用之前在终端中输入的命令。 -But unfortunately, that shows only the commands that we ran and doesn’t shows the commands output which was performed previously. +不幸的是,那样做只会显示先前输入的命令,而不是之前输出的内容。 -There are many utilities available in Linux to record the terminal session activity. +在 Linux 中,有许多可以用来记录终端活动的实用工具。 -This tool will help us to record the users terminal activity, also will help us to identify other useful information from the output. +这种工具将会帮助我们记录用户在终端中的活动,并帮助我们识别输出中有用的信息。 -Also, we had written about few utilities in the past and today also we are going to discuss about the same kind of topic. +在这之前,我们已经介绍了一些这类实用工具了。今天,让我们接着讨论这类工具。 -If you would like to check other utilities to record your Linux terminal session activity then you can give a try to **[Script Command][1]** and **[Terminalizer Tool][2]**. +如果你希望尝试其它一些记录你终端活动的工具,我推荐你试试 **[Script Command][1]** 和 **[Terminalizer Tool][2]**。 -But if you are looking for **[GIF Recorder][3]** then try **[Gifine][4]** , **[Kgif][5]** and **[Peek][6]** utilities. +不过,如果你在寻找 **[GIF 录制器][3]** ,你可以尝试 **[Gifine][4]** 、**[Kgif][5]** 和 **[Peek][6]** 。 -Script is one of the best utility to record your terminal session on headless server. +脚本是在无头服务器中记录终端活动的最佳方式之一。 -Script is a Unix command line utility that records a terminal session (in other terms, It’s record everything displayed on your terminal). +脚本是记录在终端中输入过的 Unix 命令的实用工具(在某些终端中,它会记录显示在你终端中的所有东西)。 -It stores the output in the current directory as a text file and the default file name is typescript. +它会在当前工作目录下以文本文件方式储存所有终端输出。 -### What is Termtosvg +### 什么是 Termtosvg -Termtosvg is a Unix terminal recorder written in Python that renders your command line sessions as standalone SVG animations. +Termtosvg 是一个用 Python 编写的 Unix 终端录制器,它可以将你的命令行会话保存为 SVG 动画。 -### Termtosvg Features +### Termtosvg 的特点 - * Produce lightweight and clean looking animations embeddable on a project page. - * Custom color themes, terminal UI and animation controls via SVG templates. - * Compatible with asciinema recording format. - * It requires Python >= 3.5 + * 可以制作用于某个项目主页且简洁美观的动画。 + * 可以在 SVG 模板中自定义配色、终端 UI 和动画。 + * 兼容 asciinema 录制格式。 + * 要求 Python 版本为 3.5 或更高。 + +### 如何在 Linux 中安装 Termtosvg +它是用 Python 编写的,所以我推荐使用 pip 来安装它。 +请确保你已经安装了 **python-pip** 包。如果你还没安装,请输入下面的命令。 +对于 Debian 或 Ubuntu 用户,请使用 **[apt][7]** 或 **[apt-get][8]** 来安装 pip。 -### How to Install Termtosvg In Linux - -It was written in Python and pip installation is a recommended method to install Termtosvg on Linux. - -Make sure you should have installed python-pip package on your system. If no, use the following command to install it. - -For Debian/Ubuntu users, use **[Apt Command][7]** or **[Apt-Get Command][8]** to install pip package. - -``` -$ sudo apt install python-pip +```shell +sudo apt install python-pip ``` -For Archlinux users, use **[Pacman Command][9]** to install pip package. +对于 Archlinux 用户,请使用 **[pacman][9]** 来安装 pip。 -``` -$ sudo pacman -S python-pip +```shell +sudo pacman -S python-pip ``` -For Fedora users, use **[DNF Command][10]** to install pip package. +对于 Fedora 用户,请使用 **[dnf][10]** 来安装 pip。 -``` -$ sudo dnf install python-pip +```shell +sudo dnf install python-pip ``` -For CentOS/RHEL users, use **[YUM Command][11]** to install pip package. +对于 CentOS 或 RHEL 用户,请使用 **[yum][11]** 来安装 pip。 -``` -$ sudo yum install python-pip +```shell +sudo yum install python-pip ``` -For openSUSE users, use **[Zypper Command][12]** to install pip package. +对于 openSUSE 用户,请使用 **[zypper][12]** 来安装 pip。 -``` -$ sudo zypper install python-pip +```shell +sudo zypper install python-pip ``` -Finally run the following **[pip command][13]** to install Termtosvg tool in Linux. +最后,请执行 **[pip][13]** 来安装 Termtosvg。 -``` -$ sudo pip3 install termtosvg pyte python-xlib svgwrite +```shell +sudo pip3 install termtosvg pyte python-xlib svgwrite ``` -### How to Record Your Terminal Session Using Termtosvg +### 如何使用 Termtosvg -Once you successfully installed Termtosvg. Just run the following command to start recording. +成功安装 Termtosvg 后,请使用以下命令来开始录制。 -``` +```shell $ termtosvg Recording started, enter "exit" command or Control-D to end ``` -For testing purpose run few commands and see whether it’s working fine or not. +如果只是想测试它是否正常工作,随意输入几行命令即可。 -``` +```shell $ uname -a Linux daygeek-Y700 4.19.8-2-MANJARO #1 SMP PREEMPT Sat Dec 8 14:45:36 UTC 2018 x86_64 GNU/Linux $ hostname @@ -124,21 +121,21 @@ $ pip3 --version pip 18.1 from /usr/lib/python3.7/site-packages/pip (python 3.7) ``` -Once you have done, simple press `CTRL+D` or type `exit` to stop the recording. The result will be saved in `/tmp` folder with a unique name. +完成后,你可以按下 `CTRL+D` 或输入 `exit` 来停止录制。录制完后,输出文件会以一个独一无二的名字被保存在 `/tmp` 文件夹中。 -``` +```shell $ exit exit Recording ended, SVG animation is /tmp/termtosvg_5waorper.svg ``` -We can open the SVG file output with help of any web browser. +我们可以在任意浏览器中打开 SVG 文件。 -``` -$ firefox /tmp/termtosvg_5waorper.svg +```shell +firefox /tmp/termtosvg_5waorper.svg ``` -![][15] +![最终效果][15] -------------------------------------------------------------------------------- @@ -146,7 +143,7 @@ via: https://www.2daygeek.com/termtosvg-record-your-terminal-sessions-as-svg-ani 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[zhs852](https://github.com/zhs852) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 6a64f3c74719536e3b0f33c9b4aab80c17667144 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Sat, 12 Jan 2019 23:14:50 +0800 Subject: [PATCH 289/322] Move translated file --- ... - Record Your Terminal Sessions As SVG Animations In Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md (100%) diff --git a/sources/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md b/translated/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md similarity index 100% rename from sources/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md rename to translated/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md From 5dcb60dff69d0cfc7be0008b3dce50168545398e Mon Sep 17 00:00:00 2001 From: wwhio Date: Sat, 12 Jan 2019 23:34:27 +0800 Subject: [PATCH 290/322] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= =?UTF-8?q?=EF=BC=8C=E7=94=B3=E8=AF=B7=E6=A0=A1=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/talk/20171119 The Ruby Story.md | 86 ---------------------- translated/talk/20171119 The Ruby Story.md | 85 +++++++++++++++++++++ 2 files changed, 85 insertions(+), 86 deletions(-) delete mode 100644 sources/talk/20171119 The Ruby Story.md create mode 100644 translated/talk/20171119 The Ruby Story.md diff --git a/sources/talk/20171119 The Ruby Story.md b/sources/talk/20171119 The Ruby Story.md deleted file mode 100644 index 4c6b46b7de..0000000000 --- a/sources/talk/20171119 The Ruby Story.md +++ /dev/null @@ -1,86 +0,0 @@ -Translating by wwhio - -The Ruby Story -====== -Ruby has always been one of my favorite languages, though I’ve sometimes found it hard to express why that is. The best I’ve been able to do is this musical analogy: Whereas Python feels to me like punk rock—it’s simple, predictable, but rigid—Ruby feels like jazz. Ruby gives programmers a radical freedom to express themselves, though that comes at the cost of added complexity and can lead to programmers writing programs that don’t make immediate sense to other people. - -I’ve always been aware that freedom of expression is a core value of the Ruby community. But what I didn’t appreciate is how deeply important it was to the development and popularization of Ruby in the first place. One might create a programming lanugage in pursuit of better peformance, or perhaps timesaving abstractions—the Ruby story is interesting because instead the goal was, from the very beginning, nothing more or less than the happiness of the programmer. - -### Yukihiro Matsumoto - -Yukihiro Matsumoto, also known as “Matz,” graduated from the University of Tsukuba in 1990. Tsukuba is a small town just northeast of Tokyo, known as a center for scientific research and technological devlopment. The University of Tsukuba is particularly well-regarded for its STEM programs. Matsumoto studied Information Science, with a focus on programming languages. For a time he worked in a programming language lab run by Ikuo Nakata. - -Matsumoto started working on Ruby in 1993, only a few years after graduating. He began working on Ruby because he was looking for a scripting language with features that no existing scripting language could provide. He was using Perl at the time, but felt that it was too much of a “toy language.” Python also fell short; in his own words: - -> I knew Python then. But I didn’t like it, because I didn’t think it was a true object-oriented language—OO features appeared to be an add-on to the language. As a language maniac and OO fan for 15 years, I really wanted a genuine object-oriented, easy-to-use scripting language. I looked for one, but couldn’t find one. - -So one way of understanding Matsumoto’s motivations in creating Ruby is that he was trying to create a better, object-oriented version of Perl. - -But at other times, Matsumoto has said that his primary motivation in creating Ruby was simply to make himself and others happier. Toward the end of a Google tech talk that Matsumoto gave in 2008, he showed the following slide: - -![][1] - -He told his audience, - -> I hope to see Ruby help every programmer in the world to be productive, and to enjoy programming, and to be happy. That is the primary purpose of the Ruby language. - -Matsumoto goes on to joke that he created Ruby for selfish reasons, because he was so underwhelmed by other languages that he just wanted to create something that would make him happy. - -The slide epitomizes Matsumoto’s humble style. Matsumoto, it turns out, is a practicing Mormon, and I’ve wondered whether his religious commitments have any bearing on his legendary kindness. In any case, this kindness is so well known that the Ruby community has a principle known as MINASWAN, or “Matz Is Nice And So We Are Nice.” The slide must have struck the audience at Google as an unusual one—I imagine that any random slide drawn from a Google tech talk is dense with code samples and metrics showing how one engineering solution is faster or more efficient than another. Few, I suspect, come close to stating nobler goals more simply. - -Ruby was influenced primarily by Perl. Perl was created by Larry Wall in the late 1980s as a means of processing and transforming text-based reports. It became well-known for its text processing and regular expression capabilities. A Perl program contains many syntactic elements that would be familiar to a Ruby programmer—there are `$` signs, `@` signs, and even `elsif`s, which I’d always thought were one of Ruby’s less felicitous idiosyncracies. On a deeper level, Ruby borrows much of Perl’s regular expression handling and standard library. - -But Perl was by no means the only influence on Ruby. Prior to beginning work on Ruby, Matsumoto worked on a mail client written entirely in Emacs Lisp. The experience taught him a lot about the inner workings of Emacs and the Lisp language, which Matsumoto has said influenced the underlying object model of Ruby. On top of that he added a Smalltalk-style messsage passing system which forms the basis for any behavior relying on Ruby’s `#method_missing`. Matsumoto has also claimed Ada and Eiffel as influences on Ruby. - -When it came time to decide on a name for Ruby, Matsumoto and a colleague, Keiju Ishitsuka, considered several alternatives. They were looking for something that suggested Ruby’s relationship to Perl and also to shell scripting. In an [instant message exchange][2] that is well-worth reading, Ishitsuka and Matsumoto probably spend too much time thinking about the relationship between shells, clams, oysters, and pearls and get close to calling the Ruby language “Coral” or “Bisque” instead. Thankfully, they decided to go with “Ruby”, the idea being that it was, like “pearl”, the name of a valuable jewel. It also turns out that the birthstone for June is a pearl while the birthstone for July is a ruby, meaning that the name “Ruby” is another tongue-in-cheek “incremental improvement” name like C++ or C#. - -### Ruby Goes West - -Ruby grew popular in Japan very quickly. Soon after its initial release in 1995, Matz was hired by a Japanese software consulting group called Netlab (also known as Network Applied Communication Laboratory) to work on Ruby full-time. By 2000, only five years after it was initially released, Ruby was more popular in Japan than Python. But it was only just beginning to make its way to English-speaking countries. There had been a Japanese-language mailing list for Ruby discussion since almost the very beginning of Ruby’s existence, but the English-language mailing list wasn’t started until 1998. Initially, the English-language mailing list was used by Japanese Rubyists writing in English, but this gradually changed as awareness of Ruby grew. - -In 2000, Dave Thomas published Programming Ruby, the first English-language book to cover Ruby. The book became known as the “pickaxe” book for the pickaxe it featured on its cover. It introduced Ruby to many programmers in the West for the first time. Like it had in Japan, Ruby spread quickly, and by 2002 the English-language Ruby mailing list had more traffic than the original Japanese-language mailing list. - -By 2005, Ruby had become more popular, but it was still not a mainstream programming language. That changed with the release of Ruby on Rails. Ruby on Rails was the “killer app” for Ruby, and it did more than any other project to popularize Ruby. After the release of Ruby on Rails, interest in Ruby shot up across the board, as measured by the TIOBE language index: - -![][3] - -It’s sometimes joked that the only programs anybody writes in Ruby are Ruby-on-Rails web applications. That makes it sound as if Ruby on Rails completely took over the Ruby community, which is only partly true. While Ruby has certainly come to be known as that language people write Rails apps in, Rails owes as much to Ruby as Ruby owes to Rails. - -The Ruby philosophy heavily informed the design and implementation of Rails. David Heinemeier Hansson, who created Rails, often talks about how his first contact with Ruby was an almost religious experience. He has said that the encounter was so transformative that it “imbued him with a calling to do missionary work in service of Matz’s creation.” For Hansson, Ruby’s no-shackles approach was a politically courageous rebellion against the top-down impositions made by languages like Python and Java. He appreciated that the language trusted him and empowered him to make his own judgements about how best to express his programs. - -Like Matsumoto, Hansson claims that he created Rails out of a frustration with the status quo and a desire to make things better for himself. He, like Matsumoto, prioritized programmer happiness above all else, evaluating additions to Rails by what he calls “The Principle of The Bigger Smile.” Whatever made Hansson smile more was what made it into the Rails codebase. As a result, Rails would come to include unorthodox features like the “Inflector” class (which tries to map singular class names to plural database table names automatically) and Rails’ `Time` extensions (allowing programmers to write cute expressions like `2.days.ago`). To some, these features were truly weird, but the success of Rails is testament to the number of people who found it made their lives much easier. - -And so, while it might seem that Rails was an incidental application of Ruby that happened to become extremely popular, Rails in fact embodies many of Ruby’s core principles. Futhermore, it’s hard to see how Rails could have been built in any other language, given its dependence on Ruby’s macro-like class method calls to implement things like model associations. Some people might take the fact that so much of Ruby development revolves around Ruby on Rails as a sign of an unhealthy ecosystem, but there are good reasons that Ruby and Ruby on Rails are so intertwined. - -### The Future of Ruby - -People seem to have an inordinate amount of interest in whether or not Ruby (and Ruby on Rails) are dying. Since as early as 2011, it seems that Stack Overflow and Quora have been full of programmers asking whether or not they should bother learning Ruby if it will no longer be around in the next few years. These concerns are not unjustified; according to the TIOBE index and to Stack Overflow trends, Ruby and Ruby on Rails have been shrinking in popularity. Though Ruby on Rails was once the hot new thing, it has since been eclipsed by hotter and newer frameworks. - -One theory for why this has happened is that programmers are abandoning dynamically typed languages for statically typed ones. Analysts at TIOBE index figure that a rise in quality requirements have made runtime exceptions increasingly unacceptable. They cite TypeScript as an example of this trend—a whole new version of JavaScript was created just to ensure that client-side code could be written with the benefit of compile-time safety guarantees. - -A more likely answer, I think, is just that Ruby on Rails now has many more competitors than it once did. When Rails was first introduced in 2005, there weren’t that many ways to create web applications—the main alternative was Java. Today, you can create web applications using great frameworks built for Go, JavaScript, or Python, to name only the most popular options. The web world also seems to be moving toward a more distributed architecture for applications, meaning that, rather than having one codebase responsible for everything from database access to view rendering, responsibilites are split between different components that focus on doing one thing well. Rails feels overbroad and bloated for something as focused as a JSON API that talks to a JavaScript frontend. - -All that said, there are reasons to be optimistic about Ruby’s future. Both Rails and Ruby continue to be actively developed. Matsumoto and others are working hard on Ruby’s third major release, which they aim to make three times faster than the existing version of Ruby, possibly alleviating the performance concerns that have always dogged Ruby. And even if the world of web frameworks has become more diverse since 2005, that doesn’t mean that there won’t always be room for Ruby on Rails. It is now a mature tool with an enormous amount of built-in power that will always be a good choice for certain kinds of applications. - -But even if Ruby and Rails go the way of the dinosaurs, one thing that seems certain to survive is the Ruby ethos of programmer happiness. Ruby has had a profound influence on the design of many new programming languages, which have adopted many of its best ideas. Other new lanuages have tried to be “more modern” interpretations of Ruby: Elixir, for example, is a version of Ruby that emphasizes the functional programming paradigm, while Crystal, which is still in development, aims to be a statically typed version of Ruby. Many programmers around the world have fallen in love with Ruby and its syntax, so we can count on its influence persisting for a long while to come. - -If you enjoyed this post, more like it come out every two weeks! Follow [@TwoBitHistory][4] on Twitter or subscribe to the [RSS feed][5] to make sure you know when a new post is out. - --------------------------------------------------------------------------------- - -via: https://twobithistory.org/2017/11/19/the-ruby-story.html - -作者:[Two-Bit History][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://twobithistory.org -[b]: https://github.com/lujun9972 -[1]: https://twobithistory.org/images/matz.png -[2]: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/88819 -[3]: https://twobithistory.org/images/tiobe_ruby.png -[4]: https://twitter.com/TwoBitHistory -[5]: https://twobithistory.org/feed.xml diff --git a/translated/talk/20171119 The Ruby Story.md b/translated/talk/20171119 The Ruby Story.md new file mode 100644 index 0000000000..70827ca306 --- /dev/null +++ b/translated/talk/20171119 The Ruby Story.md @@ -0,0 +1,85 @@ +The Ruby Story +====== +尽管我很难说清楚为什么,但 Ruby 一直是我最喜爱的一门编程语言。如果用音乐来类比的话,Python 给我的感觉像是朋克摇滚punk rock,简单、直接,但略显单调,而 Ruby 则像是爵士乐,赋予了程序员灵活的表达freedom to express,虽然这可能会让代码变复杂、程序不直观。 + +Ruby 社区一直将灵活表达freedom of expression视为其核心价值。可我不认同这对于 Ruby 的开发和普及是最重要的。一个人创建一门编程语言也许是为了更高的性能,也许是为了在抽象上节省更多的时间,可 Ruby 就有趣在它并不关心这些,从它诞生之初,它的目标就是让程序员更快乐。 + +### 松本 行弘 + +松本行弘Yukihiro Matsumoto,也叫 “Matz”,于 1990 年毕业于筑波大学。筑波是东京东北方向上的一个小城市,是科学研究与技术开发的中心之一。那里的筑波大学以其 STEM 计划广为流传。松本行弘就在筑波大学的信息科学专业学习过,且专攻编程语言。他也在 Ikuo Nakata 的编程语言实验室工作过。 + +松本从 1993 年开始制作 Ruby,那时他才刚毕业几年。他制作 Ruby 的起因是觉得那时的脚本语言缺乏一些特性。他在使用 Perl 的时候觉得这门语言过于“玩具”,此外 Python 也有点弱,用他自己的话说: + +> 我那时就知道 Python 了,但我不喜欢它,因为我认为这不是一门真正的面向对象的语言。面向对象就像是 Python 的一个附件。作为一个编程语言狂热者,我在 15 年里一直是面向对象的忠实粉丝。我真的想要一门生来就面向对象而且易用的脚本语言。我为此特地寻找过,可事实并不如愿。 + +所以一种解释松本创造 Ruby 的动机就是他想要创造一门更好的,而且面向对象的 Perl 版本。 + +但在其他场合,松本说他创造 Ruby 主要是为了让他自己和别人更快乐。2008 年,松本在谷歌技术讲座结束时放映了这张幻灯片: + +![][1] + +他对听众说到, + +> 我希望 Ruby 能帮助世界上的每一个程序员更有效率地工作,享受编程并感到快乐。这也是制作 Ruby 语言的主要意图。 + +松本开玩笑的说他制作 Ruby 的原因很自私,因为他觉得其他的语言乏味,所以需要创造一点让自己开心的东西。 + +这张幻灯片展现了松本谦虚的一面。其实,松本是一位摩门教徒,因此我很好奇他传奇般的友善有多少归功于他的宗教信仰。无论如何,他的友善在 Ruby 社区广为流传,甚至有一条称为 MINASWAN 的原则,即“松本人很好,我们也一样Matz Is Nice And So We Are Nice”。我想那张幻灯片一定震惊了来自 Google 的观众。我想谷歌技术讲座上的每张幻灯片都充满着代码和运行效率的指标,来说明一个方案比另一个更快更有效,可仅仅放映崇高的目标的幻灯片却寥寥无几。 + +Ruby 主要受到 Perl 的印象。Perl 则是由 Larry Wall 与 20 世纪 80 年代晚期创造的语言,主要用于处理和转换基于文本的数据。Perl 因其文本处理和正则表达式而闻名于世。对于 Ruby 程序员,Perl 程序中的很多语法元素都不陌生,例如符号`$`、符号`@`、`elsif`等等。虽然我觉得,这些不是 Ruby 应该具有的特征。除了这些符号外,Ruby 还借鉴了 Perl 中的正则表达式和标准库。 + +但影响了 Ruby 的不仅仅只有 Perl 。在 Ruby 之前松本使用过运行在 Emacs Lisp 上的邮件客户端。这一经历让他对 Emacs 和 Lisp 语言运行的内部原理有了更多的认识。松本说 Ruby 的对象模型也受其启发。在那之上,松本添加了一个 Smalltalk 风格的信息传递系统,这一系统随后成为了 Ruby 中任何依赖 `#method_missing` 的操作的基石。松本说 Ada 和 Eiffel 也影响了 Ruby 的设计。 + +当时间来到了给这门新语言命名的时候,松本和它的同事 Keiju Ishitsuka 挑选了很多个名字。他们希望名字能够体现新语言和 Perl、shell 脚本间的联系。在[这一段聊天记录][2]中,Ishitsuka 和 松本也许花了太多的时间来思考 shell贝壳clam蛤蛎oyster牡蛎pearl珍珠之间的关系了,以至于差点把 Ruby 命名为“Coral珊瑚虫”或“Bisque贝类浓汤”。幸好,他们决定使用 Ruby ,因为他就像 pearl 一样,是一种珍贵的宝石。此外,Ruby红宝石 还是 7 月的诞生石,而 Peral珍珠 则是 6 月的诞生石,采用了类似 C++ 和 C# 的隐喻,暗示着她们是改进自前辈的编程语言。(LCTT译注:Perl 和 Pearl 发音相同;shell 是操作系统提供的用户界面,这里指的是命令行界面;更多有关诞生石的[信息](https://zh.wikipedia.org/zh-hans/%E8%AA%95%E7%94%9F%E7%9F%B3)。) + +### Ruby 走向西方 + +Ruby 在日本的普及很快。1995 年 Ruby 刚刚发布后不久后,松本就被一家名为 Netlab 的日本软件咨询基团(全名 Network Applied Communication Laboratory)雇用,并全职为 Ruby 工作。到 2000 年时,仅仅在 Ruby 发布 5 年后,Ruby 在日本的流行度就超过了 Python。可这是的 Ruby 从刚刚进入英语国家。虽然从 Ruby 的诞生之初就存在日语邮件的列表,但是英语邮件的列表直到 1998 年才建立起来。而且起初在英语邮件的列表里交流的大多是日本的 Ruby 狂热者,但这一问题随着 Ruby 在西方国家的普及而逐渐得以改善。 + +在 2000 年,Dave Thomas 出版了第一本涵盖 Ruby 的英文书籍《Programming Ruby》。因为它的封面上画着一把锄头,所以这本书也被称为锄头书。是它第一次向身处西方的程序员们介绍了 Ruby。就像在日本那样,Ruby 的普及很快,到 2002 年时,英语邮件列表的流量超过了日语邮件列表。 + +时间来到了 2005 年,Ruby 更流行了,但它任然不是主流的编程语言。然而,Ruby on Rails 的发布让一切都不一样了。Ruby on Rails 是 Ruby 的“杀手应用”,没有别的什么项目比它更能推动 Ruby 的普及了。在 Ruby on Rails 发布后,人们对 Ruby 的兴趣爆发式的增长,看看 TIOBE 监测的语言排行: + +![][3] + +有时人们开玩笑的说,Ruby 程序全是基于 Ruby-on-Rails 的网站。虽然这听起来就像是 Ruby on Rails 占领了整个 Ruby 社区,但在一定程度上,这是事实。因为 Rails 开发需要 Ruby,Ruby 在西方是随着 Rails 的发布才普及开的。Rails 欠 Ruby 的和 Ruby 欠 Rails 的一样多。 + +Ruby 的设计哲学也深深地影响了 Rails 的设计与开发。Rails 之父 David Heinemeier Hansson 常常提起他第一次与 Ruby 的接触的情形,那简直就是一次传教。他说,那经历简直太有感召力了,让他感到要为松本的杰作(指 Ruby)“传教”的使命。对于 Hansson 来说,Ruby 的灵活性简直就是对 Python 或 Java 语言中自上而下的设计哲学的反抗。他很欣赏 Ruby 这门能够信任自己的语言,Ruby 赋予了他自由选择程序表达方式express his programs的权力。 + +就像松本那样,Hansson 声称他创造 Rails 时因为对现状的不满并想让自己能更开心。他也认同让程序员更快乐高于一切的观点,所以检验 Rails 是否需要添加一项新特性的标准是“更灿烂的笑容标准The Principle of The Bigger Smile”。什么功能能让 Hansson 更开心就给 Rails 添加什么。因此,Rails 中包括了很多非传统的功能,例如“Inflector”类和 `Time` 扩展("Inflector"类试图将单个类的名字映射到多个数据库表的名字;`Time` 扩展允许程序员使用 `2.days.ago` 这样的表达式)。可能会有人觉得这些功能太奇怪了,但 Rails 的成功表明它的确能让很多人的生活得更快乐。 + +And so, while it might seem that Rails was an incidental application of Ruby that happened to become extremely popular, Rails in fact embodies many of Ruby’s core principles. Futhermore, it’s hard to see how Rails could have been built in any other language, given its dependence on Ruby’s macro-like class method calls to implement things like model associations. Some people might take the fact that so much of Ruby development revolves around Ruby on Rails as a sign of an unhealthy ecosystem, but there are good reasons that Ruby and Ruby on Rails are so intertwined. +因此,Rails 不但是 Ruby 的一个普及度很高的应用,而且体现了 Ruby 的很多核心准则。此外,很难看到使用其他语言开发的 Rails 的替代品,因为 Rails 的实现依赖于 Ruby 中类似于宏的类方法macro-like class method来实现模型关联的功能这样的功能。一些人认为这么多的 Ruby 开发需要基于 Ruby on Rails 是 Ruby 生态不健康的表现,但 Ruby 和 Ruby on Rails 结合的如此紧密并不是没有道理的。 + +### Ruby 的未来 + +人们似乎对 Ruby 是否正在灭亡有着异常的兴趣。早在 2011 年,Stack Overflow 和 Quora 上就有程序员在咨询“如果几年后不在使用 Ruby 那么现在是否有必要学它”。这些担忧对 Ruby 并不合理,虽然在 TIOBE 指数和 Stack Overflow 趋势上,Ruby 和 Ruby on Rails 的人气在萎缩,可它也曾是新兴的、热门的技术,但在更新更热的框架面前,排名自然会有所下降。 + +一种解释这种趋势的理论是程序员们正在舍弃动态类型的语言转而选择静态类的。TIOBE 指数的趋势中可以看出对软件质量的需求在上升,这使出现在运行时的异常变得难以接受。他们引用 TypeScript 来说明这一趋势,TypeScript 是 JavaScript 的全新版本,而它创造的目的正是为了保证客户端运行的代码能收益于编译所提供的安全保障。 + +我认为另一个原因可能是比起 Ruby on Rails 推出的时候,现在存在着更多有竞争力的框架。2005 年它刚刚发布的时候,还没有那么多用于创建 Web 程序的框架,其主要的替代者还是 Java。可在今天,你可以用 Go、Javascript 或者 Python 上的各种优秀的框架,而这还仅仅是主流的选择。 Web 的世界似乎正走向更加分布式的结构,与其使用一个代码仓库来完成从数据库读取到页面渲染所有事务,不如将事务拆分到多个组建,其中每个组件专注于一项事务并将其做到最好。在这种趋势下,Rails 相较于那些专攻与 JavaScript 前端通信的 JSON API 就显得过于宽泛和臃肿。 + +总而言之,我们有理由对 Ruby 的未来持乐观态度。因为不管是 Ruby 还是 Rails 的开发都还很活跃。松本和其他的贡献者们都在努力开发 Ruby 的第三个主要版本。新的版本将比现在的版本快上 3 倍,以减轻制约着 Ruby 发展的性能问题。虽然从 2005 年起,越来越多的 Web 框架被开发出来,但这并不意味着 Ruby on Rails 就失去了其生存空间。Rails 是一个富有大量功能的成熟的工具,对于一些特定类型的应用开发一直是非常好的选择。 + +但就算 Ruby 和 Rails 走上了灭亡的道路,Ruby 让程序员更快乐的信条一定会存活下来。Ruby 已经深远的影响了许多新的编程语言的设计,这些语言的设计中能够看到来自 Ruby 的很多理念。而其他的新生语言则试着变成 Ruby 更现代的实现,例如 Elixir 是一个强调函数式编程的语言,仍在开发中的 Crystal 目标是成为使用静态类型的 Ruby 。世界上许多程序员都喜欢上了 Ruby,因此它的影响必将会在未来持续很长一段时间。 + +喜欢吗?这里每两周都会发表一篇这样的文章。请在推特上关注我们 [@TwoBitHistory][4] 或者订阅我们的 [RSS][5],这样新文章发布的第一时间你就能得到通知。 + +-------------------------------------------------------------------------------- + +via: https://twobithistory.org/2017/11/19/the-ruby-story.html + +作者:[Two-Bit History][a] +选题:[lujun9972][b] +译者:[wwhio](https://github.com/wwhio) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://twobithistory.org +[b]: https://github.com/lujun9972 +[1]: https://twobithistory.org/images/matz.png +[2]: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/88819 +[3]: https://twobithistory.org/images/tiobe_ruby.png +[4]: https://twitter.com/TwoBitHistory +[5]: https://twobithistory.org/feed.xml From 6f4b43cbff7bafcd32a6e9db3d56b2b91fa71612 Mon Sep 17 00:00:00 2001 From: wwhio Date: Sat, 12 Jan 2019 23:36:26 +0800 Subject: [PATCH 291/322] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= =?UTF-8?q?=EF=BC=8C=E7=94=B3=E8=AF=B7=E6=A0=A1=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- translated/talk/20171119 The Ruby Story.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/translated/talk/20171119 The Ruby Story.md b/translated/talk/20171119 The Ruby Story.md index 70827ca306..4b73462b5a 100644 --- a/translated/talk/20171119 The Ruby Story.md +++ b/translated/talk/20171119 The Ruby Story.md @@ -7,6 +7,7 @@ Ruby 社区一直将灵活表达freedom of expression视 ### 松本 行弘 松本行弘Yukihiro Matsumoto,也叫 “Matz”,于 1990 年毕业于筑波大学。筑波是东京东北方向上的一个小城市,是科学研究与技术开发的中心之一。那里的筑波大学以其 STEM 计划广为流传。松本行弘就在筑波大学的信息科学专业学习过,且专攻编程语言。他也在 Ikuo Nakata 的编程语言实验室工作过。 +(LCTT译注:STEM是科学(Science),技术(Technology),工程(Engineering),数学(Mathematics)四门学科英文首字母的缩写。) 松本从 1993 年开始制作 Ruby,那时他才刚毕业几年。他制作 Ruby 的起因是觉得那时的脚本语言缺乏一些特性。他在使用 Perl 的时候觉得这门语言过于“玩具”,此外 Python 也有点弱,用他自己的话说: @@ -30,7 +31,8 @@ Ruby 主要受到 Perl 的印象。Perl 则是由 Larry Wall 与 20 世纪 80 但影响了 Ruby 的不仅仅只有 Perl 。在 Ruby 之前松本使用过运行在 Emacs Lisp 上的邮件客户端。这一经历让他对 Emacs 和 Lisp 语言运行的内部原理有了更多的认识。松本说 Ruby 的对象模型也受其启发。在那之上,松本添加了一个 Smalltalk 风格的信息传递系统,这一系统随后成为了 Ruby 中任何依赖 `#method_missing` 的操作的基石。松本说 Ada 和 Eiffel 也影响了 Ruby 的设计。 -当时间来到了给这门新语言命名的时候,松本和它的同事 Keiju Ishitsuka 挑选了很多个名字。他们希望名字能够体现新语言和 Perl、shell 脚本间的联系。在[这一段聊天记录][2]中,Ishitsuka 和 松本也许花了太多的时间来思考 shell贝壳clam蛤蛎oyster牡蛎pearl珍珠之间的关系了,以至于差点把 Ruby 命名为“Coral珊瑚虫”或“Bisque贝类浓汤”。幸好,他们决定使用 Ruby ,因为他就像 pearl 一样,是一种珍贵的宝石。此外,Ruby红宝石 还是 7 月的诞生石,而 Peral珍珠 则是 6 月的诞生石,采用了类似 C++ 和 C# 的隐喻,暗示着她们是改进自前辈的编程语言。(LCTT译注:Perl 和 Pearl 发音相同;shell 是操作系统提供的用户界面,这里指的是命令行界面;更多有关诞生石的[信息](https://zh.wikipedia.org/zh-hans/%E8%AA%95%E7%94%9F%E7%9F%B3)。) +当时间来到了给这门新语言命名的时候,松本和它的同事 Keiju Ishitsuka 挑选了很多个名字。他们希望名字能够体现新语言和 Perl、shell 脚本间的联系。在[这一段聊天记录][2]中,Ishitsuka 和 松本也许花了太多的时间来思考 shell贝壳clam蛤蛎oyster牡蛎pearl珍珠之间的关系了,以至于差点把 Ruby 命名为“Coral珊瑚虫”或“Bisque贝类浓汤”。幸好,他们决定使用 Ruby ,因为他就像 pearl 一样,是一种珍贵的宝石。此外,Ruby红宝石 还是 7 月的诞生石,而 Peral珍珠 则是 6 月的诞生石,采用了类似 C++ 和 C# 的隐喻,暗示着她们是改进自前辈的编程语言。 +(LCTT译注:Perl 和 Pearl 发音相同;shell 是操作系统提供的用户界面,这里指的是命令行界面;更多有关诞生石的[信息](https://zh.wikipedia.org/zh-hans/%E8%AA%95%E7%94%9F%E7%9F%B3)。) ### Ruby 走向西方 From 7aed9e6508408718bff77f54be434c39347d41b8 Mon Sep 17 00:00:00 2001 From: wwhio Date: Sat, 12 Jan 2019 23:37:58 +0800 Subject: [PATCH 292/322] Update 20171119 The Ruby Story.md --- translated/talk/20171119 The Ruby Story.md | 1 - 1 file changed, 1 deletion(-) diff --git a/translated/talk/20171119 The Ruby Story.md b/translated/talk/20171119 The Ruby Story.md index 4b73462b5a..bf370f00e6 100644 --- a/translated/talk/20171119 The Ruby Story.md +++ b/translated/talk/20171119 The Ruby Story.md @@ -50,7 +50,6 @@ Ruby 的设计哲学也深深地影响了 Rails 的设计与开发。Rails 之 就像松本那样,Hansson 声称他创造 Rails 时因为对现状的不满并想让自己能更开心。他也认同让程序员更快乐高于一切的观点,所以检验 Rails 是否需要添加一项新特性的标准是“更灿烂的笑容标准The Principle of The Bigger Smile”。什么功能能让 Hansson 更开心就给 Rails 添加什么。因此,Rails 中包括了很多非传统的功能,例如“Inflector”类和 `Time` 扩展("Inflector"类试图将单个类的名字映射到多个数据库表的名字;`Time` 扩展允许程序员使用 `2.days.ago` 这样的表达式)。可能会有人觉得这些功能太奇怪了,但 Rails 的成功表明它的确能让很多人的生活得更快乐。 -And so, while it might seem that Rails was an incidental application of Ruby that happened to become extremely popular, Rails in fact embodies many of Ruby’s core principles. Futhermore, it’s hard to see how Rails could have been built in any other language, given its dependence on Ruby’s macro-like class method calls to implement things like model associations. Some people might take the fact that so much of Ruby development revolves around Ruby on Rails as a sign of an unhealthy ecosystem, but there are good reasons that Ruby and Ruby on Rails are so intertwined. 因此,Rails 不但是 Ruby 的一个普及度很高的应用,而且体现了 Ruby 的很多核心准则。此外,很难看到使用其他语言开发的 Rails 的替代品,因为 Rails 的实现依赖于 Ruby 中类似于宏的类方法macro-like class method来实现模型关联的功能这样的功能。一些人认为这么多的 Ruby 开发需要基于 Ruby on Rails 是 Ruby 生态不健康的表现,但 Ruby 和 Ruby on Rails 结合的如此紧密并不是没有道理的。 ### Ruby 的未来 From 3cbf4492e595b13d517a57b7f2a421f3a4877cb9 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 12 Jan 2019 23:54:51 +0800 Subject: [PATCH 293/322] PRF:20181221 An Easy Way To Remove Programs Installed From Source In Linux.md @dianbanjiu --- ...Programs Installed From Source In Linux.md | 59 +++++++++---------- 1 file changed, 27 insertions(+), 32 deletions(-) diff --git a/translated/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md b/translated/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md index f33ff7af14..19a132c544 100644 --- a/translated/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md +++ b/translated/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md @@ -1,62 +1,61 @@ [#]: collector: (lujun9972) -[#]: translator: ( dianbanjiu ) -[#]: reviewer: ( ) +[#]: translator: (dianbanjiu) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (An Easy Way To Remove Programs Installed From Source In Linux) [#]: via: (https://www.ostechnix.com/an-easy-way-to-remove-programs-installed-from-source-in-linux/) [#]: author: (SK https://www.ostechnix.com/author/sk/) -在 Linux 中移除从源中安装的程序的一种简单的方法 +在 Linux 中移除从源代码安装的程序的一种简单的方法 ====== ![](https://www.ostechnix.com/wp-content/uploads/2018/12/stow-1-720x340.jpg) -不是所有的程序都可以在官方或者第三方库中可用,因此你不能使用常规的包管理来安装它们。有时你不得不从源代码中手动构建这些程序。就跟你已经知道的一样,当你从源代码中安装一个程序的时候,这个包文件将会复制到本地的多个位置,例如 **/usr/local/bin**,**/usr/local/etc/**。如果从源代码中安装的程序没有内建的卸载器,当你不再需要这个程序的时候,卸载它就会很麻烦。你可能会话费双倍(甚至更多)的时间找出这些包文件然后手动删除它们。我以前一直是这样做的,直到我发现了 **GNU Stow**。谢天谢地,Stow 有一个很棒的方法可以轻松管理从源代码安装的程序。 - +不是所有的程序都可以在官方或者第三方库中找到,因此你不能使用常规的包管理来安装它们。有时你不得不从源代码中手动构建这些程序。就如你已经知道的一样,当你从源代码中安装一个程序的时候,这个软件包所包含的文件将会复制到本地的多个位置,例如 `/usr/local/bin`、`/usr/local/etc/`。如果从源代码中安装的程序没有内置的卸载程序,当你不再需要这个程序的时候,卸载它就会很麻烦。你可能会花费双倍(甚至更多)的时间找出这些文件然后手动删除它们。我以前一直是这样做的,直到我发现了 GNU Stow。谢天谢地,Stow 有一个很棒的方法可以轻松管理从源代码安装的程序。 引用官方网站里的一段介绍, -> **GNU Stow 是一个符号链接管理器,它可以收集文件系统上不同目录中的不同软件和/或数据包,使它们看起来像是一个整体** +> GNU Stow 是一个符号链接归集管理器,它可以收集文件系统上不同目录中的不同软件和/或数据包,使它们看起来像是一个整体。 -简单来说,Stow 帮助你把这些程序文件以一种容易管理的方式组织在了一起。在这个方法中,文件将不会被复制到多个位置。所有的这些文件都会被保存在一个特定的文件夹中,通常是以程序名命名的,然后 Stow 会在一个合适的位置为所有的程序文件创建符号连接。比如 **/usr/local/bin** 中会包含 **/usr/local/stow/vim/bin**,**/usr/local/stow/python/bin** 中文件的符号链接。并且同样递归地用于其他的任何的子目录,例如 **.../share**,**.../man**,等等。在这篇教程中,我将会举例教你如何轻松地使用 Stow 管理从源中安装的程序。 +简单来说,Stow 帮助你把这些程序文件以一种容易管理的方式组织在了一起。在这个方法中,文件将不会被复制到多个位置。所有的这些文件都会被保存在一个特定的文件夹中,通常是以程序名命名的,然后 Stow 会在一个合适的位置为所有的程序文件创建符号连接。比如 `/usr/local/bin` 中会包含 `/usr/local/stow/vim/bin`、`/usr/local/stow/python/bin` 中文件的符号链接。并且同样递归地用于其他的任何的子目录,例如 `.../share`、`.../man`,等等。在这篇教程中,我将会举例教你如何轻松地使用 Stow 管理从源中安装的程序。 ### 安装 GNU Stow GNU Stow 在流行 Linux 操作系统的默认库中都可用。 -在 **Arch Linux** 及它的衍生版本中,运行下面的命令安装 Stow。 +在 Arch Linux 及它的衍生版本中,运行下面的命令安装 Stow。 ``` $ sudo pacman -S stow ``` -在 **Debian**,**Ubuntu**,**Linux Mint** 上: +在 Debian、Ubuntu、Linux Mint 上: ``` $ sudo apt install stow ``` -在 **Fedora** 上: +在 Fedora 上: ``` $ sudo dnf install stow ``` -在 **RHEL/CentOS** 上: + +在 RHEL/CentOS 上: ``` $ sudo yum install epel-release - $ sudo yum install stow ``` ### 在 Linux 上轻松移除从源代码安装的程序 -就像我之前提到的,所有包的程序文件都将被保存在位于 **/usr/local/stow/** 的一个根文件夹。在这个根文件夹或者父目录之下,每个包都将保存在对应的子目录中。例如,如果我们从源代码中安装了 Vim 编辑器,所有关联到 Vim 的程序文件和目录都将保存在 **/usr/local/stow/vim** 文件夹之下。如果你从源代码中安装了 Python,所有关联到 python 的文件都会保存在 **/usr/local/stow/python** 之下。 +就像我之前提到的,所有包的程序文件都将被保存在位于 `/usr/local/stow/` 的一个根文件夹。在这个根文件夹或者父目录之下,每个包都将保存在对应的子目录中。例如,如果我们从源代码中安装了 Vim 编辑器,所有关联到 Vim 的程序文件和目录都将保存在 `/usr/local/stow/vim` 文件夹之下。如果你从源代码中安装了 Python,所有关联到 python 的文件都会保存在 `/usr/local/stow/python` 之下。 -我现在从源代码中来安装一个叫做 **hello** 的程序。 +我现在从源代码中来安装一个叫做 hello 的程序。 -首先下载 ‘hello’ 程序的压缩包。 +首先下载 hello 程序的压缩包。 ``` $ wget http://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz @@ -68,7 +67,7 @@ $ wget http://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz $ tar -zxvf hello-2.10.tar.gz ``` -上面的命令将会在当前工作目录下创建一个叫做 ‘hello-2.10’ 的目录,并且提取压缩包中的所有内容到其中去。 +上面的命令将会在当前工作目录下创建一个叫做 `hello-2.10` 的目录,并且提取压缩包中的所有内容到其中去。 切换到这个目录当中: @@ -76,42 +75,40 @@ $ tar -zxvf hello-2.10.tar.gz $ cd hello-2.10/ ``` -运行下面的命令,并且添加 -prefix 选项。 +运行下面的命令,并且添加 `-prefix` 选项。 ``` $ ./configure --prefix=/usr/local/stow/hello ``` -上面的命令将会保存构建文件到一个指定位置,在这个例子中是 **/usr/local/stow/hello**。 +上面的命令将会保存构建文件到一个指定位置,在这个例子中是 `/usr/local/stow/hello`。 最后,使用下面的命令构建并安装 hello 这个程序: ``` $ make - $ sudo make install ``` -就这样。hello 这个程序就已经安装在 **/usr/local/stow/hello/** 这个位置了。你可以使用下面的 ‘ls’ 命令确认一下。 +就这样。hello 这个程序就已经安装在 `/usr/local/stow/hello/` 这个位置了。你可以使用下面的 `ls` 命令确认一下。 ``` $ ls /usr/local/stow/hello/ bin share ``` -最后,进入 **/usr/local/stow/** 目录,运行下面的命令来生成必要的符号链接。 +最后,进入 `/usr/local/stow/` 目录,运行下面的命令来生成必要的符号链接。 ``` $ cd /usr/local/stow/ - $ sudo stow hello ``` 大功告成! -刚才那一步是将包含在 hello 这个程序中的所有文件或者目录创建了链接到 **/usr/local/** 目录中。换一种说法, **/usr/local/stow/hello/bin** 已经链接到 **/usr/local/share**,以及 **/usr/local/stow/hello/share/man** 已经链接到 **/usr/local/share**,还有 **/usr/local/stow/hello/share/man** 已经链接到 **/usr/local/share/man**。 +刚才那一步是将包含在 hello 这个程序中的所有文件或者目录创建了链接到 `/usr/local/` 目录中。换一种说法, `/usr/local/stow/hello/bin` 链接到 `/usr/local/share`,以及 `/usr/local/stow/hello/share/man` 链接到 `/usr/local/share`,还有 `/usr/local/stow/hello/share/man` 链接到 `/usr/local/share/man`。 -你可以使用 ‘ls’ 命令来确认一下: +你可以使用 `ls` 命令来确认一下: ``` $ ls /usr/local/bin/ @@ -137,15 +134,15 @@ $ tree /usr/local/stow/ ![][2] -看,hello 这个程序已经安装在 /usr/local/stow/hello/ 下。同样地,所有的包都将保存在它们对应的目录之下。 +看,hello 这个程序已经安装在 `/usr/local/stow/hello/` 下。同样地,所有的包都将保存在它们对应的目录之下。 -下面进入主要环节,移除 hello 这个程序。首先进入 **/usr/local/stow/** 目录: +下面进入主要环节,移除 hello 这个程序。首先进入 `/usr/local/stow/` 目录: ``` $ cd /usr/local/stow/ ``` -.. 然后运行下面的命令: +然后运行下面的命令: ``` $ sudo stow --delete hello @@ -162,7 +159,7 @@ $ hello 看, Hello 已经被移除了! -请注意 Stow 仅仅只移除了符号链接。所有与 hello 这个程序相关的文件或者目录还保存在 **/usr/local/stow/hello** 目录下。所以你无需再次下载源文件就可以再次安装 hello 这个程序。如果你不再需要它了,直接删除这个文件夹即可。 +请注意 Stow 仅仅只移除了符号链接。所有与 hello 这个程序相关的文件或者目录还保存在 `/usr/local/stow/hello` 目录下。所以你无需再次下载源文件就可以再次安装 hello 这个程序。如果你不再需要它了,直接删除这个文件夹即可。 ``` $ sudo rm -fr /usr/local/stow/hello/ @@ -174,22 +171,20 @@ $ sudo rm -fr /usr/local/stow/hello/ $ man stow ``` - Stow 可以像安装程序一样轻松地帮你移除它。如果你想知道如何高效的管理很多从源代码中安装的程序,GNU Stow 就是一个使得这个任务更加轻松的一个选择,尝试一下,你一定不会失望的。 这就是所有的内容了,希望对你有所帮助。还有更多干活即将到来,可以期待一下的! 祝近祺! - -------------------------------------------------------------------------------- via: https://www.ostechnix.com/an-easy-way-to-remove-programs-installed-from-source-in-linux/ 作者:[SK][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[dianbanjiu](https://github.com/dianbanjiu) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 8930c409846d5aca4608cc475e4bc1a2a3f6ef8b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 12 Jan 2019 23:55:34 +0800 Subject: [PATCH 294/322] PUB:20181221 An Easy Way To Remove Programs Installed From Source In Linux.md @dianbanjiu https://linux.cn/article-10438-1.html --- ...y Way To Remove Programs Installed From Source In Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md (99%) diff --git a/translated/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md b/published/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md similarity index 99% rename from translated/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md rename to published/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md index 19a132c544..12411f8aa0 100644 --- a/translated/tech/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md +++ b/published/20181221 An Easy Way To Remove Programs Installed From Source In Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (dianbanjiu) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10438-1.html) [#]: subject: (An Easy Way To Remove Programs Installed From Source In Linux) [#]: via: (https://www.ostechnix.com/an-easy-way-to-remove-programs-installed-from-source-in-linux/) [#]: author: (SK https://www.ostechnix.com/author/sk/) From 3537ff1e62b53522ef5dbb3c19a55978ca42f05e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 13 Jan 2019 11:38:55 +0800 Subject: [PATCH 295/322] PRF:20190103 How to create presentations with Beamer.md @geekpi --- ...How to create presentations with Beamer.md | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/translated/tech/20190103 How to create presentations with Beamer.md b/translated/tech/20190103 How to create presentations with Beamer.md index 8e98d98561..ca0ac89875 100644 --- a/translated/tech/20190103 How to create presentations with Beamer.md +++ b/translated/tech/20190103 How to create presentations with Beamer.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to create presentations with Beamer) @@ -9,7 +9,9 @@ 如何使用 Beamer 创建演示文稿 ====== -Beamer 将 LaTeX 强大的排版功能和生态系统带进创建幻灯片中。 + +> Beamer 将 LaTeX 强大的排版功能和生态系统带进创建幻灯片中。 + ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bus_presentation.png?itok=CQeyO61b) [Beamer][1] 是用于生成幻灯片的 LaTeX 包。它最棒的功能之一是它可以利用 LaTeX 强大的排版系统和其生态系统中的所有其他软件包。例如,我经常在包含代码的 Beamer 演示文稿中使用 LaTeX 的 [listings][2] 包。 @@ -22,25 +24,25 @@ Beamer 将 LaTeX 强大的排版功能和生态系统带进创建幻灯片中。 \documentclass{beamer} ``` -与任何其他 LaTeX 文档一样,添加你要使用的任何包。例如,要使用 **listings** 包,请输入: +与任何其他 LaTeX 文档一样,添加你要使用的任何包。例如,要使用 `listings` 包,请输入: ``` \usepackage{listings} ``` -将所有内容放在 **document** 环境中: +将所有内容放在 `document` 环境中: ``` \begin{document} ``` -Beamer 文档通常时是一系列的 **frame** 环境。包含代码的 frame 应该被标记为 **fragile**: +Beamer 文档通常时是一系列的 `frame` 环境。包含代码的 `frame` 应该被标记为 `fragile`: ``` \begin{frame}[fragile] ``` -使用标题开始你的 frame: +使用标题开始你的 `frame`: ``` \frametitle{Function to Do Stuff} @@ -48,11 +50,11 @@ Beamer 文档通常时是一系列的 **frame** 环境。包含代码的 frame ### 开始演示前测试你的代码 -世上最糟糕的感受之一你在演讲中说到代码时,突然发现了一个 bug—也许是拼错了关键词或者漏掉了括号。 +世上最糟糕的感受之一你在演讲中说到代码时,突然发现了一个 bug —— 也许是拼错了关键词或者漏掉了括号。 解决方法之一就是测试演示的代码。在多数演示环境中,这意味着创建一个单独的文件、编写测试接着拷贝和粘贴。 -然而,在 Beamer 中有一种更好的方法。想象一下,你有一个名为 **do_stuff.py** 的文件,其中包含代码。你可以在第二个文件中编写 **do_stuff.py** 代码的测试,你可以将其命名为 **test_do_stuff.py**,并且可以使用 [pytest][3] 测试。但是,**do_stuff.py**中的大多数行都缺乏教学价值,比如定义辅助函数。 +然而,在 Beamer 中有一种更好的方法。想象一下,你有一个名为 `do_stuff.py` 的文件,其中包含代码。你可以在第二个文件中编写 `do_stuff.py` 代码的测试,你可以将其命名为 `test_do_stuff.py`,并且可以使用 [pytest][3] 测试。但是,`do_stuff.py` 中的大多数行都缺乏教学价值,比如定义辅助函数。 要简化你受众看到的东西,你可在演示文稿中只导入你要讨论的行到 frame 中: @@ -64,13 +66,13 @@ Beamer 文档通常时是一系列的 **frame** 环境。包含代码的 frame ]{do_stuff.py} ``` -由于你会对这几行(从 8 到 15)进行讨论,因此幻灯片上不需要任何其他内容。结束 frame: +由于你会对这几行(从 8 到 15)进行讨论,因此幻灯片上不需要任何其他内容。结束 `frame`: ``` \end{frame} ``` -在下一张幻灯片中,你想展示刚才的 **do_stuff()** 函数的用法示例: +在下一张幻灯片中,你想展示刚才的 `do_stuff()` 函数的用法示例: ``` \begin{frame}[fragile] @@ -83,15 +85,15 @@ Beamer 文档通常时是一系列的 **frame** 环境。包含代码的 frame \end{frame} ``` -你使用相同的文件,但这次显示调用该函数的行。最后,结束 document: +你使用相同的文件,但这次显示调用该函数的行。最后,结束 `document`: ``` \end{document} ``` -假设你在 **do_stuff.py** 中有一个合适的 Python 文件,这将生成一个含有 2 页的幻灯片。 +假设你在 `do_stuff.py` 中有一个合适的 Python 文件,这将生成一个含有 2 页的幻灯片。 -Beamer 还支持必要的功能如渐进式演示,每次给观众展示一部分以免受到前面的打扰。在行中放入 ”**\pause**“ 会将页面分成不同的部分: +Beamer 还支持必要的功能如渐进式演示,每次给观众展示一部分以免受到前面的打扰。在行中放入 `\pause` 会将页面分成不同的部分: ``` \begin{frame} @@ -107,18 +109,18 @@ Remember: ### 创建讲义 -Beamer 中我最喜欢的功能是你可以用 **\documentclass[ignorenonframetext]{beamer}** 设置忽略 frame 外的所有内容。当我准备演示文稿时,我离开顶部(声明文档类的位置)并自动生成它的两个版本:我的演示稿使用 Beamer 忽略任何 frame 之外的所有文本,另一个含有类似这样的头: +Beamer 中我最喜欢的功能是可以用 `\documentclass[ignorenonframetext]{beamer}` 设置忽略 `frame` 外的所有内容。当我准备演示文稿时,我离开顶部(声明文档类的位置)并自动生成它的两个版本:我的演示稿使用 Beamer 忽略任何 `frame` 之外的所有文本,另一个含有类似这样的头: ``` \documentclass{article} \usepackage{beamerarticle} ``` -这会生成一份讲义—一份含有所有 frame 和它们之间文字的 PDF。 +这会生成一份讲义:一份含有所有 `frame` 和它们之间文字的 PDF。 当会议组织者要求我发布我的幻灯片时,我会包含原始幻灯片作为参考,但我希望人们拿到的是讲义,它包含了所有我不想在幻灯片上写的解释部分。 -在创建幻灯片时,人们经常想是要为演讲优化资料还是方便那些想要日后阅读的人。幸运的是,Beamer 提供了两全其美的办法。 +在创建幻灯片时,人们经常会考虑是为演讲优化讲稿还是为之后想要阅读它的人们优化。幸运的是,Beamer 提供了两全其美的办法。 -------------------------------------------------------------------------------- @@ -127,7 +129,7 @@ via: https://opensource.com/article/19/1/create-presentations-beamer 作者:[Moshe Zadka][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -135,4 +137,4 @@ via: https://opensource.com/article/19/1/create-presentations-beamer [b]: https://github.com/lujun9972 [1]: https://www.overleaf.com/learn/latex/Beamer [2]: https://www.overleaf.com/learn/latex/Code_listing -[3]: https://docs.pytest.org/en/latest/ \ No newline at end of file +[3]: https://docs.pytest.org/en/latest/ From 9a8dae67fb4428b394d6154fdc9ae2a6ee6624bc Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 13 Jan 2019 11:39:32 +0800 Subject: [PATCH 296/322] PUB:20190103 How to create presentations with Beamer.md @geekpi https://linux.cn/article-10439-1.html --- .../20190103 How to create presentations with Beamer.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190103 How to create presentations with Beamer.md (98%) diff --git a/translated/tech/20190103 How to create presentations with Beamer.md b/published/20190103 How to create presentations with Beamer.md similarity index 98% rename from translated/tech/20190103 How to create presentations with Beamer.md rename to published/20190103 How to create presentations with Beamer.md index ca0ac89875..255db4e77a 100644 --- a/translated/tech/20190103 How to create presentations with Beamer.md +++ b/published/20190103 How to create presentations with Beamer.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10439-1.html) [#]: subject: (How to create presentations with Beamer) [#]: via: (https://opensource.com/article/19/1/create-presentations-beamer) [#]: author: (Moshe Zadka https://opensource.com/users/moshez) From 50f8d717c65ee0d49d182d5719206a75a11eac0d Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Sun, 13 Jan 2019 21:03:34 +0800 Subject: [PATCH 297/322] Translated by qhwdw --- ...aboratory - Raspberry Pi- Lesson 1 OK01.md | 232 ------------------ ...aboratory - Raspberry Pi- Lesson 1 OK01.md | 230 +++++++++++++++++ 2 files changed, 230 insertions(+), 232 deletions(-) delete mode 100644 sources/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md create mode 100644 translated/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md diff --git a/sources/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md b/sources/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md deleted file mode 100644 index f16c290504..0000000000 --- a/sources/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md +++ /dev/null @@ -1,232 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (qhwdw) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 1 OK01) -[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html) -[#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) - -Computer Laboratory – Raspberry Pi: Lesson 1 OK01 -====== - -The OK01 lesson contains an explanation about how to get started and teaches how to enable the 'OK' or 'ACT' **LED** on the Raspberry Pi board near the RCA and USB ports. This light was originally labelled OK but has been renamed to ACT on the revision 2 Raspberry Pi boards. - -### 1 Getting Started - -I am assuming at this point that you have already visited the [Downloads][1] page, and got the necessary GNU Toolchain. Also on the downloads page is a file called OS Template. Please download this and extract its contents to a new directory. - -### 2 The Beginning - -``` -The '.s' file extension is commonly used for all forms of assembly code, it is up to us to remember this is ARMv6. -``` - -Now that you have extracted the template, create a new file in the 'source' directory called 'main.s'. This file will contain the code for this operating system. To be explicit, the folder structure should look like: - -``` -build/ - (empty) -source/ - main.s -kernel.ld -LICENSE -Makefile -``` - -Open 'main.s' in a text editor so that we can begin typing assembly code. The Raspberry Pi uses a variety of assembly code called ARMv6, so that is what we'll need to write in. - -Copy in these first commands. - -``` -.section .init -.globl _start -_start: -``` - -As it happens, none of these actually do anything on the Raspberry Pi, these are all instructions to the assembler. The assembler is the program that will translate between assembly code that we understand, and binary machine code that the Raspberry Pi understands. In Assembly Code, each line is a new command. The first line here tells the Assembler[1] where to put our code. The template I provided causes the code in the section called .init to be put at the start of the output. This is important, as we want to make sure we can control which code runs first. If we don't do this, the code in the alphabetically first file name will run first! The .section command simply tells the assembler which section to put the code in, from this point until the next .section or the end of the file. - -``` -In assembly code, you may skip lines, and put spaces before and after commands to aid readability. -``` - -The next two lines are there to stop a warning message and aren't all that important.[2] - -### 3 The First Line - -Now we're actually going to code something. In assembly code, the computer simply goes through the code, doing each instruction in order, unless told otherwise. Each instruction starts on a new line. - -Copy the following instruction. - -``` -ldr r0,=0x20200000 -``` - -``` -ldr reg,=val puts the number val into the register named reg. -``` - -That is our first command. It tells the processor to store the number 0x20200000 into the register r0. I shall need to answer two questions here, what is a register, and how is 0x20200000 a number? - -``` -A single register can store any integer between 0 and 4,294,967,295 inclusive on the Raspberry Pi, which might seem like a large amount of memory, but it is only 32 binary bits. -``` - -A register is a tiny piece of memory in the processor, which is where the processor stores the numbers it is working on right now. There are quite a few of these, many of which have a special meaning, which we will come to later. Importantly there are 13 (named r0,r1,r2,...,r9,r10,r11,r12) which are called General Purpose, and you can use them for whatever calculations you need to do. Since it's the first, I've used r0 in this example, but I could very well have used any of the others. As long as you're consistent, it doesn't matter. - -0x20200000 is indeed a number. However it is written in Hexadecimal notation. To learn more about hexadecimal expand the box below: -``` -Hexadecimal is an alternate system for writing numbers. You may only be aware of the decimal system for writing numbers in which we have 10 digits: 0,1,2,3,4,5,6,7,8 and 9. Hexadecimal is a system with 16 digits: 0,1,2,3,4,5,6,7,8,9,a,b,c,d,e and f. - -![567 is 5 hundreds, 6 tens and 7 units.][2] - -You may recall being taught how decimal numbers work in terms of place value. We say that the rightmost digits is the 'units' digits, the next one left is the 'tens' digit, the next is the 'hundreds' digit, and so on. What this actually meant is, the number is 100 × the value in the 'hundreds' digit, plus 10 × the value in the 'tens' digit, plus 1 × the value in the units digit. - -![567 is 5x10^2+6x10^1+7x10^0][3] - -More mathematically, we can now spot the pattern and say that the rightmost digit is the 100=1s digit, the next left is the 101=10s digit, the next is 102=100s digit, and so on. We have all agreed on the system that 0 is the lowest digit, 1 is the next and so on. But what if we used a different number instead of 10 in these powers? Hexadecimal is just the system in which we use 16 instead. - -![567 = 5x10^2+6x10^1+7x10^0 = 2x16^2+3x16^1+7x16^0][4] - -The mathematics to the right shows that the number 567 in decimal is equivalent to the number 237 in hexadecimal. Often when we need to be clear about what system we're using to write numbers in we put 10 for decimal and 16 for hexadecimal. Since it's difficult to write small numbers in assembly code, we use 0x instead to represent a number in hexadecimal notation. So 0x237 means 23716. - -So where do a,b,c,d,e and f come in? Well, in order to be able to write every number in hexadecimal, we need extra digits. For example 916 = 9×160 = 910, but 1016 = 1×161 + 1×160 = 1610. So if we just used 0,1,2,3,4,5,6,7,8 and 9 we would not be able to write 1010, 1110, 1210, 1310, 1410, 1510. So we introduce 6 new digits such that a16 = 1010, b16 = 1110, c16 = 1210, d16 = 1310, e16 = 1410, f16 = 1510 - -So, we now have another system for writing numbers. But why did we bother? Well, it turns out that since computers always work in binary, hexadecimal notation is very useful because every hexadecimal digit is exactly four binary digits long. This has the nice side effect that a lot of computer numbers are round numbers in hexadecimal, even though they're not in decimal. For example, in the assembly code just above I used the number 2020000016. If I had chose to write this in decimal it would have been 53896806410, which is much less memorable. - -To convert numbers from decimal to hexadecimal I find the following method easiest: - -![Conversion example][5] - - 1. Start with the decimal number, say 567. - 2. Divide by 16 and calculate the remainder. For example 567 ÷ 16 = 35 remainder 7. - 3. The remainder is the last digit of the answer in hexadecimal, in the example this is 7. - 4. Repeat steps 2 and 3 again with the result of the last division until the result is 0. For example 35 ÷ 16 = 2 remainder 3, so 3 is the next digit of the answer. 2 ÷ 16 = 0 remainder 2, so 2 is the next digit of the answer. - 5. Once the result of the division is 0, you can stop. The answer is just the remainders in the reverse order to which you got them, so 56710 = 23716. - - - -To convert hexadecimal numbers back to decimal, it is easiest to expand out the number, so 23716 = 2×162 + 3×161 +7 ×160 = 2×256 + 3×16 + 7×1 = 512 + 48 + 7 = 567. -``` - -So our first command is to put the number 2020000016 into r0. That doesn't sound like it would be much use, but it is. In computers, there are an awful lot of chunks of memory and devices. In order to access them all, we give each one an address. Much like a postal address or a web address this is just a means of identifying the location of the device or chunks of memory we want. Addresses in computers are just numbers, and so the number 2020000016 happens to be the address of the GPIO controller. This is just a design decision taken by the manufacturers, they could have used any other address (providing it didn't conflict with anything else). I know this address only because I looked it up in a manual[3], there is no particular system to the addresses (other than that they are all large round numbers in hexadecimal). - -### 4 Enabling Output - -![A diagram showing key parts of the GPIO controller.][6] - -Having read the manual, I know we're going to need to send two messages to the GPIO controller. We need to talk its language, but if we do, it will obligingly do what we want and turn on the OK LED. Fortunately, it is such a simple chip, that it only needs a few numbers in order to understand what to do. - -``` -mov r1,#1 -lsl r1,#18 -str r1,[r0,#4] -``` - -``` -mov reg,#val puts the number val into the register named reg. - -lsl reg,#val shifts the binary representation of the number in reg by val places to the left. - -str reg,[dest,#val] stores the number in reg at the address given by dest + val. -``` - -These commands enable output to the 16th GPIO pin. First we get a necessary value in r1, then send it to the GPIO controller. Since the first two instructions are just trying to get a value into r1, we could use another ldr command as before, but it will be useful to us later to be able to set any given GPIO pin, so it is better to deduce the value from a formula than write it straight in. The OK LED is wired to the 16th GPIO pin, and so we need to send a command to enable the 16th pin. - -The value in r1 is needed to enable the LED pin. The first line puts the number 110 into r1. The mov command is faster than the ldr command, because it does not involve a memory interaction, whereas ldr loads the value we want to put into the register from memory. However, mov can only be used to load certain values[4]. In ARM assembly code, almost every instruction begins with a three letter code. This is called the mnemonic, and is supposed to hint at what the operation does. mov is short for move and ldr is short for load register. mov moves the second argument #1 into the first r1. In general, # must be used to denote numbers, but we have already seen a counterexample to this. - -The second instruction is lsl or logical shift left. This means shift the binary representation for the first argument left by the second argument. In this case this will shift the binary representation of 110 (which is 12) left by 18 places (making it 10000000000000000002=26214410). - -If you are unfamiliar with binary, expand the box below: -``` -Just like hexadecimal binary is another way of writing numbers. In binary we only have 2 digits, 0 and 1. This is useful for computers because we can implement this in a circuit by saying that electricity flowing through the circuit means 1, and not means 0. This is how computers actually work and do maths. Despite only having 2 digits binary can still be used to represent every number, it just takes a lot longer. - -![567 in decimal = 1000110111 in binary][7] - -The image shows the binary representation of the number 56710 which is 10001101112. We use 2 to denote numbers written in binary. - -One of the quirks of binary that we make heavy use of in assembly code is the ease by which numbers can be multiplied or divided by powers of 2 (e.g. 1,2,4,8,16). Normally multiplications and divisions are tricky operations, however these special cases are very easy, and so are very important. - -![13*4 = 52, 1101*100=110100][8] - -Shifting a binary number left by **n** places is the same as multiplying the number by 2 **n**. So, if we want to multiply by 4, we just shift the number left 2 places. If we want to multiply by 256 we could shift it left by 8 places. If we wanted to multiply by a number like 12, we could instead multiply it by 8, then separately by 4 and add the results (N × 12 = N × (8 + 4) = N × 8 + N × 4). - -![53/16 = 3, 110100/10000=11][9] - -Shifting a binary number right by **n** places is the same as dividing the number by 2 **n**. The remainder of the division is the bits that were lost when shifted right. Unfortunately dividing by a binary number that is not an exact power of 2 is very difficult, and will be covered in [Lesson 9: Screen04][10]. - -![Binary Terminology][11] - -This diagram shows common terminology used with binary. A bit is a single binary digit. A nibble is 4 binary bits. A byte is 2 nibbles, or 8 bits. A half is half the size of a word, 2 bytes in this case. A word refers to the size of the registers on a processor, and so on the Raspberry Pi this is 4 bytes. The convention is to number the most significant bit of a word 31, and the least significant bit as 0. The top, or high bits refer to the most significant bits, and the low or bottom bits refer to the least significant. A kilobyte (KB) is 1000 bytes, a megabyte is 1000 KB. There is some confusion as to whether this should be 1000 or 1024 (a round number in binary). As such, the new international standard is that a KB is 1000 bytes, and a Kibibyte (KiB) is 1024 bytes. A Kb is 1000 bits, and a Kib is 1024 bits. - -The Raspberry Pi is little endian by default, meaning that loading a byte from an address you just wrote a word to will load the lowest byte of the word. -``` - -Once again, I only know that we need this value from reading the manual[3]. The manual says that there is a set of 24 bytes in the GPIO controller, which determine the settings of the GPIO pin. The first 4 relate to the first 10 GPIO pins, the second 4 relate to the next 10 and so on. There are 54 GPIO pins, so we need 6 sets of 4 bytes, which is 24 bytes in total. Within each 4 byte section, every 3 bits relates to a particular GPIO pin. Since we want the 16th GPIO pin, we need the second set of 4 bytes because we're dealing with pins 10-19, and we need the 6th set of 3 bits, which is where the number 18 (6×3) comes from in the code above. - -Finally the str 'store register' command stores the value in the first argument, r1 into the address computed from the expression afterwards. The expression can be a register, in this case r0, which we know to be the GPIO controller address, and another value to add to it, in this case #4. This means we add 4 to the GPIO controller address and write the value in r1 to that location. This happens to be the location of the second set of 4 bytes that I mentioned before, and so we send our first message to the GPIO controller, telling it to ready the 16th GPIO pin for output. - -### 5 A Sign Of Life - -Now that the LED is ready to turn on, we need to actually turn it on. This means sending a message to the GPIO controller to turn pin 16 off. Yes, turn it off. The chip manufacturers decided it made more sense[5] to have the LED turn on when the GPIO pin is off. Hardware engineers often seem to take these sorts of decisions, seemingly just to keep OS Developers on their toes. Consider yourself warned. - -``` -mov r1,#1 -lsl r1,#16 -str r1,[r0,#40] -``` - -Hopefully you should recognise all of the above commands, if not their values. The first puts a 1 into r1 as before. The second shifts the binary representation of this 1 left by 16 places. Since we want to turn pin 16 off, we need to have a 1 in the 16th bit of this next message (other values would work for other pins). Finally we write it out to the address which is 4010 added to the GPIO controller address, which happens to be the address to write to turn a pin off (28 would turn the pin on). - -### 6 Happily Ever After - -It might be tempting to finish now, but unfortunately the processor doesn't know we're done. In actuality, the processor never will stop. As long as it has power, it continues working. Thus, we need to give it a task to do forever more, or the Raspberry Pi will crash (not much of a problem in this example, the light is already on). - -``` -loop$: -b loop$ -``` - -``` -name: labels the next line name. - -b label causes the next line to be executed to be label. -``` - -The first line here is not a command, but a label. It names the next line loop$. This means we can now refer to the line by name. This is called a label. Labels get discarded when the code is turned into binary, but they're useful for our benefit for referring to lines by name, not number (address). By convention we use a $ for labels which are only important to the code in this block of code, to let others know they're not important to the overall program. The b (branch) command causes the next line to be executed to be the one at the label specified, rather than the one after it. Therefore, the next line to be executed will be this b, which will cause it to be executed again, and so on forever. Thus the processor is stuck in a nice infinite loop until it is switched off safely. - -The new line at the end of the block is intentional. The GNU toolchain expects all assembly code files to end in an empty line, so that it is sure you were really finished, and the file hasn't been cut off. If you don't put one, you get an annoying warning when the assembler runs. - -### 7 Pi Time - -So we've written the code, now to get it onto the pi. Open a terminal on your computer and change the current working directory to the parent directory of the source directory. Type make and then press enter. If any errors occur, please refer to the troubleshooting section. If not, you will have generated three files. kernel.img is the compiled image of your operating system. kernel.list is a listing of the assembly code you wrote, as it was actually generated. This is useful to check that things were generated correctly in future. The kernel.map file contains a map of where all the labels ended up, which can be useful for chasing around values. - -To install your operating system, first of all get a Raspberry PI SD card which has an operating system installed already. If you browse the files in the SD card, you should see one called kernel.img. Rename this file to something else, such as kernel_linux.img. Then, copy the file kernel.img that make generated onto the SD Card. You've just replaced the existing operating system with your own. To switch back, simply delete your kernel.img file, and rename the other one back to kernel.img. I find it is always helpful to keep a backup of you original Raspberry Pi operating system, in case you need it again. - -Put the SD card into a Raspberry Pi and turn it on. The OK LED should turn on. If not please see the troubleshooting page. If so, congratulations, you just wrote your first operating system. See [Lesson 2: OK02][12] for a guide to making the LED flash on and off. - --------------------------------------------------------------------------------- - -via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html - -作者:[Robert Mullins][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: http://www.cl.cam.ac.uk/~rdm34 -[b]: https://github.com/lujun9972 -[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/downloads.html -[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/hexadecimal1.png -[3]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/hexadecimal2.png -[4]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/hexadecimal3.png -[5]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/hexadecimal4.png -[6]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/gpioController.png -[7]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/binary1.png -[8]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/binary2.png -[9]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/binary3.png -[10]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen04.html -[11]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/binary4.png -[12]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok02.html diff --git a/translated/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md b/translated/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md new file mode 100644 index 0000000000..db9854b04c --- /dev/null +++ b/translated/tech/20120201 Computer Laboratory - Raspberry Pi- Lesson 1 OK01.md @@ -0,0 +1,230 @@ +[#]: collector: (lujun9972) +[#]: translator: (qhwdw) +[#]: reviewer: () +[#]: publisher: () +[#]: url: () +[#]: subject: (Computer Laboratory – Raspberry Pi: Lesson 1 OK01) +[#]: via: (https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html) +[#]: author: (Robert Mullins http://www.cl.cam.ac.uk/~rdm34) + +计算机实验室 - 树莓派:课程 1:OK01 +====== + +OK01 课程讲解了树莓派如何开始,以及在树莓派上如何启用靠近 RCA 和 USB 端口的 `OK` 或 `ACT` 的 **LED** 指示灯。这个指示灯最初是为了指示 `OK` 的,但它在第二版的树莓派上被重命名为 `ACT`。 + +### 1、入门 + +我们假设你已经访问了[下载][1]页面,并且已经获得了必需的 GNU 工具链。也下载了一个称为操作系统模板的文件。请下载这个文件并在一个新目录中解开它。 + +### 2、开始 + +``` +扩展名为 '.s' 的文件一般是汇编代码,需要记住的是,在这里它是 ARMv6 的汇编代码。 +``` + +现在,你已经展开了这个模板,在 `source` 目录中创建一个名为 `main.s` 的文件。这个文件包含了这个操作系统的代码。具体来看,这个文件夹的结构应该像下面这样: + +``` +build/ + (empty) +source/ + main.s +kernel.ld +LICENSE +Makefile +``` + +用文本编辑器打开 `main.s` 文件,这样我们就可以输入汇编代码了。树莓派使用了称为 ARMv6 的汇编代码变体,这就是我们即将要写的汇编代码类型。 + +首先,我们复制下面的这些命令。 + +``` +.section .init +.globl _start +_start: +``` + +实际上,上面这些指令并没有在树莓派上做任何事情,它们是提供给汇编器的指令。汇编器是一个转换程序,它将树莓派能够理解的机器代码转换成我们能够理解的汇编代码,在汇编代码中,每个行都是一个新的命令。上面的第一行告诉汇编器在哪里放我们的代码。我们提供的模板中将它放到一个名为 `.init` 的节中的原因是,它是输出的起始点。这很重要,因为我们希望确保我们能够控制哪个代码首先运行。如果不这样做,首先运行的代码将是按字母顺序排在前面的代码!`.section` 命令简单地告诉汇编器,哪个节中放置代码,从这个点开始,直到下一个 `.section` 或文件结束为止。 + +``` +在汇编代码中,你可以跳行、在命令前或后放置空格去提升可读性。 +``` + +接下来两行是停止一个警告消息,它们并不重要。 + +### 3、第一行代码 + +现在,我们正式开始写代码。计算机执行汇编代码时,是简单地一行一行按顺序执行每个指令,除非明确告诉它不这样做。每个指令都是开始于一个新行。 + +复制下列指令。 + +``` +ldr r0,=0x20200000 +``` + +``` +ldr reg,=val 将数字 val 加载到名为 reg 的寄存器中。 +``` + +那是我们的第一个命令。它告诉处理器将数字 0x20200000 保存到寄存器 r0 中。在这里我需要去回答两个问题,寄存器是什么?0x20200000 是一个什么样的数字? + +``` +树莓派上的一个单独的寄存器能够保存任何介于 0 到 4,294,967,295(含) 之间的任意整数,它可能看起来像一个很大的内存,实际上它仅有 32 个二进制比特。 +``` + +一个寄存器在处理器中就是一个极小的内存块,它是处理器保存正在处理的数字的地方。处理器中有很多寄存器,很多都有专门的用途,我们在后面会一一接触到它们。重要的是,它们有十三个(命名为 r0、r1、r2、…、r9、r10、r11、r12),它们被称为通用寄存器,你可以使用它们做任何计算。由于是写我们的第一行代码,我们在示例中使用了 r0,当然你可以使用它们中的任何一个。只要后面始终如一就没有问题。 + +0x20200000 是一个准确的数字。只不过它是以十六进制表示的。下面的内容详细解释了十六进制的相关信息: + +十六进制是另一种表示数字的方式。你或许只知道十进制的数字表示方法,十进制共有十个数字:0、1、2、3、4、5、6、7、8 和 9。十六进制共有十六个数字:0、1、2、3、4、5、6、7、8、9、a、b、c、d、e 和 f。 + +![567 is 5 hundreds, 6 tens and 7 units.][2] + +你可能还记得十进制是如何用位制来表示的。即最右侧的数字是个位,紧接着的左边一位是十位,再接着的左边一位是百位,依此类推。也就是说,它的值是 100 × 百位的数字,再加上 10 × 十位的数字,再加上 1 × 个位的数字。 + +![567 is 5x10^2+6x10^1+7x10^0][3] + +从数学的角度来看,我们可以发现规律,最右侧的数字是 100=1s,紧接着的左边一位是 101=10s,再接着是 102=100s,依此类推。我们设定在系统中,0 是最低位,紧接着是 1,依此类推。但如果我们使用一个不同于 10 的数字为幂底会是什么样呢?我们在系统中使用的十六进制就是这样的一个数字。 + +![567 = 5x10^2+6x10^1+7x10^0 = 2x16^2+3x16^1+7x16^0][4] + +上面的数学等式表明,十进制的数字 567 等于十六进制的数字 237。通常我们需要在系统中明确它们,我们使用下标 10 表示它是十进制数字,用下标 16 表示它是十六进制数字。由于在汇编代码中写上下标的小数字很困难,因此我们使用 0x 来表示它是一个十六进制的数字,因此 0x237 的意思就是 23716 。 + +那么,后面的 a、b、c、d、e 和 f 又是什么呢?好问题!在十六进制中为了能够写每个数字,我们就需要额外的东西。例如 916 = 9×160 = 910 ,但是 1016 = 1×161 + 1×160 = 1610 。因此,如果我们只使用 0、1、2、3、4、5、6、7、8 和 9,我们就无法写出 1010 、1110 、1210 、1310 、1410 、1510 。因此我们引入了 6 个新的数字,这样 a16 = 1010 、b16 = 1110 、c16 = 1210 、d16 = 1310 、e16 = 1410 、f16 = 1510 。 + +所以,我们就有了另一种写数字的方式。但是我们为什么要这么麻烦呢?好问题!由于计算机总是工作在二进制中,事实证明,十六进制是非常有用的,因为每个十六进制数字正好是四个二进制数字的长度。这种方法还有另外一个好处,那就是许多计算机的数字都是十六进制的整数倍,而不是十进制的整数倍。比如,我在上面的汇编代码中使用的一个数字 2020000016 。如果我们用十进制来写,它就是一个不太好记住的数字 53896806410 。 + +我们可以用下面的简单方法将十进制转换成十六进制: + +![Conversion example][5] + + 1. 我们以十进制数字 567 为例来说明。 + 2. 将十进制数字 567 除以 16 并计算其余数。例如 567 ÷ 16 = 35 余数为 7。 + 3. 在十六进制中余数就是答案中的最后一位数字,在我们的例子中它是 7。 + 4. 重复第 2 步和第 3 步,直到除法结果的整数部分为 0。例如 35 ÷ 16 = 2 余数为 3,因此 3 就是答案中的下一位。2 ÷ 16 = 0 余数为 2,因此 2 就是答案的接下来一位。 + 5. 一旦除法结果的整数部分为 0 就结束了。答案就是反序的余数,因此 56710 = 23716。 + + + +转换十六进制数字为十进制,也很容易,将数字展开即可,因此 23716 = 2×162 + 3×161 +7 ×160 = 2×256 + 3×16 + 7×1 = 512 + 48 + 7 = 567。 + +因此,我们所写的第一个汇编命令是将数字 2020000016 加载到寄存器 r0 中。那个命令看起来似乎没有什么用,但事实并非如此。在计算机中,有大量的内存块和设备。为了能够访问它们,我们给每个内存块和设备指定了一个地址。就像邮政地址或网站地址一样,它用于标识我们想去访问的内存块或设备的位置。计算机中的地址就是一串数字,因此上面的数字 2020000016 就是 GPIO 控制器的地址。这个地址是由制造商的设计所决定的,他们也可以使用其它地址(只要不与其它的冲突即可)。我之所以知道这个地址是 GPIO 控制器的地址是因为我看了它的[手册][https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/downloads/SoC-Peripherals.pdf],地址的使用没有专门的规范(除了它们都是以十六进制表示的大数以外)。 + +### 4、启用输出 + +![A diagram showing key parts of the GPIO controller.][6] + +阅读了手册可以得知,我们需要给 GPIO 控制器发送两个消息。我们必须用它的语言告诉它,如果我们这样做了,它将非常乐意实现我们的意图,去打开 `OK` 的 LED 指示灯。幸运的是,它是一个非常简单的芯片,为了让它能够理解我们要做什么,只需要给它设定几个数字即可。 + +``` +mov r1,#1 +lsl r1,#18 +str r1,[r0,#4] +``` + +``` +mov reg,#val 将数字 val 放到名为 reg 的寄存器中。 + +lsl reg,#val 将寄存器 reg 中的二进制操作数左移 val 位。 + +str reg,[dest,#val] 将寄存器 reg 中的数字保存到地址 dest + val 上。 +``` + +这些命令的作用是在 GPIO 的第 16 号插针上启用输出。首先我们在寄存器 r1 中获取一个必需的值,接着将这个值发送到 GPIO 控制器。因此,前两个命令是尝试取值到寄存器 r1 中,我们可以像前面一样使用另一个命令 `ldr` 来实现,但 `lsl` 命令对我们后面能够设置任何给定的 GPIO 针比较有用,因此从一个公式中推导出值要比直接写入来好一些。表示 `OK` 的 LED 灯是直接连线到 GPIO 的第 16 号针脚上的,因此我们需要发送一个命令去启用第 16 号针脚。 + +寄存器 r1 中的值是启用 LED 针所需要的。第一行命令将数字 110 放到 r1 中。在这个操作中 `mov` 命令要比 `ldr` 命令快很多,因为它不需要与内存交互,而 `ldr` 命令是将需要的值从内存中加载到寄存器中。尽管如此,`mov` 命令仅能用于加载某些值。在 ARM 汇编代码中,基本上每个指令都使用一个三字母代码表示。它们被称为助记词,用于表示操作的用途。`mov` 是 “move" 的简写,而 `ldr` 是 “load register” 的简写。`mov` 是将第二个参数 #1 移动到前面的 r1 寄存器中。一般情况下,`#` 肯定是表示一个数字,但我们已经看到了不符合这种情况的一个反例。 + +第二个指令是 `lsl`(逻辑左移)。它的意思是将第一个参数的二进制操作数向左移第二个参数所表示的位数。在这个案例中,将 110 (即 12 )向左移 18 位(将它变成 10000000000000000002=26214410 )。 + +如果你不熟悉二进制表示法,可以看下面的内容: + +与十六进制一样,二进制是写数字的另一种方法。在二进制中只有两个数字,即 0 和 1。它在计算机中非常有用,因为我们可以用电路来实现它,即电流能够通过电路表示为 1,而电流不能通过电路表示为 0。这就是计算机能够完成真实工作和做数学运算的原理。尽管二进制只有两个数字,但它却能够表示任何一个数字,只是写起来有点长而已。 + +![567 in decimal = 1000110111 in binary][7] + +这个图片展示了 56710 的二进制表示是 10001101112 。我们使用下标 2 来表示这个数字是用二进制写的。 + +我们在汇编代码中大量使用二进制的其中一个巧合之处是,数字可以很容易地被 2 的幂(即 1、2、4、8、16)乘或除。通常乘法和除法都是非常难的,而在某些特殊情况下却变得非常容易,所以二进制非常重要。 + +![13*4 = 52, 1101*100=110100][8] + +将一个二进制数字左移 **n** 位就相当于将这个数字乘以 2 **n**。因此,如果我们想将一个数乘以 4,我们只需要将这个数字左移 2 位。如果我们想将它乘以 256,我们只需要将它左移 8 位。如果我们想将一个数乘以 12 这样的数字,我们可以有一个替代做法,就是先将这个数乘以 8,然后再将那个数乘以 4,最后将两次相乘的结果相加即可得到最终结果(N × 12 = N × (8 + 4) = N × 8 + N × 4)。 + +![53/16 = 3, 110100/10000=11][9] + +右移一个二进制数 **n** 位就相当于这个数除以 2 **n** 。在右移操作中,除法的余数位将被丢弃。不幸的是,如果对一个不能被 2 的幂次方除尽的二进制数字做除法是非常难的,这将在 [课程 9:Screen04][10] 中讲到。 + +![Binary Terminology][11] + +这个图展示了二进制常用的术语。一个比特bit就是一个单独的二进制位。一个“半字节nibble“ 是 4 个二进制位。一个字节byte是 2 个半字节,也就是 8 个比特。在一个word用两个字节来表示的情况下,一半是指一个字长度的一半。一个字是指处理器上寄存器的大小,因此,树莓派的字长是 4 字节。按惯例,将一个数字最高有效位标识为 31,而将最低有效位标识为 0。顶部或最高位表示最高有效位,而底部或最低位表示最低有效位。一个 kilobyte(KB)就是 1000 字节,一个 megabyte 就是 1000 KB。这样表示会导致一些困惑,到底应该是 1000 还是 1024(二进制中的整数)。鉴于这种情况,新的国际标准规定,一个 KB 等于 1000 字节,而一个 Kibibyte(KiB)是 1024 字节。一个 Kb 是 1000 比特,而一个 Kib 是 1024 比特。 + +树莓派默认采用小端法,也就是说,你刚才写的从地址上加载一个字节时,是从一个字的低位字节开始加载的。 + +再强调一次,我们只有去阅读手册才能知道我们所需要的值。手册上说,GPIO 控制器中有一个 24 字节的集合,由它来决定 GPIO 针脚的设置。第一个 4 字节与前 10 个 GPIO 针脚有关,第二个 4 字节与接下来的 10 个针脚有关,依此类推。总共有 54 个 GPIO 针脚,因此,我们需要 6 个 4 字节的一个集合,总共是 24 个字节。在每个 4 字节中,每 3 个比特与一个特定的 GPIO 针脚有关。我们想去启用的是第 16 号 GPIO 针脚,因此我们需要去设置第二组 4 字节,因为第二组的 4 字节用于处理 GPIO 针脚的第 10-19 号,而我们需要 3 比特集合的第 6 位,它在上面的代码中的编号是 18(6×3)。 + +最后的 `str`(store register)命令去保存第一个参数中的值,将寄存器 r1 中的值保存到后面的表达式计算出来的地址上。这个表达式可以是一个寄存器,在上面的例子中是 r0,我们知道 r0 中保存了GPIO 控制器的地址,而另一个值是加到它上面的,在这个例子中是 #4。它的意思是将 GPIO 控制器地址加上 4 得到一个新的地址,并将寄存器 r1 中的值写到那个地址上。那个地址就是我们前面提到的第二个 4 字节集合的位置,因此,我们发送我们的第一个消息到 GPIO 控制器上,告诉它准备启用 GPIO 第 16 号针脚的输出。 + +### 5、一个活跃信号 + +现在,LED 已经做好了打开准备,我们还需要实际去打开它。意味着需要给 GPIO 控制器发送一个消息去关闭 16 号针脚。是的,你没有看错,就是要发送一个关闭的消息。芯片制造商认为,在 GPIO 针脚关闭时打开 LED 更有意义。硬件工程师经常做这种反常理的决策,似乎是为了让操作系统开发者保持警觉。可以认为是给自己的一个警告。 + +``` +mov r1,#1 +lsl r1,#16 +str r1,[r0,#40] +``` + +希望你能够认识上面全部的命令,先不要管它的值。第一个命令和前面一样,是将值 1 推入到寄存器 r1 中。第二个命令是将二进制的 1 左移 16 位。由于我们是希望关闭 GPIO 的 16 号针脚,我们需要在下一个消息中将第 16 比特设置为 1(想设置其它针脚只需要改变相应的比特位即可)。最后,我们写这个值到 GPIO 控制器地址加上 4010 的地址上,这将使那个针脚关闭(加上 28 将打开针脚)。 + +### 6、永远幸福快乐 + +现在结束,可能有点意犹未尽,但不幸的是,处理器并不知道我们做了什么。事实上,处理器只要通电,它就永不停止地运转。因此,我们需要给它一个任务,让它一直运转下去,否则,树莓派将进入休眠(本示例中不会,因为 LED 灯一直亮着)。 + +``` +loop$: +b loop$ +``` + +``` +name: labels 下一行的名字。 + +b label 下一行将去运行标签。 +``` + +第一行不是一个命令,而是一个标签。它是下一行循环 `loop$` 的名字,这意味着我们能够通过名字来指向到行。这就称为一个标签。当代码被转换成二进制后,标签将被丢弃,但这对我们通过名字而不是数字(地址)找到行比较有用。按惯例,我们使用一个 ​$ 表示标签,这个标签只对这个代码块中的代码起作用,让其它人知道,它不对整个程序起作用。`b`(branch)命令将去运行指定的标签中的命令,而不是去运行它后面的下一个命令。因此,下一行将再次去运行这个 `b` 命令,这将导致永远循环下去。因此处理器将进入一个无限循环中,直到它安全关闭为止。 + +代码块结尾的新行是有意这样写的。GNU 工具链要求所有的汇编代码文件都是以空行结束的,因此,这就需要你确保确实是要结束了,并且文件不能被截断。如果你不这样处理,在汇编器运行时,你将收到烦人的警告。 + +### 7、树莓派上场 + +由于我们已经写完了代码,现在,我们可以将它上传到树莓派中了。在你的计算机上打开一个终端,改变当前工作目录为 `source` 文件夹的父级目录。输入 `make` 然后回车。如果报错,请参考排错章节。如果没有报错,你将生成三个文件。 `kernel.img` 是你的编译后的操作系统镜像。`kernel.list` 是你写的汇编代码的一个清单,它实际上是生成的。这在将来检查程序是否正确时非常有用。`kernel.map` 文件包含所有标签结束位置的一个映射,这对于跟踪值非常有用。 + +为安装你的操作系统,需要先有一个已经安装了树莓派操作系统的 SD 卡。如果你浏览 SD 卡中的文件,你应该能看到一个名为 `kernel.img` 的文件。将这个文件重命名为其它名字,比如 `kernel_linux.img`。然后,复制你编译的 `kernel.img` 文件到 SD 卡中原来的位置,这将用你的操作系统镜像文件替换现在的树莓派操作系统镜像。想切换回来时,只需要简单地删除你自己的 `kernel.img` 文件,然后将前面重命名的文件改回 `kernel.img` 即可。我发现,保留一个原始的树莓派操作系统的备份是非常有用的,万一你要用到它呢。 + +将这个 SD 卡插入到树莓派,并打开它的电源。这个 `OK` 的 LED 灯将亮起来。如果不是这样,请查看故障排除页面。如果一切如愿,恭喜你,你已经写出了你的第一个操作系统。[课程 2:OK02][12] 将指导你让 LED 灯闪烁和关闭闪烁。 + +-------------------------------------------------------------------------------- + +via: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok01.html + +作者:[Robert Mullins][a] +选题:[lujun9972][b] +译者:[qhwdw](https://github.com/qhwdw) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://www.cl.cam.ac.uk/~rdm34 +[b]: https://github.com/lujun9972 +[1]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/downloads.html +[2]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/hexadecimal1.png +[3]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/hexadecimal2.png +[4]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/hexadecimal3.png +[5]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/hexadecimal4.png +[6]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/gpioController.png +[7]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/binary1.png +[8]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/binary2.png +[9]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/binary3.png +[10]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/screen04.html +[11]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/images/binary4.png +[12]: https://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/os/ok02.html From 73edbf08af4767b9f01694bd6052357ed3ad71d0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 13 Jan 2019 23:04:01 +0800 Subject: [PATCH 298/322] PRF:20170921 The Rise and Rise of JSON.md @runningwater --- .../20170921 The Rise and Rise of JSON.md | 75 +++++++++++-------- 1 file changed, 44 insertions(+), 31 deletions(-) diff --git a/translated/talk/20170921 The Rise and Rise of JSON.md b/translated/talk/20170921 The Rise and Rise of JSON.md index e5eb3b2dd6..8456a70fa5 100644 --- a/translated/talk/20170921 The Rise and Rise of JSON.md +++ b/translated/talk/20170921 The Rise and Rise of JSON.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (runningwater) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: subject: (The Rise and Rise of JSON) [#]: via: ( https://twobithistory.org/2017/09/21/the-rise-and-rise-of-json.html) @@ -9,61 +9,61 @@ JSON 的兴起与崛起 ====== -JSON 已经占领了全世界。当今,任何两个应用程序彼此通过网络通信时,它们很有可能在使用 JSON。它已被所有大型企业所采用:十大最受欢迎的 web API 接口(主要由 Google、Facebook 和 Twitter 提供的)列表中,仅仅只有一个 API 接口是以 XML 的格式开放数据的。Twitter 给这个 API 添加了一个说明性示例:XML 格式的支持到 2013 年结束,到时候会发布一个新版本的 API,取消 XML 格式,转而使用 JSON。JSON 也在程序编码级别和文件存储上被广泛采用:在 Stack Overflow(一个面向程序员的问答网站)上,现在更多的是关于 JSON 的问题,而不是其他的数据交换格式。 + +JSON 已经占领了全世界。当今,任何两个应用程序彼此通过互联网通信时,可以打赌它们在使用 JSON。它已被所有大型企业所采用:十大最受欢迎的 web API 接口(主要由 Google、Facebook 和 Twitter 提供的)列表中,仅仅只有一个 API 接口是以 XML 的格式开放数据的。[^1] Twitter 给这个 API 添加了一个说明性示例:XML 格式的支持到 2013 年结束,到时候会发布一个新版本的 API,取消 XML 格式,转而使用 JSON。JSON 也在程序编码级别和文件存储上被广泛采用:在 Stack Overflow(LCTT 译注:一个面向程序员的问答网站)上,现在更多的是关于 JSON 的问题,而不是其他的数据交换格式。[^2] ![][1] -XML 仍然在很多地方存在。在网页上有 SVG 和 RSS 订阅服务、Atom 提供商。Android 开发者想要获得用户权限许可时,需要在其 APP 的 `manifest` 文件中声明。此文件是 XML 格式的。XML 的替代品也不仅仅只有 JSON,现在有很多人在使用 YAML 或 Google 的 Protocol Buffers 等技术,但这些技术的受欢迎程度远不如 JSON。目前来看,JSON 是应用程序在网络之间通信的首选协议格式。 -考虑到自 2005 年来网站编程世界对 “异步 JavaScript 和 XML” 而非 “异步 JavaScript 和 JSON” 技术潜力的垂涎欲滴状态,你可以发现 JSON 在其中的主导地位是如此让人惊讶。当然了,这可能与这两种通信格式的受欢迎程度无关,仅反映出 “AJAX” 似乎比 “AJAJ” 更具吸引力。但是,即使在 2015 年时有好些人已经用 JSON 来取代 XML 了(实际上还没有很多人),我们不禁要问 XML 的噩运来的如此之快,以至于短短十年左右,“异步 JavaScript 和 XML” 这个名称就成为一个很讽刺的误称。那个十年发生了什么?JSON 怎么会在那么多应用程序中取代了 XML?现在被全世界工程师和系统所使用、依赖的这种数据格式是谁提出的? +XML 仍然在很多地方存在。网络上它被用于 SVG 和 RSS / Atom 信息流。Android 开发者想要获得用户权限许可时,需要在其 APP 的 `manifest` 文件中声明,此文件是 XML 格式的。XML 的替代品也不仅仅只有 JSON,现在有很多人在使用 YAML 或 Google 的 Protocol Buffers 等技术,但这些技术的受欢迎程度远不如 JSON。目前来看,JSON 是应用程序在网络之间通信的首选协议格式。 +考虑到自 2005 年来网站编程世界就垂涎于 “异步 JavaScript 和 XML” 而非 “异步 JavaScript 和 JSON” 的技术潜力,你可以发现 JSON 在其中的主导地位是如此让人惊讶。当然了,这可能与这两种通信格式的受欢迎程度无关,仅反映出缩写 “AJAX” 似乎比 “AJAJ” 更具吸引力。但是,即使在 2015 年(LCTT 译注:原文此处为 2005 ,根据上下文,应该为 2015)时有些人已经用 JSON 来取代 XML 了(实际上还没有很多人),我们不禁要问 XML 的噩运来的如此之快,以至于短短十年左右,“异步 JavaScript 和 XML” 这个名称就成为一个很讽刺的误称。那十年发生了什么?JSON 怎么会在那么多应用程序中取代了 XML?现在被全世界工程师和系统所使用、依赖的这种数据格式是谁提出的? ### JSON 之诞生 -2001 年 4 月,首个 JSON 格式的消息被发送。此消息是从旧金山湾区某车库的一台计算机发出的,这是计算机历史上重要的的时刻。Douglas Crockford 和 Chip Morningstar 是一家名为 State Software 的技术咨询公司的联合创始人,他们当时聚集在 Morningstar 的车库里测试某个想法,发出了此消息。 +2001 年 4 月,首个 JSON 格式的消息被发送出来。此消息是从旧金山湾区某车库的一台计算机发出的,这是计算机历史上重要的的时刻。Douglas Crockford 和 Chip Morningstar 是一家名为 State Software 的技术咨询公司的联合创始人,他们当时聚集在 Morningstar 的车库里测试某个想法,发出了此消息。 在 “AJAX” 这个术语被创造之前, Crockford 和 Morningstar 就已经在尝试构建好用的 AJAX 应用程序了。可是浏览器对其兼容性不好。他们想要在初始页面加载后就将数据传递给应用程序,但其目标要针对所有的浏览器,这就实现不了。 -这在今天看来不太可信,但是要记得 2001 年的时候 Internet Explorer(IE)代表了网页浏览器的最前沿技术产品。早在 1999 年的时候,Internet Explorer 5 就支持 `XMLHttpRequest 对象原型`,开发者可以使用名为 ActiveX 的框架来访问此对象。 Crockford 和 Morningstar 可能是使用此技术来获取数据,但是在 Netscape 4 中(这是他们想要支持的另一种浏览器)就无法使用这种解决方案。为此 Crockford 和 Morningstar 只得开发不同的系统程序以兼容不同的浏览器。 +这在今天看来不太可信,但是要记得 2001 年的时候 Internet Explorer(IE)代表了网页浏览器的最前沿技术产品。早在 1999 年的时候,Internet Explorer 5 就支持了原始形式的 `XMLHttpRequest`,开发者可以使用名为 ActiveX 的框架来访问此对象。Crockford 和 Morningstar 能够使用此技术(在 IE 中)来获取数据,但是在 Netscape 4 中(这是他们想要支持的另一种浏览器)就无法使用这种解决方案。为此 Crockford 和 Morningstar 只得使用一套不同的系统以兼容不同的浏览器。 第一条 JSON 消息如下所示: ``` ``` -消息中只有一小部分类似于今天我们所知的 JSON,本身其实是一个包含有 JavaScript 的 HTML 文档。类似于 JSON 的部分只是传递给名为`receive()` 的函数的 JavaScript 对象。 +消息中只有一小部分类似于今天我们所知的 JSON,本身其实是一个包含有一些 JavaScript 的 HTML 文档。类似于 JSON 的部分只是传递给名为 `receive()` 的函数的 JavaScript 对象字面量。 -Crockford 和 Morningstar 决定滥用 HTML 的 frame,以发送数据。敲入 URL 返回的 HTML 文档(如上所示)可以指向一个 frame 标签。当接收到 HTML 时,JavaScript 代码段一运行,就可以把数据对象如实地传递回应用程序。只要小心的回避浏览器保护策略,即子窗口不允许访问父窗口,这种技术就可以正常运行无误。可以看到 Crockford 和 Mornginstar 通过明确地设置文档域这种方法来达到其目的。(这种基于 frame 的技术,有时称为隐藏 frame 技术,通常在90年代后期,即广泛使用 XMLHttpRequest 技术之前使用。) +Crockford 和 Morningstar 决定滥用 HTML 的帧(``)以发送数据。他们可以让一个帧指向一个返回的上述 HTML 文档的 URL。当接收到 HTML 时,JavaScript 代码段就会运行,就可以把数据对象字面量如实地传递回应用程序。只要小心的回避浏览器保护策略(即子窗口不允许访问父窗口),这种技术就可以正常运行无误。可以看到 Crockford 和 Mornginstar 通过明确地设置文档域这种方法来达到其目的。(这种基于帧的技术,有时称为隐藏帧技术,通常在 90 年代后期,即广泛使用 XMLHttpRequest 技术之前使用。[^3] ) -关于第一个 JSON 消息的惊人之处在于它显然不是第一次就使用新的数据格式。它仅仅是 JavaScript!实际上,以此使用 JavaScript 的想法如此简单,Crockford 自己也说过他不是第一个这样做的人。他声称 Netscape 公司的某人早在 1996 年就使用 JavaScript 数组文字来交换信息。因为消息就是 JavaScript 本身,其不需要任何特殊解析工作,JavaScript 解释器就可搞定一切。 +第一个 JSON 消息的惊人之处在于,它显然不是一种新的数据格式的首次使用。它就是 JavaScript!实际上,以此方式使用 JavaScript 的想法如此简单,Crockford 自己也说过他不是第一个这样做的人。他说 Netscape 公司的某人早在 1996 年就使用 JavaScript 数组字面量来交换信息。[^4] 因为消息就是 JavaScript,其不需要任何特殊解析工作,JavaScript 解释器就可搞定一切。 -最初的 JSON 信息实际上与 JavaScript 解释器发生了冲突。JavaScript 使用了大量的单词来做为保留字(ECMAScript 6 版本的就有 64 个保留字),Crockford 和 Morningstar 无意中在其 JSON 中引入了一个保留字。他们使用了 `do` 这个关键字,但 `do` 是解释器中的保留字。因为 JavaScript 使用的保留字太多了,Crockford 做了决定:既然不可避免的要使用到这些保留字,那就要求所有的 JSON 关键字都加上引号。被引起来的关键字会被 JavaScript 解释器识别成字符串,其意味着那些保留字也可以放心安全的使用。这就为什么今天 JSON 关键字都要用引号引起来的原因。 +最初的 JSON 信息实际上与 JavaScript 解释器发生了冲突。JavaScript 保留了大量的关键字(ECMAScript 6 版本的就有 64 个保留字),Crockford 和 Morningstar 无意中在其 JSON 中使用了一个保留字。他们使用了 `do` 作为了键名,但 `do` 是解释器中的保留字。因为 JavaScript 使用的保留字太多了,Crockford 做了决定:既然不可避免的要使用到这些保留字,那就要求所有的 JSON 键名都加上引号。被引起来的键名会被 JavaScript 解释器识别成字符串,其意味着那些保留字也可以放心安全的使用。这就为什么今天 JSON 键名都要用引号引起来的原因。 -Crockford 和 Morningstar 意识到这技术可以应用于各类应用系统。想给其命名为 “JSML”,即 JavaScript 标记语言,但发现这个缩写已经被叫做 Java 标记语言的所使用了。因此他们决定采用 “JavaScript Object Notation” 或 JSON 命名。他们开始向客户推销,但很快发现客户不愿意冒险使用缺乏官方规范的未知技术。所以 Crockford 决定写一个规范。 - -2002 年,Crockford 买下了 [JSON.org][2] 域名,放上了 JSON 语法及一个解释器的实例例子。网站仍然在运行,现在已经包含有 2013 年正式批准的 JSON ECMA 标准的显著链接。在网站建立后,Crockford 并没有过多的推广,但很快发现很多人都在提交各种不同编程语言的 JSON 解析器实现。JSON 的血统明显与 JavaScript 相关联,但很明显 JSON 非常适合于不同语言之间的数据交换。 +Crockford 和 Morningstar 意识到这技术可以应用于各类应用系统。想给其命名为 “JSML”,即 JavaScript 标记语言JavaScript Markup Language的意思,但发现这个缩写已经被叫做 Java Speech 标记语言所使用了。因此他们决定采用 “JavaScript Object Notation”,即 JSON。他们开始向客户推销,但很快发现客户不愿意冒险使用缺乏官方规范的未知技术。所以 Crockford 决定写一个规范。 +2002 年,Crockford 买下了 [JSON.org][2] 域名,放上了 JSON 语法及一个解释器的实例例子。该网站仍然在运行,现在已经包含有 2013 年正式批准的 JSON ECMA 标准的显著链接。在该网站建立后,Crockford 并没有过多的推广,但很快发现很多人都在提交各种不同编程语言的 JSON 解析器实现。JSON 的血统明显与 JavaScript 相关联,但很明显 JSON 非常适合于不同语言之间的数据交换。 ### AJAX 导致的误会 -2005 年,JSON 有了一次大扩展。那一年,一位名叫 Jesse James Garrett 的网页设计师和开发人员在博客文章中创造了 “AJAX” 一词。他很谨慎地强调:AJAX 并不是新技术,而是 “好几种技术以某种强大的新方式汇集,其中的各技术各自发展。” AJAX 是 Garrett 给 Web 应用程序开发的新方法(其正获得青睐)的命名。他的博客文章接着描述了开发人员如何利用 JavaScript 和 XMLHttpRequest 对象构建新的应用程序,这些应用程序比传统的网页更具响应性和状态性。 他还举了 Gmail 和 Flickr的网站已经使用 AJAX 技术的例子。 +2005 年,JSON 有了一次大爆发。那一年,一位名叫 Jesse James Garrett 的网页设计师和开发者在博客文章中创造了 “AJAX” 一词。他很谨慎地强调:AJAX 并不是新技术,而是 “好几种蓬勃发展的技术以某种强大的新方式汇集在一起。[^5] ” AJAX 是 Garrett 给这种正受到青睐的新 Web 应用程序开发方法的命名。他的博客文章接着描述了开发人员如何利用 JavaScript 和 XMLHttpRequest 构建新型应用程序,这些应用程序比传统的网页更具响应性和状态性。他还以 Gmail 和 Flickr 网站已经使用 AJAX 技术的例子。 -当然了,“AJAX” 中的 “X” 代表 XML。但在随后的问答帖子中,Garrett 指出,JSON 可以完全替代 XML。他写道:虽然 XML 是 AJAX 客户端进行数据输入输出的最完善的技术,但要实现同样的效果,也可以使用像 JavaScript Object Notation (JSON)或任何类似的结构数据方法等技术。 +当然了,“AJAX” 中的 “X” 代表 XML。但在随后的问答帖子中,Garrett 指出,JSON 可以完全替代 XML。他写道:“虽然 XML 是 AJAX 客户端进行数据输入输出的最完善的技术,但要实现同样的效果,也可以使用像 JavaScript Object Notation (JSON)或任何类似的结构数据方法等技术。 ”[^6] -开发者确实发现在构建 AJAX 应用程序时可以很容易的使用 JSON,并且很多人也开始喜欢上 XML。具有讽刺意味的是,对 AJAX 的兴趣逐渐的导致了 JSON 的普及。大约在这个时候,JSON 引起了博客圈的注意。 +开发者确实发现在构建 AJAX 应用程序时可以很容易的使用 JSON,许多人更喜欢它而不是 XML。具有讽刺意味的是,对 AJAX 的兴趣逐渐的导致了 JSON 的普及。大约在这个时候,JSON 引起了博客圈的注意。 -2006 年,Dave Winer,一位高产的博主,也是许多基于 XML 技术(如 RSS 和 XML-RPC)的后端开发工程师,他抱怨到 JSON 毫无疑问的正在重新发明 XML。虽然他认为数据交换格式之间的竞争不会导致某一技术的消亡,其写到: +2006 年,Dave Winer,一位高产的博主,也是许多基于 XML 的技术(如 RSS 和 XML-RPC)背后的开发工程师,他抱怨到 JSON 毫无疑问的正在重新发明 XML。尽管人们认为数据交换格式之间的竞争不会导致某一技术的消亡,其写到: -> 让我们来比较下重构某结构数据的深度及难度,由于某些原因(我很想听听原因),XML 自身做的并不好,所以毫无疑问地,我会写一个例程来解析 JSON 格式的数据。谁想干这荒谬之事?查找一棵树然后把节点串起来。可以立马试试。 +> 毫无疑问,我可以编写一个例程来分析 JSON,但看看他们有多大的意义要重新发明,出于某种原因 XML 本身对他们来说还不够好(我很想听听原因)。谁想干这荒谬之事?查找一棵树然后把节点串起来。可以立马试试。[^7] -很容易理解 Winer 的挫败感,事实上并没有太多人喜欢 XML。甚至 Winer 也说过他不喜欢 XML。但 XML 已被设计成一个可供任何人使用,并且几乎能想象到的事情都可以做到的系统。最终,XML 实际上是一门元语言,允许你为特定应用程序自定义特定域的语言。如 RSS、web feed 技术和 SOAP(简单对象访问协议)就是自定义的例子。Winer 认为由于通用交换格式所带来的好处,努力达成共识就很重要了。XML 的灵活性应该能满足任何人的需求,然而这里是 JSON 格式,其并不比 XML 更具优势,但其抛弃了 XML 中不好的设计,可以使 XML 更加的灵活。 +我很理解 Winer 的挫败感。事实上并没有太多人喜欢 XML。甚至 Winer 也说过他不喜欢 XML。[^8] 但 XML 已被设计成一个可供任何人使用,并且几乎能想象到的事情都可以做到的系统。最终,XML 实际上是一门元语言,允许你为特定应用程序自定义特定领域的语言。如 Web 信息流技术 RSS 和 SOAP(简单对象访问协议)就是例子。Winer 认为由于通用交换格式所带来的好处,努力达成共识就很重要了。XML 的灵活性应该能满足任何人的需求,然而 JSON 格式呢,其并没有比 XML 提供更多东西,除了它抛弃了使 XML 更灵活的繁琐的东西。 -Crockford 阅读了 Winer 的这篇文章并留下了评论。为了回应 JSON 重新发明 XML 的指责,Crockford 写到:重造轮子的好处是可以得到一个更好的轮子。 +Crockford 阅读了 Winer 的这篇文章并留下了评论。为了回应 JSON 重新发明 XML 的指责,Crockford 写到:“重造轮子的好处是可以得到一个更好的轮子。”[^9] ### JSON 与 XML 对比 @@ -71,18 +71,31 @@ Crockford 阅读了 Winer 的这篇文章并留下了评论。为了回应 JSON 为什么 JSON 比 XML 更受欢迎? -在 [JSON.org][2] 网站上,Crockford 总结了一些 JSON 的优势。他写到,JSON 的语法很小,其结构可预测,因此 JSON 更容易被人类和机器理解。其他博主不得不关注 XML 的冗长啰嗦及“尖括号负担”。XML 中每个开始标记都必须与结束标记匹配,这意味着 XML 文档包含大量的冗余信息。在未压缩时,XML 文档的体积比同信息量 JSON 文档的体积大很多,但是,更重要的,这也使 XML 文档更难以阅读。 +在 [JSON.org][2] 网站上,Crockford 总结了一些 JSON 的优势。他写到,JSON 的语法极少,其结构可预测,因此 JSON 更容易被人类和机器理解。[^10] 其他博主一直关注 XML 的冗长啰嗦及“尖括号负担”。[^11] XML 中每个开始标记都必须与结束标记匹配,这意味着 XML 文档包含大量的冗余信息。在未压缩时,XML 文档的体积比同信息量 JSON 文档的体积大很多,但是,更重要的,这也使 XML 文档更难以阅读。 -Crockford 还声称 JSON 的另一个巨大优势是其被设计为数据交换格式。从一开始,它的目的就是在应用程序间传递结构化信息的。而 XML 呢,虽然也可以使用来传递数据,但其最初被设计为文档标记语言。它从 SGML(通用标准标记语言)演变而来,后来又从称为 Scribe 的标记语言是发展,旨在发展成类似于 LaTeX 一样的文字处理系统。XML 中,一个标签可以包含有所谓的“混合内容”或包含有围绕单词、短语的内嵌标签的文本。这会让人浮现出一副用红蓝笔记录的手稿画面,这是标记语言核心思想的形象比喻。另一方面,JSON 不支持对混合内容模型清晰构建,但也意味着它的结构足够简单。一份文档最好的建模就是一棵树,但 JSON 抛弃了文档的思想,Crockford 将 JSON 抽象限制为字典和数组,这是所有程序员构建程序时都会使用的最基本也最熟悉的元素。 +Crockford 还声称 JSON 的另一个巨大优势是其被设计为数据交换格式。[^12] 从一开始,它的目的就是在应用程序间传递结构化信息的。而 XML 呢,虽然也可以使用来传递数据,但其最初被设计为文档标记语言。它演变自 SGML(通用标准标记语言),而它又是从称为 Scribe 的标记语言演变而来,旨在发展成类似于 LaTeX 一样的文字处理系统。XML 中,一个标签可以包含有所谓的“混合内容”,即带有围绕单词、短语的内嵌标签的文本。这会让人浮现出一副用红蓝笔记录的手稿画面,这是标记语言核心思想的形象比喻。另一方面,JSON 不支持对混合内容模型清晰构建,但也意味着它的结构足够简单。一份文档最好的建模就是一棵树,但 JSON 抛弃了这种文档的思想,Crockford 将 JSON 抽象限制为字典和数组,这是所有程序员构建程序时都会使用的最基本也最熟悉的元素。 -最后,我认为人们不喜欢 XML 是因为它让人困惑。它让人迷惑的地方就是有很多不同的风格。乍一看,XML 本身及其子语言(如 RSS、ATOM、SOAP 或 SVG)之间的界限并不明显。通用 XML 文档创建的版本做为第一个基线,然后特定的子语言 XML 版本应该在这基础上变动。这就有需要变化需要考虑的了,特别是跟 JSON 做比较。JSON 的是如此简单,以至于 JSON 新版本规范甚至都不用重写。XML 的设计者试图将 XML 做为唯一的数据交换格式以支配所有格式,会掉入那个经典程序员的陷阱:过度工程化。XML 非常笼统及概念化,所以很难于简单的使用。 +最后,我认为人们不喜欢 XML 是因为它让人困惑。它让人迷惑的地方就是有很多不同的风格。乍一看,XML 本身及其子语言(如 RSS、ATOM、SOAP 或 SVG)之间的界限并不明显。典型的 XML 文档的第一行标识了该 XML 的版本,然后该 XML 文档应该符合特定的子语言。这就有需要变化需要考虑的了,特别是跟 JSON 做比较,JSON 的是如此简单,以至于永远不需要编写新版本的 JSON 规范。XML 的设计者试图将 XML 做为唯一的数据交换格式以支配所有格式,会掉入那个经典程序员的陷阱:过度工程化。XML 非常笼统及概念化,所以很难于简单的使用。 -在 2000 年的时候,推出了一场活动,以使 HTML 符合 XML 标准。发布了一份符合 XML 标准的 HTML 开发规范,这就此后很出名的 XHTML。虽然一些浏览器供应商立即开始支持这个新标准,但也很明显,大部分基于 HTML 技术的开发者不愿意改变他们的习惯。新标准要求对 XHTML 文档进行严格的验证,而不是基于 HTML 的基准。但大多的网站都是依赖于 HTML 的宽容规则的。到 2009 年的时候,试图编写第二版本的 XHTML 标准已经流产,因为未来已清晰可见, HTML 将会发展为 HTML5(一种不强制要求接受 XML 规则的标准)。 +在 2000 年的时候,发起了一场使 HTML 符合 XML 标准的活动。发布了一份符合 XML 标准的 HTML 开发规范,这就此后很出名的 XHTML。虽然一些浏览器供应商立即开始支持这个新标准,但也很明显,大部分基于 HTML 技术的开发者不愿意改变他们的习惯。新标准要求对 XHTML 文档进行严格的验证,而不是基于 HTML 的基准。但大多的网站都是依赖于 HTML 的宽容规则的。到 2009 年的时候,试图编写第二版本的 XHTML 标准的努力已经流产,因为未来已清晰可见,HTML 将会发展为 HTML5(一种不强制要求接受 XML 规则的标准)。 -如果 XHTML 的努力取得了成功,那么 XML 可能会成为其设计者希望的通用数据格式。想象一下,HTML 文档和 API 响应具有完全相同结构的世界。在这样的世界中,JSON 可能不会像现在一样普遍存在。但我读懂了, XHTML 的失败是 XML 阵营的一种道德失败。如果 XML 不是 HTML 的最佳工具,那么为了其他应用程序,也许会有更好的工具出现。在这个世界,我们的世界,很容易看到像 JSON 格式这样的足够简单、量体裁衣才能获得更大的成功。 +如果 XHTML 的努力取得了成功,那么 XML 可能会成为其设计者希望的通用数据格式。想象一下,HTML 文档和 API 响应具有完全相同结构的世界。在这样的世界中,JSON 可能不会像现在一样普遍存在。但我把 HTML 的失败看做是 XML 阵营的一种道义上的失败。如果 XML 不是 HTML 的最佳工具,那么对于其他应用程序,也许会有更好的工具出现。在这个世界,我们的世界,很容易看到像 JSON 格式这样的足够简单、量体裁衣的才能获得更大的成功。 如果你喜欢这博文,每两周会更新一次! 请在 Twitter 上关注 [@TwoBitHistory] [3] 或订阅 [RSS feed] [4], 以确保得到更新的通知。 +[^1]: http://www.cs.tufts.edu/comp/150IDS/final_papers/tstras01.1/FinalReport/FinalReport.html#software +[^2]: https://insights.stackoverflow.com/trends?tags=json%2Cxml%2Cprotocol-buffers%2Cyaml%2Ccsv +[^3]: Zakas, Nicholas C., et al. “What Is Ajax?” Professional Ajax, 2nd ed., Wiley, 2007. +[^4]: https://youtu.be/-C-JoyNuQJs?t=32s +[^5]: http://adaptivepath.org/ideas/ajax-new-approach-web-applications/ +[^6]: 同上 +[^7]: http://scripting.com/2006/12/20.html +[^8]: http://blogoscoped.com/archive/2009-03-05-n15.html +[^9]: https://scripting.wordpress.com/2006/12/20/scripting-news-for-12202006/#comment-26383 +[^10]: http://www.json.org/xml.html +[^11]: https://blog.codinghorror.com/xml-the-angle-bracket-tax +[^12]: https://youtu.be/-C-JoyNuQJs?t=33m50sgg + -------------------------------------------------------------------------------- via: https://twobithistory.org/2017/09/21/the-rise-and-rise-of-json.html @@ -90,7 +103,7 @@ via: https://twobithistory.org/2017/09/21/the-rise-and-rise-of-json.html 作者:[Two-Bit History][a] 选题:[lujun9972][b] 译者:[runningwater](https://github.com/runningwater) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From f83deae49e676bd4ffed77122e5b395c1956c400 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 14 Jan 2019 08:57:22 +0800 Subject: [PATCH 299/322] translated --- ... Linux desktop into a home media center.md | 87 ------------------- ... Linux desktop into a home media center.md | 87 +++++++++++++++++++ 2 files changed, 87 insertions(+), 87 deletions(-) delete mode 100644 sources/tech/20181128 Turn an old Linux desktop into a home media center.md create mode 100644 translated/tech/20181128 Turn an old Linux desktop into a home media center.md diff --git a/sources/tech/20181128 Turn an old Linux desktop into a home media center.md b/sources/tech/20181128 Turn an old Linux desktop into a home media center.md deleted file mode 100644 index eed213a42e..0000000000 --- a/sources/tech/20181128 Turn an old Linux desktop into a home media center.md +++ /dev/null @@ -1,87 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: subject: (Turn an old Linux desktop into a home media center) -[#]: via: (https://opensource.com/article/18/11/old-linux-desktop-new-home-media-center) -[#]: author: ([Alan Formy-Duval](https://opensource.com/users/alanfdoss)) -[#]: url: ( ) - -Turn an old Linux desktop into a home media center -====== -Repurpose an outdated computer to browse the internet and watch videos on your big screen TV. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/migration_innovation_computer_software.png?itok=VCFLtd0q) - -My first attempt to set up an "entertainment PC" was back in the late 1990s, using a plain old desktop computer with a Trident ProVidia 9685 PCI graphics card. I used what was known as a "TV-out" card, which had an extra output to connect to a standard television set. The onscreen result didn't look very nice and there was no audio output. And it was ugly: I had an S-Video cable running across my living room floor to my 19" Sony Trinitron CRT TV set. - -I had the same sad result from Linux and Windows 98. After struggling with systems that never looked right, I gave up for a few years. Thankfully, today we have HDMI with its vastly better performance and standardized resolution, which makes an inexpensive home media center a reality. - -My new media center entertainment computer is actually my old Ubuntu Linux desktop, which I recently replaced with something faster. The computer became too slow for work, but its AMD Phenom II X4 965 processor at 3.4GHz and 8GB of RAM are good enough for general browsing and video streaming. - -Here are the steps I took to get the best possible performance out of this old system for its new role. - -### Hardware - -First, I removed unnecessary devices including a card reader, hard drives, DVD drive, and a rear-mounted USB card, and I added a PCI-Express WiFi card. I installed Ubuntu to a single solid-state drive (SSD), which can really improve the performance of any older system. - -### BIOS - -In the BIOS, I disabled all unused devices, such as floppy and IDE drive controllers. I disabled onboard video because I installed an NVidia GeForce GTX 650 PCI Express graphics card with an HDMI output. I also disabled onboard audio because the NVidia graphics card chipset provides audio. - -### Audio - -The Nvidia GeForce GTX audio device is listed in the GNOME Control Center's sound settings as a GK107 HDMI Audio Controller, so a single HDMI cable handles both audio and video. There's no need for an audio cable connected to the onboard audio output jack. - -![Sound settings screenshot][2] - -HDMI audio controller shown in GNOME sound settings. - -### Keyboard and mouse - -I have a wireless keyboard and mouse, both from Logitech. When I installed them, I plugged in both peripherals' USB receivers; they worked, but I often had signal-response problems. Then I discovered one was labeled a Unifying Receiver, which meant it can handle multiple Logitech input devices on its own. Logitech doesn't provide software to configure Unifying Receivers in Linux; fortunately, the open source utility [Solaar][3] does. Using a single receiver solved my input performance issues. - -![Solaar][5] - -Solaar Unifying Receiver interface. - -### Video - -It was initially hard to read fonts on my 47" flat-panel TV, so I enabled "Large Text" under Universal Access. I downloaded some wallpapers matching the TV's 1920x1080 resolution that look fantastic! - -### Final touches - -I needed to balance the computer's cooling needs with my desire for unimpeded entertainment. Since this is a standard ATX mini-tower computer, I made sure I had just enough fans with carefully configured temperature settings in the BIOS to reduce fan noise. I also placed the computer behind my entertainment console to further block fan noise but positioned so I can reach the power button. - -The result is a simple machine that is not overly loud and uses only two cables—AC power and HDMI. It should be able to run any mainstream or specialized media center Linux distribution. I don't expect to do too much high-end gaming because that may require more processing horsepower. - -![Showing Ubuntu Linux About page onscreen][7] - -Ubuntu Linux About page. - -![YouTube on the big screen][9] - -Testing a YouTube video on the big screen. - -I haven't yet installed a dedicated media center distribution of Linux like [Kodi][10]. For now, it is running Ubuntu Linux 18.04.1 LTS and is very stable. - -This was a fun challenge to make the best of what I already had rather than buying new hardware. This is just one benefit of open source software. Eventually, I will probably replace it with a smaller, quieter system with a media-center case or another small box, but for now, it meets my needs quite well. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/11/old-linux-desktop-new-home-media-center - -作者:[Alan Formy-Duval][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/alanfdoss -[b]: https://github.com/lujun9972 -[2]: https://opensource.com/sites/default/files/uploads/soundsettings.png (Sound settings screenshot) -[3]: https://pwr.github.io/Solaar/ -[5]: https://opensource.com/sites/default/files/uploads/solaar_interface.png (Solaar) -[7]: https://opensource.com/sites/default/files/uploads/finalresult1.png (Showing Ubuntu Linux About page onscreen) -[9]: https://opensource.com/sites/default/files/uploads/finalresult2.png (YouTube on the big screen) -[10]: https://kodi.tv/ diff --git a/translated/tech/20181128 Turn an old Linux desktop into a home media center.md b/translated/tech/20181128 Turn an old Linux desktop into a home media center.md new file mode 100644 index 0000000000..1ad384583c --- /dev/null +++ b/translated/tech/20181128 Turn an old Linux desktop into a home media center.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (Turn an old Linux desktop into a home media center) +[#]: via: (https://opensource.com/article/18/11/old-linux-desktop-new-home-media-center) +[#]: author: ([Alan Formy-Duval](https://opensource.com/users/alanfdoss)) +[#]: url: ( ) + +将旧的 Linux 桌面变成家庭媒体中心 +====== +重新利用过时的计算机来浏览互联网并在大屏电视上观看视频。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/migration_innovation_computer_software.png?itok=VCFLtd0q) + +我第一次尝试搭建一台“娱乐电脑”是在 20 世纪 90 年代后期,使用一台带 Trident ProVidia 9685 PCI 显卡的普通旧台式电脑。我使用了所谓的“电视输出”卡,它有一个额外的输出连接到标准电视端子上。屏幕显示看起来不太好,而且没有音频输出。并且外观很丑:有一条 S-Video 线穿过了客厅地板连接到我的 19 英寸 Sony Trinitron CRT 电视机上。 + +我在 Linux 和 Windows 98 上也得到了同样令人遗憾的结果。在和那些看起来不对劲的系统挣扎之后,我放弃了几年。值得庆幸的是,如今的 HDMI 拥有更好的性能和标准化的分辨率,这使得廉价的家庭媒体中心成为现实。 + +我的新媒体中心娱乐电脑实际上是我的旧 Ubuntu Linux 桌面,最近我用更快的电脑替换了它。这台电脑在工作中太慢,但是它的 3.4GHz 的 AMD Phenom II X4 965 处理器和 8GB 的 RAM 足以满足一般浏览和视频流的要求。 + +以下是我让旧系统在新角色中发挥最佳性能所采取的步骤。 + +### 硬件 + +首先,我移除了不必要的设备,包括读卡器、硬盘驱动器、DVD 驱动器和后置 USB 卡,我添加了一块 PCI-Express 无线网卡。我将 Ubuntu 安装到单个固态硬盘 (SSD) 上,这可以切实提高任何旧系统的性能。 + +### BIOS + +在 BIOS 中,我禁用了所有未使用的设备,例如软盘和 IDE 驱动器控制器。我禁用了板载显卡,因为我安装了带 HDMI 输出的 NVidia GeForce GTX 650 PCI Express 显卡。我还禁用了板载声卡,因为 NVidia 显卡芯片组提供音频。 + +### 音频 + +Nvidia GeForce GTX 音频设备在 GNOME 控制中心的声音设置中被列为 GK107 HDMI Audio Controller,因此单条 HDMI 线缆可同时处理音频和视频。无需将音频线连接到板载声卡的输出插孔。 + +![Sound settings screenshot][2] + +GNOME 音频设置中的 HDMI 音频控制器。 + +### 键盘和鼠标 + +我有罗技的无线键盘和鼠标。当我安装它们时,我插入了两个外置 USB 接收器,它们可以使用,但我经常遇到信号反应问题。接着我发现其中一个被标记为联合接收器,这意味着它可以自己处理多个罗技输入设备。罗技不提供在 Linux 中配置统一接收器的软件。但幸运的是,有个开源程序 [Solaar][3] 能够做到。使用单个接收器解决了我的输入性能问题。 + +![Solaar][5] + +Solaar 联合接收器界面。 + +### 视频 + +最初很难在我的 47 英寸平板电视上阅读,所以我在 Universal Access 下启用了“大文字”。我下载了一些与电视 1920x1080 分辨率相匹配的壁纸,这看起来很棒! + +### 最后处理 + +我需要在电脑的冷却需求和我对不受阻碍的娱乐的渴望之间取得平衡。由于这是一台标准的 ATX 微型塔式计算机,我确保我有足够的风扇,以及在 BIOS 中精心配置过的温度以减少噪音。我还把电脑放在我的娱乐控制台后面,以进一步减少风扇噪音,但同时我可以按到电源按钮。 + +最后得到一台简单的没有巨大噪音的机器,而且只使用了两根线缆—交流电源线和 HDMI。它应该能够运行任何主流或专门的媒体中心 Linux 发行版。我不期望去玩高端的游戏,因为这可能需要更多的处理能力。 + +![Showing Ubuntu Linux About page onscreen][7] + +Ubuntu Linux 的关于页面。 + +![YouTube on the big screen][9] + +在大屏幕上测试 YouTube 视频。 + +我还没安装像 [Kodi][10] 这样专门的媒体中心发行版。截至目前,它运行的是 Ubuntu Linux 18.04.1 LTS,而且很稳定。 + +这是一个有趣的挑战,可以充分利用我已经拥有的东西,而不是购买新的硬件。这只是开源软件的一个好处。最终,我可能会用一个更小,更安静的带有媒体中心的系统或其他小机顶盒替换它,但是现在,它很好地满足了我的需求。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/11/old-linux-desktop-new-home-media-center + +作者:[Alan Formy-Duval][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/alanfdoss +[b]: https://github.com/lujun9972 +[2]: https://opensource.com/sites/default/files/uploads/soundsettings.png (Sound settings screenshot) +[3]: https://pwr.github.io/Solaar/ +[5]: https://opensource.com/sites/default/files/uploads/solaar_interface.png (Solaar) +[7]: https://opensource.com/sites/default/files/uploads/finalresult1.png (Showing Ubuntu Linux About page onscreen) +[9]: https://opensource.com/sites/default/files/uploads/finalresult2.png (YouTube on the big screen) +[10]: https://kodi.tv/ \ No newline at end of file From 33d8bfcc20ca21bfc0f68dee92a0f11d547b02de Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 14 Jan 2019 09:02:53 +0800 Subject: [PATCH 300/322] translating --- sources/tech/20180606 Working with modules in Fedora 28.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20180606 Working with modules in Fedora 28.md b/sources/tech/20180606 Working with modules in Fedora 28.md index 9a45d3367b..ba92a626f8 100644 --- a/sources/tech/20180606 Working with modules in Fedora 28.md +++ b/sources/tech/20180606 Working with modules in Fedora 28.md @@ -1,3 +1,5 @@ +translating----geekpi + Working with modules in Fedora 28 ====== ![](https://fedoramagazine.org/wp-content/uploads/2018/05/modules-workingwith-816x345.jpg) From 727e34994fb2b11a3b2607d17cccb627d2f450dc Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 14 Jan 2019 11:52:11 +0800 Subject: [PATCH 301/322] PRF:20170921 The Rise and Rise of JSON.md @runningwater --- .../20170921 The Rise and Rise of JSON.md | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/translated/talk/20170921 The Rise and Rise of JSON.md b/translated/talk/20170921 The Rise and Rise of JSON.md index 8456a70fa5..915fe93d0b 100644 --- a/translated/talk/20170921 The Rise and Rise of JSON.md +++ b/translated/talk/20170921 The Rise and Rise of JSON.md @@ -10,18 +10,18 @@ JSON 的兴起与崛起 ====== -JSON 已经占领了全世界。当今,任何两个应用程序彼此通过互联网通信时,可以打赌它们在使用 JSON。它已被所有大型企业所采用:十大最受欢迎的 web API 接口(主要由 Google、Facebook 和 Twitter 提供的)列表中,仅仅只有一个 API 接口是以 XML 的格式开放数据的。[^1] Twitter 给这个 API 添加了一个说明性示例:XML 格式的支持到 2013 年结束,到时候会发布一个新版本的 API,取消 XML 格式,转而使用 JSON。JSON 也在程序编码级别和文件存储上被广泛采用:在 Stack Overflow(LCTT 译注:一个面向程序员的问答网站)上,现在更多的是关于 JSON 的问题,而不是其他的数据交换格式。[^2] +JSON 已经占领了全世界。当今,任何两个应用程序彼此通过互联网通信时,可以打赌它们在使用 JSON。它已被所有大型企业所采用:十大最受欢迎的 web API 接口列表中(主要由 Google、Facebook 和 Twitter 提供),仅仅只有一个 API 接口是以 XML 的格式开放数据的。[^1] 这个列表中的 Twitter API 为此做了一个鲜活的注脚:其对 XML 格式的支持到 2013 年结束,其时发布的新版本的 API 取消 XML 格式,转而仅使用 JSON。JSON 也在程序编码级别和文件存储上被广泛采用:在 Stack Overflow(LCTT 译注:一个面向程序员的问答网站)上,现在更多的是关于 JSON 的问题,而不是其他的数据交换格式。[^2] ![][1] -XML 仍然在很多地方存在。网络上它被用于 SVG 和 RSS / Atom 信息流。Android 开发者想要获得用户权限许可时,需要在其 APP 的 `manifest` 文件中声明,此文件是 XML 格式的。XML 的替代品也不仅仅只有 JSON,现在有很多人在使用 YAML 或 Google 的 Protocol Buffers 等技术,但这些技术的受欢迎程度远不如 JSON。目前来看,JSON 是应用程序在网络之间通信的首选协议格式。 -考虑到自 2005 年来网站编程世界就垂涎于 “异步 JavaScript 和 XML” 而非 “异步 JavaScript 和 JSON” 的技术潜力,你可以发现 JSON 在其中的主导地位是如此让人惊讶。当然了,这可能与这两种通信格式的受欢迎程度无关,仅反映出缩写 “AJAX” 似乎比 “AJAJ” 更具吸引力。但是,即使在 2015 年(LCTT 译注:原文此处为 2005 ,根据上下文,应该为 2015)时有些人已经用 JSON 来取代 XML 了(实际上还没有很多人),我们不禁要问 XML 的噩运来的如此之快,以至于短短十年左右,“异步 JavaScript 和 XML” 这个名称就成为一个很讽刺的误称。那十年发生了什么?JSON 怎么会在那么多应用程序中取代了 XML?现在被全世界工程师和系统所使用、依赖的这种数据格式是谁提出的? +XML 仍然在很多地方存在。网络上它被用于 SVG 和 RSS / Atom 信息流。Android 开发者想要获得用户权限许可时,需要在其 APP 的 `manifest` 文件中声明 —— 此文件是 XML 格式的。XML 的替代品也不仅仅只有 JSON,现在有很多人在使用 YAML 或 Google 的 Protocol Buffers 等技术,但这些技术的受欢迎程度远不如 JSON。目前来看,JSON 是应用程序在网络之间通信的首选协议格式。 +考虑到自 2005 年来 Web 编程世界就垂涎于 “异步 JavaScript 和 XML” 而非 “异步 JavaScript 和 JSON” 的技术潜力,你可以发现 JSON 的主导地位是如此的让人惊讶。当然了,这可能与这两种通信格式的受欢迎程度无关,而仅反映出缩写 “AJAX” 似乎比 “AJAJ” 更具吸引力。但是,即使在 2005 年有些人(实际上没有太多人)已经用 JSON 来取代 XML 了,我们不禁要问为什么 XML 的噩运来的如此之快,以至于短短十来年,“异步 JavaScript 和 XML” 这个名称就成为一个很讽刺的误称。那这十来年发生了什么?JSON 怎么会在那么多应用程序中取代了 XML?现在被全世界工程师和系统所使用、依赖的这种数据格式是谁提出的? ### JSON 之诞生 2001 年 4 月,首个 JSON 格式的消息被发送出来。此消息是从旧金山湾区某车库的一台计算机发出的,这是计算机历史上重要的的时刻。Douglas Crockford 和 Chip Morningstar 是一家名为 State Software 的技术咨询公司的联合创始人,他们当时聚集在 Morningstar 的车库里测试某个想法,发出了此消息。 -在 “AJAX” 这个术语被创造之前, Crockford 和 Morningstar 就已经在尝试构建好用的 AJAX 应用程序了。可是浏览器对其兼容性不好。他们想要在初始页面加载后就将数据传递给应用程序,但其目标要针对所有的浏览器,这就实现不了。 +在 “AJAX” 这个术语被创造之前,Crockford 和 Morningstar 就已经在尝试构建好用的 AJAX 应用程序了,可是浏览器对其兼容性不好。他们想要在初始页面加载后就将数据传递给应用程序,但其目标要针对所有的浏览器,这就实现不了。 这在今天看来不太可信,但是要记得 2001 年的时候 Internet Explorer(IE)代表了网页浏览器的最前沿技术产品。早在 1999 年的时候,Internet Explorer 5 就支持了原始形式的 `XMLHttpRequest`,开发者可以使用名为 ActiveX 的框架来访问此对象。Crockford 和 Morningstar 能够使用此技术(在 IE 中)来获取数据,但是在 Netscape 4 中(这是他们想要支持的另一种浏览器)就无法使用这种解决方案。为此 Crockford 和 Morningstar 只得使用一套不同的系统以兼容不同的浏览器。 @@ -39,49 +39,49 @@ XML 仍然在很多地方存在。网络上它被用于 SVG 和 RSS / Atom 信 消息中只有一小部分类似于今天我们所知的 JSON,本身其实是一个包含有一些 JavaScript 的 HTML 文档。类似于 JSON 的部分只是传递给名为 `receive()` 的函数的 JavaScript 对象字面量。 -Crockford 和 Morningstar 决定滥用 HTML 的帧(``)以发送数据。他们可以让一个帧指向一个返回的上述 HTML 文档的 URL。当接收到 HTML 时,JavaScript 代码段就会运行,就可以把数据对象字面量如实地传递回应用程序。只要小心的回避浏览器保护策略(即子窗口不允许访问父窗口),这种技术就可以正常运行无误。可以看到 Crockford 和 Mornginstar 通过明确地设置文档域这种方法来达到其目的。(这种基于帧的技术,有时称为隐藏帧技术,通常在 90 年代后期,即广泛使用 XMLHttpRequest 技术之前使用。[^3] ) +Crockford 和 Morningstar 决定滥用 HTML 的帧(``)以发送数据。他们可以让一个帧指向一个返回的上述 HTML 文档的 URL。当接收到 HTML 时,JavaScript 代码段就会运行,就可以把数据对象字面量如实地传递回应用程序。只要小心的回避浏览器保护策略(即子窗口不允许访问父窗口),这种技术就可以正常运行无误。可以看到 Crockford 和 Mornginstar 通过明确地设置文档域这种方法来达到其目的。(这种基于帧的技术,有时称为隐藏帧技术,通常在 90 年代后期,即在广泛使用 XMLHttpRequest 技术之前使用。[^3] ) 第一个 JSON 消息的惊人之处在于,它显然不是一种新的数据格式的首次使用。它就是 JavaScript!实际上,以此方式使用 JavaScript 的想法如此简单,Crockford 自己也说过他不是第一个这样做的人。他说 Netscape 公司的某人早在 1996 年就使用 JavaScript 数组字面量来交换信息。[^4] 因为消息就是 JavaScript,其不需要任何特殊解析工作,JavaScript 解释器就可搞定一切。 -最初的 JSON 信息实际上与 JavaScript 解释器发生了冲突。JavaScript 保留了大量的关键字(ECMAScript 6 版本的就有 64 个保留字),Crockford 和 Morningstar 无意中在其 JSON 中使用了一个保留字。他们使用了 `do` 作为了键名,但 `do` 是解释器中的保留字。因为 JavaScript 使用的保留字太多了,Crockford 做了决定:既然不可避免的要使用到这些保留字,那就要求所有的 JSON 键名都加上引号。被引起来的键名会被 JavaScript 解释器识别成字符串,其意味着那些保留字也可以放心安全的使用。这就为什么今天 JSON 键名都要用引号引起来的原因。 +最初的 JSON 信息实际上与 JavaScript 解释器发生了冲突。JavaScript 保留了大量的关键字(ECMAScript 6 版本就有 64 个保留字),Crockford 和 Morningstar 无意中在其 JSON 中使用了一个保留字。他们使用了 `do` 作为了键名,但 `do` 是解释器中的保留字。因为 JavaScript 使用的保留字太多了,Crockford 做了决定:既然不可避免的要使用到这些保留字,那就要求所有的 JSON 键名都加上引号。被引起来的键名会被 JavaScript 解释器识别成字符串,其意味着那些保留字也可以放心安全的使用。这就为什么今天 JSON 键名都要用引号引起来的原因。 -Crockford 和 Morningstar 意识到这技术可以应用于各类应用系统。想给其命名为 “JSML”,即 JavaScript 标记语言JavaScript Markup Language的意思,但发现这个缩写已经被叫做 Java Speech 标记语言所使用了。因此他们决定采用 “JavaScript Object Notation”,即 JSON。他们开始向客户推销,但很快发现客户不愿意冒险使用缺乏官方规范的未知技术。所以 Crockford 决定写一个规范。 +Crockford 和 Morningstar 意识到这技术可以应用于各类应用系统。想给其命名为 “JSML”,即 JavaScript 标记语言JavaScript Markup Language的意思,但发现这个缩写已经被一个名为 Java Speech 标记语言的东西所使用了。因此他们决定采用 “JavaScript Object Notation”,缩写为 JSON。他们开始向客户推销,但很快发现客户不愿意冒险使用缺乏官方规范的未知技术。所以 Crockford 决定写一个规范。 -2002 年,Crockford 买下了 [JSON.org][2] 域名,放上了 JSON 语法及一个解释器的实例例子。该网站仍然在运行,现在已经包含有 2013 年正式批准的 JSON ECMA 标准的显著链接。在该网站建立后,Crockford 并没有过多的推广,但很快发现很多人都在提交各种不同编程语言的 JSON 解析器实现。JSON 的血统明显与 JavaScript 相关联,但很明显 JSON 非常适合于不同语言之间的数据交换。 +2002 年,Crockford 买下了 [JSON.org][2] 域名,放上了 JSON 语法及一个解释器的实例例子。该网站仍然在运行,现在已经包含有 2013 年正式批准的 JSON ECMA 标准的显著链接。在该网站建立后,Crockford 并没有过多的推广,但很快发现很多人都在提交各种不同编程语言的 JSON 解析器实现。JSON 的血统显然与 JavaScript 相关联,但很明显 JSON 非常适合于不同语言之间的数据交换。 ### AJAX 导致的误会 -2005 年,JSON 有了一次大爆发。那一年,一位名叫 Jesse James Garrett 的网页设计师和开发者在博客文章中创造了 “AJAX” 一词。他很谨慎地强调:AJAX 并不是新技术,而是 “好几种蓬勃发展的技术以某种强大的新方式汇集在一起。[^5] ” AJAX 是 Garrett 给这种正受到青睐的新 Web 应用程序开发方法的命名。他的博客文章接着描述了开发人员如何利用 JavaScript 和 XMLHttpRequest 构建新型应用程序,这些应用程序比传统的网页更具响应性和状态性。他还以 Gmail 和 Flickr 网站已经使用 AJAX 技术的例子。 +2005 年,JSON 有了一次大爆发。那一年,一位名叫 Jesse James Garrett 的网页设计师和开发者在博客文章中创造了 “AJAX” 一词。他很谨慎地强调:AJAX 并不是新技术,而是 “好几种蓬勃发展的技术以某种强大的新方式汇集在一起。[^5] ” AJAX 是 Garrett 给这种正受到青睐的 Web 应用程序的新开发方法的命名。他的博客文章接着描述了开发人员如何利用 JavaScript 和 XMLHttpRequest 构建新型应用程序,这些应用程序比传统的网页更具响应性和状态性。他还以 Gmail 和 Flickr 网站已经使用 AJAX 技术作为了例子。 -当然了,“AJAX” 中的 “X” 代表 XML。但在随后的问答帖子中,Garrett 指出,JSON 可以完全替代 XML。他写道:“虽然 XML 是 AJAX 客户端进行数据输入输出的最完善的技术,但要实现同样的效果,也可以使用像 JavaScript Object Notation (JSON)或任何类似的结构数据方法等技术。 ”[^6] +当然了,“AJAX” 中的 “X” 代表 XML。但在随后的问答帖子中,Garrett 指出,JSON 可以完全替代 XML。他写道:“虽然 XML 是 AJAX 客户端进行数据输入、输出的最完善的技术,但要实现同样的效果,也可以使用像 JavaScript Object Notation(JSON)或任何类似的结构数据方法等技术。 ”[^6] 开发者确实发现在构建 AJAX 应用程序时可以很容易的使用 JSON,许多人更喜欢它而不是 XML。具有讽刺意味的是,对 AJAX 的兴趣逐渐的导致了 JSON 的普及。大约在这个时候,JSON 引起了博客圈的注意。 -2006 年,Dave Winer,一位高产的博主,也是许多基于 XML 的技术(如 RSS 和 XML-RPC)背后的开发工程师,他抱怨到 JSON 毫无疑问的正在重新发明 XML。尽管人们认为数据交换格式之间的竞争不会导致某一技术的消亡,其写到: +2006 年,Dave Winer,一位高产的博主,他也是许多基于 XML 的技术(如 RSS 和 XML-RPC)背后的开发工程师,他抱怨到 JSON 毫无疑问的正在重新发明 XML。尽管人们认为数据交换格式之间的竞争不会导致某一技术的消亡。其写到: -> 毫无疑问,我可以编写一个例程来分析 JSON,但看看他们有多大的意义要重新发明,出于某种原因 XML 本身对他们来说还不够好(我很想听听原因)。谁想干这荒谬之事?查找一棵树然后把节点串起来。可以立马试试。[^7] +> 毫无疑问,我可以编写一个例程来解析 JSON,但来看看他们要重新发明一个东西有多大的意义,出于某种原因 XML 本身对他们来说还不够好(我很想听听原因)。谁想干这荒谬之事?查找一棵树然后把节点串起来。可以立马试试。[^7] -我很理解 Winer 的挫败感。事实上并没有太多人喜欢 XML。甚至 Winer 也说过他不喜欢 XML。[^8] 但 XML 已被设计成一个可供任何人使用,并且几乎能想象到的事情都可以做到的系统。最终,XML 实际上是一门元语言,允许你为特定应用程序自定义特定领域的语言。如 Web 信息流技术 RSS 和 SOAP(简单对象访问协议)就是例子。Winer 认为由于通用交换格式所带来的好处,努力达成共识就很重要了。XML 的灵活性应该能满足任何人的需求,然而 JSON 格式呢,其并没有比 XML 提供更多东西,除了它抛弃了使 XML 更灵活的繁琐的东西。 +我很理解 Winer 的挫败感。事实上并没有太多人喜欢 XML。甚至 Winer 也说过他不喜欢 XML。[^8] 但 XML 已被设计成一个可供任何人使用,并且可以用于几乎能想象到的所有事情。归根到底,XML 实际上是一门元语言,允许你为特定应用程序自定义该领域特定的语言。如 Web 信息流技术 RSS 和 SOAP(简单对象访问协议)就是例子。Winer 认为由于通用交换格式所带来的好处,努力达成共识非常重要。XML 的灵活性应该能满足任何人的需求,然而 JSON 格式呢,其并没有比 XML 提供更多东西,除了它抛弃了使 XML 更灵活的那些繁琐的东西。 Crockford 阅读了 Winer 的这篇文章并留下了评论。为了回应 JSON 重新发明 XML 的指责,Crockford 写到:“重造轮子的好处是可以得到一个更好的轮子。”[^9] ### JSON 与 XML 对比 -到 2014 年,JSON 已经由 ECMA 标准和 RFC 官方正式认可。它有自己的 MIME 类型。JSON 已经进入了大联盟时代。 +到 2014 年,JSON 已经由 ECMA 标准和 RFC 官方正式认可。它有了自己的 MIME 类型。JSON 已经进入了大联盟时代。 为什么 JSON 比 XML 更受欢迎? -在 [JSON.org][2] 网站上,Crockford 总结了一些 JSON 的优势。他写到,JSON 的语法极少,其结构可预测,因此 JSON 更容易被人类和机器理解。[^10] 其他博主一直关注 XML 的冗长啰嗦及“尖括号负担”。[^11] XML 中每个开始标记都必须与结束标记匹配,这意味着 XML 文档包含大量的冗余信息。在未压缩时,XML 文档的体积比同信息量 JSON 文档的体积大很多,但是,更重要的,这也使 XML 文档更难以阅读。 +在 [JSON.org][2] 网站上,Crockford 总结了一些 JSON 的优势。他写到,JSON 的语法极少,其结构可预测,因此 JSON 更容易被人类和机器理解。[^10] 其他博主一直关注 XML 的冗长啰嗦及“尖括号负担”。[^11] XML 中每个开始标记都必须与结束标记匹配,这意味着 XML 文档包含大量的冗余信息。在未压缩时,XML 文档的体积比同等信息量 JSON 文档的体积大很多,但是,更重要的,这也使 XML 文档更难以阅读。 -Crockford 还声称 JSON 的另一个巨大优势是其被设计为数据交换格式。[^12] 从一开始,它的目的就是在应用程序间传递结构化信息的。而 XML 呢,虽然也可以使用来传递数据,但其最初被设计为文档标记语言。它演变自 SGML(通用标准标记语言),而它又是从称为 Scribe 的标记语言演变而来,旨在发展成类似于 LaTeX 一样的文字处理系统。XML 中,一个标签可以包含有所谓的“混合内容”,即带有围绕单词、短语的内嵌标签的文本。这会让人浮现出一副用红蓝笔记录的手稿画面,这是标记语言核心思想的形象比喻。另一方面,JSON 不支持对混合内容模型清晰构建,但也意味着它的结构足够简单。一份文档最好的建模就是一棵树,但 JSON 抛弃了这种文档的思想,Crockford 将 JSON 抽象限制为字典和数组,这是所有程序员构建程序时都会使用的最基本也最熟悉的元素。 +Crockford 还声称 JSON 的另一个巨大优势是其被设计为数据交换格式。[^12] 从一开始,它的目的就是在应用程序间传递结构化信息的。而 XML 呢,虽然也可以使用来传递数据,但其最初被设计为文档标记语言。它演变自 SGML(通用标准标记语言),而它又是从被称为 Scribe 的标记语言演变而来,其旨在发展成类似于 LaTeX 一样的文字处理系统。XML 中,一个标签可以包含有所谓的“混合内容”,即带有围绕单词、短语的内嵌标签的文本。这会让人浮现出一副用红蓝笔记录的手稿画面,这是标记语言核心思想的形象比喻。另一方面,JSON 不支持对混合内容模型的清晰构建,但这也意味着它的结构足够简单。一份文档最好的建模就是一棵树,但 JSON 抛弃了这种文档的思想,Crockford 将 JSON 抽象限制为字典和数组,这是所有程序员构建程序时都会使用的最基本的、也最熟悉的元素。 -最后,我认为人们不喜欢 XML 是因为它让人困惑。它让人迷惑的地方就是有很多不同的风格。乍一看,XML 本身及其子语言(如 RSS、ATOM、SOAP 或 SVG)之间的界限并不明显。典型的 XML 文档的第一行标识了该 XML 的版本,然后该 XML 文档应该符合特定的子语言。这就有需要变化需要考虑的了,特别是跟 JSON 做比较,JSON 的是如此简单,以至于永远不需要编写新版本的 JSON 规范。XML 的设计者试图将 XML 做为唯一的数据交换格式以支配所有格式,会掉入那个经典程序员的陷阱:过度工程化。XML 非常笼统及概念化,所以很难于简单的使用。 +最后,我认为人们不喜欢 XML 是因为它让人困惑。它让人迷惑的地方就是有很多不同的风格。乍一看,XML 本身及其子语言(如 RSS、ATOM、SOAP 或 SVG)之间的界限并不明显。典型的 XML 文档的第一行标识了该 XML 的版本,然后该 XML 文档应该符合特定的子语言。这就有变化需要考虑了,特别是跟 JSON 做比较,JSON 是如此简单,以至于永远不需要编写新版本的 JSON 规范。XML 的设计者试图将 XML 做为唯一的数据交换格式以支配所有格式,就会掉入那个经典的程序员陷阱:过度工程化。XML 非常笼统及概念化,所以很难于简单的使用。 -在 2000 年的时候,发起了一场使 HTML 符合 XML 标准的活动。发布了一份符合 XML 标准的 HTML 开发规范,这就此后很出名的 XHTML。虽然一些浏览器供应商立即开始支持这个新标准,但也很明显,大部分基于 HTML 技术的开发者不愿意改变他们的习惯。新标准要求对 XHTML 文档进行严格的验证,而不是基于 HTML 的基准。但大多的网站都是依赖于 HTML 的宽容规则的。到 2009 年的时候,试图编写第二版本的 XHTML 标准的努力已经流产,因为未来已清晰可见,HTML 将会发展为 HTML5(一种不强制要求接受 XML 规则的标准)。 +在 2000 年的时候,发起了一场使 HTML 符合 XML 标准的活动,发布了一份符合 XML 标准的 HTML 开发规范,这就此后很出名的 XHTML。虽然一些浏览器厂商立即开始支持这个新标准,但也很明显,大部分基于 HTML 技术的开发者不愿意改变他们的习惯。新标准要求对 XHTML 文档进行严格的验证,而不是基于 HTML 的基准。但大多的网站都是依赖于 HTML 的宽容规则的。到 2009 年的时候,试图编写第二版本的 XHTML 标准的努力已经流产,因为未来已清晰可见,HTML 将会发展为 HTML5(一种不强制要求接受 XML 规则的标准)。 -如果 XHTML 的努力取得了成功,那么 XML 可能会成为其设计者希望的通用数据格式。想象一下,HTML 文档和 API 响应具有完全相同结构的世界。在这样的世界中,JSON 可能不会像现在一样普遍存在。但我把 HTML 的失败看做是 XML 阵营的一种道义上的失败。如果 XML 不是 HTML 的最佳工具,那么对于其他应用程序,也许会有更好的工具出现。在这个世界,我们的世界,很容易看到像 JSON 格式这样的足够简单、量体裁衣的才能获得更大的成功。 +如果 XHTML 的努力取得了成功,那么 XML 可能会成为其设计者所希望的通用数据格式。想象一下,一个 HTML 文档和 API 响应具有完全相同结构的世界。在这样的世界中,JSON 可能不会像现在一样普遍存在。但我把 HTML 的失败看做是 XML 阵营的一种道义上的失败。如果 XML 不是 HTML 的最佳工具,那么对于其他应用程序,也许会有更好的工具出现。在这个世界,我们的世界,很容易看到像 JSON 格式这样的足够简单、量体裁衣的才能获得更大的成功。 -如果你喜欢这博文,每两周会更新一次! 请在 Twitter 上关注 [@TwoBitHistory] [3] 或订阅 [RSS feed] [4], 以确保得到更新的通知。 +如果你喜欢这博文,每两周会更新一次! 请在 Twitter 上关注 [@TwoBitHistory][3] 或订阅 [RSS feed][4],以确保得到更新的通知。 [^1]: http://www.cs.tufts.edu/comp/150IDS/final_papers/tstras01.1/FinalReport/FinalReport.html#software [^2]: https://insights.stackoverflow.com/trends?tags=json%2Cxml%2Cprotocol-buffers%2Cyaml%2Ccsv From 644421e7c6f4a2b78fb06081fe3e3626e974c74f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 14 Jan 2019 11:53:02 +0800 Subject: [PATCH 302/322] PUB:20170921 The Rise and Rise of JSON.md @runningwater https://linux.cn/article-10440-1.html --- .../20170921 The Rise and Rise of JSON.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/talk => published}/20170921 The Rise and Rise of JSON.md (98%) diff --git a/translated/talk/20170921 The Rise and Rise of JSON.md b/published/20170921 The Rise and Rise of JSON.md similarity index 98% rename from translated/talk/20170921 The Rise and Rise of JSON.md rename to published/20170921 The Rise and Rise of JSON.md index 915fe93d0b..ffc62b5afe 100644 --- a/translated/talk/20170921 The Rise and Rise of JSON.md +++ b/published/20170921 The Rise and Rise of JSON.md @@ -1,11 +1,11 @@ [#]: collector: (lujun9972) [#]: translator: (runningwater) [#]: reviewer: (wxy) -[#]: publisher: ( ) +[#]: publisher: (wxy) [#]: subject: (The Rise and Rise of JSON) -[#]: via: ( https://twobithistory.org/2017/09/21/the-rise-and-rise-of-json.html) +[#]: via: (https://twobithistory.org/2017/09/21/the-rise-and-rise-of-json.html) [#]: author: (https://twobithistory.org) -[#]: url: ( ) +[#]: url: (https://linux.cn/article-10440-1.html) JSON 的兴起与崛起 ====== From 10f1b86aebd7a91f458c5bad3251d2947991e1a1 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 14 Jan 2019 12:13:07 +0800 Subject: [PATCH 303/322] PRF:20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md @zhs852 --- ...nal Sessions As SVG Animations In Linux.md | 40 +++++++------------ 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/translated/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md b/translated/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md index 45219568f8..748f678a5d 100644 --- a/translated/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md +++ b/translated/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md @@ -1,34 +1,24 @@ [#]: collector: (lujun9972) [#]: translator: (zhs852) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Termtosvg – Record Your Terminal Sessions As SVG Animations In Linux) [#]: via: (https://www.2daygeek.com/termtosvg-record-your-terminal-sessions-as-svg-animations-in-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -Termtosvg – 将你在 Linux 终端中操作录制成 SVG 动画 +Termtosvg:将你在 Linux 终端中操作录制成 SVG 动画 ====== -一般人喜欢使用历史命令功能来查看/再次调用之前在终端中输入的命令。 +一般人喜欢使用历史命令功能来查看/再次调用之前在终端中输入的命令。不幸的是,那样做只会显示先前输入的命令,而不是之前输出的内容。 -不幸的是,那样做只会显示先前输入的命令,而不是之前输出的内容。 - -在 Linux 中,有许多可以用来记录终端活动的实用工具。 - -这种工具将会帮助我们记录用户在终端中的活动,并帮助我们识别输出中有用的信息。 +在 Linux 中,有许多可以用来记录终端活动的实用工具。这种工具将会帮助我们记录用户在终端中的活动,并帮助我们识别输出中有用的信息。 在这之前,我们已经介绍了一些这类实用工具了。今天,让我们接着讨论这类工具。 -如果你希望尝试其它一些记录你终端活动的工具,我推荐你试试 **[Script Command][1]** 和 **[Terminalizer Tool][2]**。 +如果你希望尝试其它一些记录你终端活动的工具,我推荐你试试 [script][1] 命令和 [Terminalizer][2] 工具。`script` 是在无头服务器中记录终端活动的最佳方式之一。`script` 是一个记录在终端中输入过的 Unix 命令的实用工具(在某些终端中,它会记录显示在你终端中的所有东西)。它会在当前工作目录下以文本文件方式储存所有终端输出。 -不过,如果你在寻找 **[GIF 录制器][3]** ,你可以尝试 **[Gifine][4]** 、**[Kgif][5]** 和 **[Peek][6]** 。 - -脚本是在无头服务器中记录终端活动的最佳方式之一。 - -脚本是记录在终端中输入过的 Unix 命令的实用工具(在某些终端中,它会记录显示在你终端中的所有东西)。 - -它会在当前工作目录下以文本文件方式储存所有终端输出。 +不过,如果你在寻找 [GIF 录制器][3] ,你可以尝试 [Gifine][4]、[Kgif][5] 和 [Peek][6]。 ### 什么是 Termtosvg @@ -36,47 +26,47 @@ Termtosvg 是一个用 Python 编写的 Unix 终端录制器,它可以将你 ### Termtosvg 的特点 - * 可以制作用于某个项目主页且简洁美观的动画。 + * 可以制作嵌入于项目主页的简洁美观的动画。 * 可以在 SVG 模板中自定义配色、终端 UI 和动画。 * 兼容 asciinema 录制格式。 * 要求 Python 版本为 3.5 或更高。 ### 如何在 Linux 中安装 Termtosvg -它是用 Python 编写的,所以我推荐使用 pip 来安装它。 +它是用 Python 编写的,所以我推荐使用 `pip` 来安装它。 -请确保你已经安装了 **python-pip** 包。如果你还没安装,请输入下面的命令。 -对于 Debian 或 Ubuntu 用户,请使用 **[apt][7]** 或 **[apt-get][8]** 来安装 pip。 +请确保你已经安装了 python-pip 包。如果你还没安装,请输入下面的命令。 +对于 Debian 或 Ubuntu 用户,请使用 [apt][7] 或 [apt-get][8] 来安装 `pip`。 ```shell sudo apt install python-pip ``` -对于 Archlinux 用户,请使用 **[pacman][9]** 来安装 pip。 +对于 Archlinux 用户,请使用 [pacman][9] 来安装 `pip`。 ```shell sudo pacman -S python-pip ``` -对于 Fedora 用户,请使用 **[dnf][10]** 来安装 pip。 +对于 Fedora 用户,请使用 [dnf][10] 来安装 `pip`。 ```shell sudo dnf install python-pip ``` -对于 CentOS 或 RHEL 用户,请使用 **[yum][11]** 来安装 pip。 +对于 CentOS 或 RHEL 用户,请使用 [yum][11] 来安装 `pip`。 ```shell sudo yum install python-pip ``` -对于 openSUSE 用户,请使用 **[zypper][12]** 来安装 pip。 +对于 openSUSE 用户,请使用 [zypper][12] 来安装 `pip`。 ```shell sudo zypper install python-pip ``` -最后,请执行 **[pip][13]** 来安装 Termtosvg。 +最后,请执行 [pip][13] 来安装 Termtosvg。 ```shell sudo pip3 install termtosvg pyte python-xlib svgwrite From 06c95a5cb1d5ea9416f0f6fce78e8884ed09e444 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 14 Jan 2019 12:13:41 +0800 Subject: [PATCH 304/322] PUB:20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md @zhs852 https://linux.cn/article-10441-1.html --- ...ecord Your Terminal Sessions As SVG Animations In Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md (98%) diff --git a/translated/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md b/published/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md similarity index 98% rename from translated/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md rename to published/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md index 748f678a5d..eb125ef003 100644 --- a/translated/tech/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md +++ b/published/20181218 Termtosvg - Record Your Terminal Sessions As SVG Animations In Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (zhs852) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-10441-1.html) [#]: subject: (Termtosvg – Record Your Terminal Sessions As SVG Animations In Linux) [#]: via: (https://www.2daygeek.com/termtosvg-record-your-terminal-sessions-as-svg-animations-in-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) From 5e048ce0e696646c7815432b3d95fbf7e416be3b Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Mon, 14 Jan 2019 12:21:38 +0800 Subject: [PATCH 305/322] Translating by qhwdw --- ...0120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md b/sources/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md index 9442a67708..fbdba984c3 100644 --- a/sources/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md +++ b/sources/tech/20120202 Computer Laboratory - Raspberry Pi- Lesson 2 OK02.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (qhwdw) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 8fb0a9e8fe5c2b9bbc95e77bdd19153a2f8f1219 Mon Sep 17 00:00:00 2001 From: runningwater Date: Mon, 14 Jan 2019 17:10:02 +0800 Subject: [PATCH 306/322] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E7=94=B3=E9=A2=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0181220 How To Install Microsoft .NET Core SDK On Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md b/sources/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md index 728db3b7be..e34ecaab9e 100644 --- a/sources/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md +++ b/sources/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (runningwater) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -325,7 +325,7 @@ via: https://www.ostechnix.com/how-to-install-microsoft-net-core-sdk-on-linux/ 作者:[SK][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[runningwater](https://github.com/runningwater) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 6017c1a9b37bdb926ff00c205e484a91c2bf9b64 Mon Sep 17 00:00:00 2001 From: runningwater Date: Mon, 14 Jan 2019 20:31:56 +0800 Subject: [PATCH 307/322] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nstall Microsoft .NET Core SDK On Linux.md | 108 +++++++++--------- 1 file changed, 55 insertions(+), 53 deletions(-) rename {sources => translated}/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md (53%) diff --git a/sources/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md b/translated/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md similarity index 53% rename from sources/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md rename to translated/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md index e34ecaab9e..08b518e442 100644 --- a/sources/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md +++ b/translated/tech/20181220 How To Install Microsoft .NET Core SDK On Linux.md @@ -7,20 +7,20 @@ [#]: via: (https://www.ostechnix.com/how-to-install-microsoft-net-core-sdk-on-linux/) [#]: author: (SK https://www.ostechnix.com/author/sk/) -How To Install Microsoft .NET Core SDK On Linux +如何在 Linux 中安装微软的 .NET Core SDK ====== ![](https://www.ostechnix.com/wp-content/uploads/2018/12/NET-Core-SDK-720x340.png) -The **.NET Core** is a free, cross platform and open source framework developed by Microsoft to build desktop applications, mobile apps, web apps, IoT apps and gaming apps etc. If you’re dotnet developer coming from Windows platform, .NET core helps you to setup your development environment easily on any Linux and Unix-like operating systems. This step by step guide explains how to install Microsoft .NET Core SDK on Linux and how to write your first app using .Net. +**.NET Core** 是微软提供的免费、跨平台和开源的开发框架,可以构建桌面应用程序、移动端应用程序、网络应用程序、物联网应用程序和游戏应用程序等。如果你是 Windows 平台下的 dotnet 开发人员的话,使用 .NET core 可以很轻松就设置好任何 Linux 和类 Unix 操作系统下的开发环境。本分步操作指南文章解释了如何在 Linux 中安装 .NET Core SDK 以及如何使用 .NET 开发出第一个应用程序。 -### Install Microsoft .NET Core SDK On Linux +### Linux 中安装 .NET Core SDK -The .NET core supports GNU/Linux, Mac OS and Windows. .Net core can be installed on popular GNU/Linux operating systems including Debian, Fedora, CentOS, Oracle Linux, RHEL, SUSE/openSUSE, and Ubuntu. As of writing this guide, the latest .NET core version was **2.2**. +.NET Core 支持 GNU/Linux、Mac OS 和 Windows 系统,可以在主流的 GNU/Linux 操作系统上安装运行,包括 Debian、Fedora、CentOS、Oracle Linux、RHEL、SUSE/openSUSE 和 Ubuntu 。在撰写这篇教程时,其最新版本为 **2.2**。 -On **Debian 9** , you can install .NET Core SDK as shown below. +**Debian 9** 系统上安装 .NET Core SDK,请按如下步骤进行。 -First of all, you need to register Microsoft key and add .NET repository by running the following commands: +首先,需要注册微软的密钥,接着把 .NET 源仓库地址添加进来,运行的命令如下: ``` $ wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg @@ -31,16 +31,16 @@ $ sudo chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg $ sudo chown root:root /etc/apt/sources.list.d/microsoft-prod.list ``` -After registering the key and adding the repository, install .NET SDK using commands: +注册好密钥及添加完仓库源后,就可以安装 .NET SDK 了,命令如下: ``` $ sudo apt-get update $ sudo apt-get install dotnet-sdk-2.2 ``` -**On Debian 8:** +**Debian 8 系统上安装:** -Add Microsoft key and enable .NET repository: +增加微软密钥,添加 .NET 仓库源: ``` $ wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg @@ -51,16 +51,16 @@ $ sudo chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg $ sudo chown root:root /etc/apt/sources.list.d/microsoft-prod.list ``` -Install .NET SDK: +安装 .NET SDK: ``` $ sudo apt-get update $ sudo apt-get install dotnet-sdk-2.2 ``` -**On Fedora 28:** +**Fedora 28 系统上安装:** -Add Microsoft key and enable .NET repository: +增加微软密钥,添加 .NET 仓库源: ``` $ sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc @@ -69,14 +69,16 @@ $ sudo mv prod.repo /etc/yum.repos.d/microsoft-prod.repo $ sudo chown root:root /etc/yum.repos.d/microsoft-prod.repo ``` -Now, Install .NET SDK: +现在, 可以安装 .NET SDK 了: ``` $ sudo dnf update $ sudo dnf install dotnet-sdk-2.2 ``` -On **Fedora 27** , add the key and repository using commands: +**Fedora 27 系统下:** + +增加微软密钥,添加 .NET 仓库源,命令如下: ``` $ sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc @@ -85,31 +87,31 @@ $ sudo mv prod.repo /etc/yum.repos.d/microsoft-prod.repo $ sudo chown root:root /etc/yum.repos.d/microsoft-prod.repo ``` -And install .NET SDK using commands: +接着安装 .NET SDK ,命令如下: ``` $ sudo dnf update $ sudo dnf install dotnet-sdk-2.2 ``` -**On CentOS/Oracle Linux:** +**CentOS/Oracle 版本的 Linux 系统上:** -Add Microsoft key and enable .NET core repository: +增加微软密钥,添加 .NET 仓库源,使其可用 ``` $ sudo rpm -Uvh https://packages.microsoft.com/config/rhel/7/packages-microsoft-prod.rpm ``` -Update the repositories and install .NET SDK: +更新源仓库,安装 .NET SDK: ``` $ sudo yum update $ sudo yum install dotnet-sdk-2.2 ``` -**On openSUSE Leap:** +**openSUSE Leap 版本的系统上:** -Add key, enable repository and install necessary dependencies using the following commands: +添加密钥,使仓库源可用,安装必需的依赖包,其命令如下: ``` $ sudo zypper install libicu @@ -119,29 +121,29 @@ $ sudo mv prod.repo /etc/zypp/repos.d/microsoft-prod.repo $ sudo chown root:root /etc/zypp/repos.d/microsoft-prod.repo ``` -Update the repositories and Install .NET SDK using commands: +更新源仓库,安装 .NET SDK,命令如下: ``` $ sudo zypper update $ sudo zypper install dotnet-sdk-2.2 ``` -**On Ubuntu 18.04 LTS:** +**Ubuntu 18.04 LTS 版本的系统上:** -Register the Microsoft key and .NET core repository using commands: +注册微软的密钥和 .NET Core 仓库源,命令如下: ``` $ wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb $ sudo dpkg -i packages-microsoft-prod.deb ``` -Enable ‘Universe’ repository using: +使 ‘Universe’ 仓库可用: ``` $ sudo add-apt-repository universe ``` -Then, install .NET Core SDK using command: +然后,安装 .NET Core SDK ,命令如下: ``` $ sudo apt-get install apt-transport-https @@ -149,16 +151,16 @@ $sudo apt-get update $ sudo apt-get install dotnet-sdk-2.2 ``` -**On Ubuntu 16.04 LTS:** +**Ubuntu 16.04 LTS 版本的系统上:** -Register Microsoft key and .NET repository using commands: +注册微软的密钥和 .NET Core 仓库源,命令如下: ``` $ wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb $ sudo dpkg -i packages-microsoft-prod.deb ``` -And then, Install .NET core SDK: +然后安装 .NET core SDK: ``` $ sudo apt-get install apt-transport-https @@ -166,17 +168,17 @@ $ sudo apt-get update $ sudo apt-get install dotnet-sdk-2.2 ``` -### Create Your First App +### 创建你的第一个应用程序 -We have successfully installed .Net Core SDK in our Linux box. It is time to create our first app using dotnet. +我们已经成功的在 Linux 机器中安装了 .NET Core SDK。是时候使用 dotnet 创建第一个应用程序了。 -For the purpose of this guide, I am going to create a new app called **“ostechnixApp”**. To do so, simply run the following command: +接下来的目的,我们会创建一个名为 **“ostechnixApp”** 的应用程序。为此,可以简单的运行如下命令: ``` $ dotnet new console -o ostechnixApp ``` -**Sample output:** +**简单的输出:** ``` Welcome to .NET Core! @@ -208,9 +210,9 @@ Restore completed in 894.27 ms for /home/sk/ostechnixApp/ostechnixApp.csproj. Restore succeeded. ``` -As you can see in the above output, .Net has created a new application of type console. The parameter -o creates a directory named “ostechnixApp” where you store your app data with all necessary files. +正如上面的输出所示的,.NET 已经为我们创建一个控制台类型的应用程序。`-o` 参数创建了一个名为 “ostechnixApp” 的目录,其包含有存储此应用程序数据所必需的文件。 -Let us switch to ostechnixApp directory and see what’s in there. +让我们切换到 ostechnixApp 目录,看看里面有些什么。 ``` $ cd ostechnixApp/ @@ -218,7 +220,7 @@ $ ls obj ostechnixApp.csproj Program.cs ``` -As you there are three files named **ostechnixApp.csproj** and **Program.cs** and one directory named **obj**. By default, the Program.cs file will contain the code to run the ‘Hello World’ program in the console. Let us have a look at the code. +可以看到有两个名为 **ostechnixApp.csproj** 和 **Program.cs** 的文件,以及一个名为 **ojb** 的目录。默认情况下, `Program.cs` 文件包含有可以在控制台中运行的 'Hello World' 程序代码。可以看看此代码: ``` $ cat Program.cs @@ -236,7 +238,7 @@ namespace ostechnixApp } ``` -To run the newly created app, simply run the following command: +要运行此应用程序,可以简单的使用如下命令: ``` $ dotnet run @@ -245,9 +247,9 @@ Hello World! ![](https://www.ostechnix.com/wp-content/uploads/2018/12/run-dotnet.png) -Simple, isn’t it? Yes, it is! Now, you can write your code in the **Program.cs** file and run it as shown above. +很简单,对吧?是的,就是如此简单。现在你可以在 **Program.cs** 这文件中写上自己的代码,然后像上面所示的执行。 -Alternatively, you can create a new directory, for example mycode, using commands: +或者,你可以创建一个新的目录,如例子所示的 `mycode` 目录,命令如下: ``` $ mkdir ~/.mycode @@ -255,13 +257,13 @@ $ mkdir ~/.mycode $ cd mycode/ ``` -…and make that as your new development environment by running the following command: +然后运行如下命令,使其成为你的新开发环境目录: ``` $ dotnet new console ``` -Sample output: +简单的输出: ``` The template "Console Application" was created successfully. @@ -276,46 +278,46 @@ Restore completed in 331.87 ms for /home/sk/mycode/mycode.csproj. Restore succeeded. ``` -The above command will create two files named **mycode.csproj** and **Program.cs** and one directory named **obj**. Open the Program.cs file in your favorite editor, delete or modify the existing ‘hello world’ code with your own code. +上的命令会创建两个名叫 **mycode.csproj** 和 **Program.cs** 的文件及一个名为 **obj** 的目录。用你喜欢的编辑器打开 `Program.cs` 文件, 删除或修改原来的 'hello world' 代码段,然后编写自己的代码。 -Once the code is written, save and close the Program.cs file and run the app using command: +写完代码,保存,关闭 Program.cs 文件,然后运行此应用程序,命令如下: ``` $ dotnet run ``` -To check the installed .NET core SDK version, simply run: +想要查看安装的 .NET core SDK 的版本的话,可以简单的运行: ``` $ dotnet --version 2.2.101 ``` -To get help, run: +要获得帮助,请运行: ``` $ dotnet --help ``` -### Get Microsoft Visual Studio Code Editor +### 使用微软的 Visual Studio Code 编辑器 -To write the code, you can use your favorite editors of your choice. Microsoft has also its own editor named “ **Microsoft Visual Studio Code** ” with support for .NET. It is an open source, lightweight and powerful source code editor. It comes with built-in support for JavaScript, TypeScript and Node.js and has a rich ecosystem of extensions for other languages (such as C++, C#, Python, PHP, Go) and runtimes (such as .NET and Unity). It is a cross-platform code editor, so you can use it in Microsoft Windows, GNU/Linux, and Mac OS X. You can use it if you’re interested. +要编写代码,你可以任选自己喜欢的编辑器。同时微软自己也有一款支持 .NET 的编辑器,其名为 “ **Microsoft Visual Studio Code** ”。它是一款开源、轻量级、功能强大的源代码编辑器。其内置了对 JavaScript、TypeScript 和 Node.js 的支持,并为其它语言(如 C++、C#、Python、PHP、Go)和运行时态(如 .NET 和 Unity)提供了丰富的扩展,已经形成一个完整的生态系统。它是一款跨平台的代码编辑器,所以在微软的 Windows 系统、GNU/Linux 系统和 Mac OS X 系统都可以使用。如果对其感兴趣,就可以使用。 -To know how to install and use it on Linux, please refer the following guide. +To know how to install and use it on Linux, please refer the following guide.想了解如何在 Linux 上安装和使用,请参阅以下指南。 -[Install Microsoft Visual Studio Code In Linux][3] +[Linux 中安装 Microsoft Visual Studio Code][3] -[**This page**][1] has some basic tutorials to learn .NET Core and .NET Core SDK tools using Visual Studio Code editor. Go and check them to learn more. +关于 Visual Studio Code editor 中 .NET Core 和 .NET Core SDK 工具的使用,[**此网页**][1]有一些基础的教程。想了解更多就去看看吧。 ### Telemetry -By default, the .NET core SDK will collect the usage data using a feature called **‘Telemetry’**. The collected data is anonymous and shared to the development team and community under the [Creative Commons Attribution License][2]. So the .NET team will understand how the tools are used and decide how they can be improved over time. If you don’t want to share your usage information, you can simply opt-out of telemetry by setting the **DOTNET_CLI_TELEMETRY_OPTOUT** environment variable to **‘1’** or **‘true’** using your favorite shell. +默认情况下,.NET core SDK 会采集用户使用情况数据,此功能被称为 **‘Telemetry’**。采集数据是匿名的,并根据[知识共享署名许可][2]分享给其开发团队和社区。因此 .NET 团队会知道这些工具的使用状况,然后根据统计做出决策,改进产品。如果你不想分享自己的使用信息的话,可以使用顺手的 shell 工具把名为 **DOTNET_CLI_TELEMETRY_OPTOUT** 的环境变量参数设置为 **‘1’** 或 **‘true’**,这样就简单的关闭此功能了。 -And, that’s all. You know how to install .NET Core SDK on various Linux platforms and how to create a basic app using it. TO learn more about .NET usage, refer the links given at the end of this guide. +就这样。你已经知道如何在各 Linux 平台上安装 .NET Core SDK 以及知道如何创建基本的应用程序了。想了解更多 .NET 使用知识的话,请参阅此文章末尾给出的链接。 -More good stuffs to come. Stay tuned! +会爆出更多干货的。敬请关注! -Cheers! +祝贺下! From a6400e855fa826c57f4959d04e5659be3598ca4e Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 15 Jan 2019 09:06:22 +0800 Subject: [PATCH 308/322] translated --- ...wers of Linux- 2048 at the command line.md | 52 ------------------- ...wers of Linux- 2048 at the command line.md | 52 +++++++++++++++++++ 2 files changed, 52 insertions(+), 52 deletions(-) delete mode 100644 sources/tech/20181209 Powers of two, powers of Linux- 2048 at the command line.md create mode 100644 translated/tech/20181209 Powers of two, powers of Linux- 2048 at the command line.md diff --git a/sources/tech/20181209 Powers of two, powers of Linux- 2048 at the command line.md b/sources/tech/20181209 Powers of two, powers of Linux- 2048 at the command line.md deleted file mode 100644 index 1c7d61329f..0000000000 --- a/sources/tech/20181209 Powers of two, powers of Linux- 2048 at the command line.md +++ /dev/null @@ -1,52 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Powers of two, powers of Linux: 2048 at the command line) -[#]: via: (https://opensource.com/article/18/12/linux-toy-2048) -[#]: author: (Jason Baker https://opensource.com/users/jason-baker) - -Powers of two, powers of Linux: 2048 at the command line -====== -Looking for a terminal-based game to pass the time? Look no further than 2048-cli. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-2048.png?itok=3M6S-n1a) - -Hello and welcome to today's installment of the Linux command-line toys advent calendar. Every day, we look at a different toy for your terminal: it could be a game or any simple diversion that helps you have fun. - -Maybe you have seen various selections from our calendar before, but we hope there’s at least one new thing for everyone. - -Today's toy is a [command-line version][1] of one of my all-time favorite casual games, [2048][2] (which itself is a clone of another clone). - -To play, you just slide blocks up, down, left, and right to combine matching pairs and increment numbers, until you've made a block that is 2048 in size. The catch (and the challenge), is that you can't just move one block; instead, you move every block on the screen. - -It's simple, fun, and easy to get lost in it for hours. This 2048 clone, [2048-][1][cli][1], is by Marc Tiehuis and written in C, and made available as open source under an MIT license. You can find the source code [on GitHub][1], where you can also get installation instructions for your platform. Since it was packaged for Fedora, for me, installing it was as simple as: - -``` -$ sudo dnf install 2048-cli -``` - -That's it, have fun! - -![](https://opensource.com/sites/default/files/uploads/linux-toy-2048-animated_0.gif) - -Do you have a favorite command-line toy that you think I ought to profile? The calendar for this series is mostly filled out but I've got a few spots left. Let me know in the comments below, and I'll check it out. If there's space, I'll try to include it. If not, but I get some good submissions, I'll do a round-up of honorable mentions at the end. - -Check out yesterday's toy, [Play Tetris at your Linux terminal][3], and check back tomorrow for another! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/linux-toy-2048 - -作者:[Jason Baker][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/jason-baker -[b]: https://github.com/lujun9972 -[1]: https://github.com/tiehuis/2048-cli -[2]: https://github.com/gabrielecirulli/2048 -[3]: https://opensource.com/article/18/12/linux-toy-tetris diff --git a/translated/tech/20181209 Powers of two, powers of Linux- 2048 at the command line.md b/translated/tech/20181209 Powers of two, powers of Linux- 2048 at the command line.md new file mode 100644 index 0000000000..92b87ed8a6 --- /dev/null +++ b/translated/tech/20181209 Powers of two, powers of Linux- 2048 at the command line.md @@ -0,0 +1,52 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Powers of two, powers of Linux: 2048 at the command line) +[#]: via: (https://opensource.com/article/18/12/linux-toy-2048) +[#]: author: (Jason Baker https://opensource.com/users/jason-baker) + +2 的力量,Linux 的力量:终端中的 2048 +====== +正在寻找基于终端的游戏来打发时间么?来看看 2048-cli 吧。 +![](https://opensource.com/sites/default/files/styles/image-full-size/public/uploads/linux-toy-2048.png?itok=3M6S-n1a) + +你好,欢迎来到今天的 Linux 命令行玩具日历。每天,我们会为你的终端带来一个不同的玩具:它可能是一个游戏或任何简单的消遣,可以帮助你获得乐趣。 + +很可能你们中的一些人之前已经看过我们日历中的各种玩具,但我们希望每个人至少见到一件新事物。 + +今天的玩具是我最喜欢的休闲游戏之一 [2048][2] (它本身就是另外一个克隆的克隆)的[命令行版本][1]。 + +要进行游戏,你只需将滑块向上、向下、向左、向右移动,组合成对的数字,并增加数字,直到你得到数字 2048 的块。吸引人的地方(以及挑战)是你不能只移动一个滑块,而是需要移动屏幕上的每一块。 + +它简单、有趣,很容易在里面沉迷几个小时。这个 2048 的克隆 [2048-cli][1] 是 Marc Tiehuis 用 C 编写的,并在 MIT 许可下开源。你可以在 [GitHub][1] 上找到源代码,你也可在这找到适用于你的平台的安装说明。由于它已为 Fedora 打包,因此我来说,安装就像下面那样简单: + +``` +$ sudo dnf install 2048-cli +``` + +这是这样,玩得开心! + +![](https://opensource.com/sites/default/files/uploads/linux-toy-2048-animated_0.gif) + +你有特别喜欢的命令行小玩具需要我介绍的吗?这个系列要介绍的小玩具大部分已经有了落实,但还预留了几个空位置。如果你有特别想了解的可以评论留言,我会查看的。如果还有空位置,我会考虑介绍它的。如果没有,但如果我得到了一些很好的意见,我会在最后做一些有价值的提及。 + +查看昨天的玩具,[在 Linux 终端中玩俄罗斯方块][3],记得明天再来! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/linux-toy-2048 + +作者:[Jason Baker][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jason-baker +[b]: https://github.com/lujun9972 +[1]: https://github.com/tiehuis/2048-cli +[2]: https://github.com/gabrielecirulli/2048 +[3]: https://opensource.com/article/18/12/linux-toy-tetris \ No newline at end of file From bb074365cf0eb88fc5620114f2301461b121564a Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 15 Jan 2019 09:13:49 +0800 Subject: [PATCH 309/322] translating --- ...tarted with Turtl, an open source alternative to Evernote.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md b/sources/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md index 969ef39901..968f3c546a 100644 --- a/sources/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md +++ b/sources/tech/20171206 Getting started with Turtl, an open source alternative to Evernote.md @@ -1,3 +1,5 @@ +translating---geekpi + Getting started with Turtl, an open source alternative to Evernote ====== ![Using Turtl as an open source alternative to Evernote](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUS_brainstorm_island_520px.png?itok=6IUPyxkY) From af3e74a5d7a8b9197589a224b9a932237433fb0c Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 15 Jan 2019 10:15:11 +0800 Subject: [PATCH 310/322] PRF:20180503 11 Methods To Find System-Server Uptime In Linux.md @LuuMing --- ...s To Find System-Server Uptime In Linux.md | 122 ++++++++---------- 1 file changed, 55 insertions(+), 67 deletions(-) diff --git a/translated/tech/20180503 11 Methods To Find System-Server Uptime In Linux.md b/translated/tech/20180503 11 Methods To Find System-Server Uptime In Linux.md index 68ca8a1371..865ee538df 100644 --- a/translated/tech/20180503 11 Methods To Find System-Server Uptime In Linux.md +++ b/translated/tech/20180503 11 Methods To Find System-Server Uptime In Linux.md @@ -1,18 +1,19 @@ Linux 上查看系统/服务器运行时间的 11 种方法 ====== -你是否想知道自己的 Linux 系统除宕机外正常运行了多长时间?系统什么时候启动以及现在的日期? + +你是否想知道自己的 Linux 系统正常运行了多长时间而没有宕机?系统是什么时候启动的? Linux 上有多个查看服务器/系统运行时间的命令,大多数用户喜欢使用标准并且很有名的 `uptime` 命令获取这些具体的信息。 服务器的运行时间对一些用户来说不那么重要,但是当服务器运行诸如在线商城门户portal、网上银行门户等关键任务应用mission-critical applications时,它对于服务器管理员server adminstrators来说就至关重要。 -它必须做到 0 宕机,因为一旦停机就会影响到数百万用户。 +它必须做到零宕机,因为一旦停机就会影响到数百万用户。 正如我所说,许多命令都可以让用户看到 Linux 服务器的运行时间。在这篇教程里我会教你如何使用下面 11 种方式来查看。 正常运行时间uptime指的是服务器自从上次关闭或重启以来经过的时间。 -`uptime` 命令获取 `/proc` 文件中的详细信息并输出正常运行时间,`/proc` 文件不能直接读取。 +`uptime` 命令获取 `/proc` 文件中的详细信息并输出正常运行时间,而 `/proc` 文件并不适合人直接看。 以下这些命令会输出系统运行和启动的时间。也会显示一些额外的信息。 @@ -20,48 +21,47 @@ Linux 上有多个查看服务器/系统运行时间的命令,大多数用户 `uptime` 命令会告诉你系统运行了多长时间。它会用一行显示以下信息。 -当前时间,系统运行时间,当前登录用户的数量,过去 1 分钟、5 分钟、15 分钟系统负载的均值。 +当前时间、系统运行时间、当前登录用户的数量、过去 1 分钟/5 分钟/15 分钟系统负载的均值。 ``` # uptime - 08:34:29 up 21 days, 5:46, 1 user, load average: 0.06, 0.04, 0.00 - + 08:34:29 up 21 days, 5:46, 1 user, load average: 0.06, 0.04, 0.00 ``` ### 方法 2:使用 w 命令 -`w` 命令为每个登录进系统的用户,每个用户当前所做的事情,所有活动的负载对计算机的影响提供了一个快速的概要。这个单一命令结合了多个 Unix 程序:who,uptime,和 ps -a。 +`w` 命令为每个登录进系统的用户,每个用户当前所做的事情,所有活动的负载对计算机的影响提供了一个快速的概要。这个单一命令结合了多个 Unix 程序:`who`、`uptime`,和 `ps -a` 的结果。 + ``` # w - 08:35:14 up 21 days, 5:47, 1 user, load average: 0.26, 0.09, 0.02 -USER TTY FROM [email protected] IDLE JCPU PCPU WHAT -root pts/1 103.5.134.167 08:34 0.00s 0.01s 0.00s w - + 08:35:14 up 21 days, 5:47, 1 user, load average: 0.26, 0.09, 0.02 +USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT +root pts/1 103.5.134.167 08:34 0.00s 0.01s 0.00s w ``` ### 方法 3:使用 top 命令 -`top` 命令是 Linux 上监视实时系统进程的基础命令之一。它显示系统信息和运行进程的信息,例如正常运行时间,平均负载,运行的任务,登录用户数量,CPU 数量 & CPU 利用率,内存 & 交换空间信息。 +`top` 命令是 Linux 上监视实时系统进程的基础命令之一。它显示系统信息和运行进程的信息,例如正常运行时间、平均负载、运行的任务、登录用户数量、CPU 数量 & CPU 利用率、内存 & 交换空间信息。 **推荐阅读:**[TOP 命令监视服务器性能的例子][1] + ``` # top -c -top - 08:36:01 up 21 days, 5:48, 1 user, load average: 0.12, 0.08, 0.02 -Tasks: 98 total, 1 running, 97 sleeping, 0 stopped, 0 zombie -Cpu(s): 0.0%us, 0.3%sy, 0.0%ni, 99.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st -Mem: 1872888k total, 1454644k used, 418244k free, 175804k buffers -Swap: 2097148k total, 0k used, 2097148k free, 1098140k cached - - PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND - 1 root 20 0 19340 1492 1172 S 0.0 0.1 0:01.04 /sbin/init - 2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 [kthreadd] - 3 root RT 0 0 0 0 S 0.0 0.0 0:00.00 [migration/0] - 4 root 20 0 0 0 0 S 0.0 0.0 0:34.32 [ksoftirqd/0] - 5 root RT 0 0 0 0 S 0.0 0.0 0:00.00 [stopper/0] +top - 08:36:01 up 21 days, 5:48, 1 user, load average: 0.12, 0.08, 0.02 +Tasks: 98 total, 1 running, 97 sleeping, 0 stopped, 0 zombie +Cpu(s): 0.0%us, 0.3%sy, 0.0%ni, 99.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st +Mem: 1872888k total, 1454644k used, 418244k free, 175804k buffers +Swap: 2097148k total, 0k used, 2097148k free, 1098140k cached + PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND + 1 root 20 0 19340 1492 1172 S 0.0 0.1 0:01.04 /sbin/init + 2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 [kthreadd] + 3 root RT 0 0 0 0 S 0.0 0.0 0:00.00 [migration/0] + 4 root 20 0 0 0 0 S 0.0 0.0 0:34.32 [ksoftirqd/0] + 5 root RT 0 0 0 0 S 0.0 0.0 0:00.00 [stopper/0] ``` ### 方法 4:使用 who 命令 @@ -70,20 +70,16 @@ Swap: 2097148k total, 0k used, 2097148k free, 1098140k cached ``` # who -b - system boot 2018-04-12 02:48 - ``` ### 方法 5:使用 last 命令 -`last` 命令列出最近登录过的用户。`last` 往回查找 `/var/log/wtmp` 文件并显示自从文件创建后登录进(出)的用户。 +`last` 命令列出最近登录过的用户。`last` 回溯 `/var/log/wtmp` 文件并显示自从文件创建后登录进(出)的用户。 ``` # last reboot -F | head -1 | awk '{print $5,$6,$7,$8,$9}' - Thu Apr 12 02:48:04 2018 - ``` ### 方法 6:使用 /proc/uptime 文件 @@ -94,9 +90,7 @@ Thu Apr 12 02:48:04 2018 ``` # cat /proc/uptime - 1835457.68 1809207.16 - ``` ### 方法 7:使用 tuptime 命令 @@ -105,60 +99,58 @@ Thu Apr 12 02:48:04 2018 ``` $ tuptime - ``` ### 方法 8:使用 htop 命令 -`htop` 是运行在 Linux 上一个由 Hisham 使用 ncurses 库开发的交互式进程查看器。`htop` 比起 `top` 有很多的特性和选项。 +`htop` 是运行在 Linux 上的一个交互式进程查看器,是 Hisham 使用 ncurses 库开发的。`htop` 比起 `top` 有很多的特性和选项。 **推荐阅读:** [使用 Htop 命令监控系统资源][2] ``` # htop - CPU[| 0.5%] Tasks: 48, 5 thr; 1 running - Mem[||||||||||||||||||||||||||||||||||||||||||||||||||| 165/1828MB] Load average: 0.10 0.05 0.01 - Swp[ 0/2047MB] Uptime: 21 days, 05:52:35 - - PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command -29166 root 20 0 110M 2484 1240 R 0.0 0.1 0:00.03 htop -29580 root 20 0 11464 3500 1032 S 0.0 0.2 55:15.97 /bin/sh ./OSWatcher.sh 10 1 - 1 root 20 0 19340 1492 1172 S 0.0 0.1 0:01.04 /sbin/init - 486 root 16 -4 10780 900 348 S 0.0 0.0 0:00.07 /sbin/udevd -d - 748 root 18 -2 10780 932 360 S 0.0 0.0 0:00.00 /sbin/udevd -d + CPU[| 0.5%] Tasks: 48, 5 thr; 1 running + Mem[||||||||||||||||||||||||||||||||||||||||||||||||||| 165/1828MB] Load average: 0.10 0.05 0.01 + Swp[ 0/2047MB] Uptime: 21 days, 05:52:35 + PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command +29166 root 20 0 110M 2484 1240 R 0.0 0.1 0:00.03 htop +29580 root 20 0 11464 3500 1032 S 0.0 0.2 55:15.97 /bin/sh ./OSWatcher.sh 10 1 + 1 root 20 0 19340 1492 1172 S 0.0 0.1 0:01.04 /sbin/init + 486 root 16 -4 10780 900 348 S 0.0 0.0 0:00.07 /sbin/udevd -d + 748 root 18 -2 10780 932 360 S 0.0 0.0 0:00.00 /sbin/udevd -d ``` ### 方法 9:使用 glances 命令 -`glances` 是一个跨平台基于 curses 使用 python 写的监控工具。我们可以说它非常强大,仅用一点空间就能获得很多信息。它使用 psutil 库从系统中获取信息。 +`glances` 是一个跨平台的基于 curses 库的监控工具,它是使用 python 编写的。可以说它非常强大,仅用一点空间就能获得很多信息。它使用 psutil 库从系统中获取信息。 -`glances` 可以监控 CPU,内存,负载,进程,网络接口,磁盘 I/O,磁盘阵列RAID,传感器,文件系统(与文件夹),容器,显示器,Alert 日志,系统信息,运行时间,快速查看Quicklook(CPU,内存等)。 +`glances` 可以监控 CPU、内存、负载、进程、网络接口、磁盘 I/O、磁盘阵列RAID、传感器、文件系统(与文件夹)、容器、监视器、Alert 日志、系统信息、运行时间、快速查看Quicklook(CPU,内存、负载)等。 **推荐阅读:** [Glances (集大成)– Linux 上高级的实时系统运行监控工具][3] + ``` glances -ubuntu (Ubuntu 17.10 64bit / Linux 4.13.0-37-generic) - IP 192.168.1.6/24 Uptime: 21 days, 05:55:15 +ubuntu (Ubuntu 17.10 64bit / Linux 4.13.0-37-generic) - IP 192.168.1.6/24 Uptime: 21 days, 05:55:15 -CPU [|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 90.6%] CPU - 90.6% nice: 0.0% ctx_sw: 4K MEM \ 78.4% active: 942M SWAP - 5.9% LOAD 2-core -MEM [||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 78.0%] user: 55.1% irq: 0.0% inter: 1797 total: 1.95G inactive: 562M total: 12.4G 1 min: 4.35 -SWAP [|||| 5.9%] system: 32.4% iowait: 1.8% sw_int: 897 used: 1.53G buffers: 14.8M used: 749M 5 min: 4.38 - idle: 7.6% steal: 0.0% free: 431M cached: 273M free: 11.7G 15 min: 3.38 - -NETWORK Rx/s Tx/s TASKS 211 (735 thr), 4 run, 207 slp, 0 oth sorted automatically by memory_percent, flat view -docker0 0b 232b -enp0s3 12Kb 4Kb Systemd 7 Services loaded: 197 active: 196 failed: 1 -lo 616b 616b -_h478e48e 0b 232b CPU% MEM% VIRT RES PID USER NI S TIME+ R/s W/s Command - 63.8 18.9 2.33G 377M 2536 daygeek 0 R 5:57.78 0 0 /usr/lib/firefox/firefox -contentproc -childID 1 -isForBrowser -intPrefs 6:50|7:-1|19:0|34:1000|42:20|43:5|44:10|51 -DefaultGateway 83ms 78.5 10.9 3.46G 217M 2039 daygeek 0 S 21:07.46 0 0 /usr/bin/gnome-shell - 8.5 10.1 2.32G 201M 2464 daygeek 0 S 8:45.69 0 0 /usr/lib/firefox/firefox -new-window -DISK I/O R/s W/s 1.1 8.5 2.19G 170M 2653 daygeek 0 S 2:56.29 0 0 /usr/lib/firefox/firefox -contentproc -childID 4 -isForBrowser -intPrefs 6:50|7:-1|19:0|34:1000|42:20|43:5|44:10|51 -dm-0 0 0 1.7 7.2 2.15G 143M 2880 daygeek 0 S 7:10.46 0 0 /usr/lib/firefox/firefox -contentproc -childID 6 -isForBrowser -intPrefs 6:50|7:-1|19:0|34:1000|42:20|43:5|44:10|51 -sda1 9.46M 12K 0.0 4.9 1.78G 97.2M 6125 daygeek 0 S 1:36.57 0 0 /usr/lib/firefox/firefox -contentproc -childID 7 -isForBrowser -intPrefs 6:50|7:-1|19:0|34:1000|42:20|43:5|44:10|51 +CPU [|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 90.6%] CPU - 90.6% nice: 0.0% ctx_sw: 4K MEM \ 78.4% active: 942M SWAP - 5.9% LOAD 2-core +MEM [||||||||||||||||||||||||||||||||||||||||||||||||||||||||| 78.0%] user: 55.1% irq: 0.0% inter: 1797 total: 1.95G inactive: 562M total: 12.4G 1 min: 4.35 +SWAP [|||| 5.9%] system: 32.4% iowait: 1.8% sw_int: 897 used: 1.53G buffers: 14.8M used: 749M 5 min: 4.38 + idle: 7.6% steal: 0.0% free: 431M cached: 273M free: 11.7G 15 min: 3.38 +NETWORK Rx/s Tx/s TASKS 211 (735 thr), 4 run, 207 slp, 0 oth sorted automatically by memory_percent, flat view +docker0 0b 232b +enp0s3 12Kb 4Kb Systemd 7 Services loaded: 197 active: 196 failed: 1 +lo 616b 616b +_h478e48e 0b 232b CPU% MEM% VIRT RES PID USER NI S TIME+ R/s W/s Command + 63.8 18.9 2.33G 377M 2536 daygeek 0 R 5:57.78 0 0 /usr/lib/firefox/firefox -contentproc -childID 1 -isForBrowser -intPrefs 6:50|7:-1|19:0|34:1000|42:20|43:5|44:10|51 +DefaultGateway 83ms 78.5 10.9 3.46G 217M 2039 daygeek 0 S 21:07.46 0 0 /usr/bin/gnome-shell + 8.5 10.1 2.32G 201M 2464 daygeek 0 S 8:45.69 0 0 /usr/lib/firefox/firefox -new-window +DISK I/O R/s W/s 1.1 8.5 2.19G 170M 2653 daygeek 0 S 2:56.29 0 0 /usr/lib/firefox/firefox -contentproc -childID 4 -isForBrowser -intPrefs 6:50|7:-1|19:0|34:1000|42:20|43:5|44:10|51 +dm-0 0 0 1.7 7.2 2.15G 143M 2880 daygeek 0 S 7:10.46 0 0 /usr/lib/firefox/firefox -contentproc -childID 6 -isForBrowser -intPrefs 6:50|7:-1|19:0|34:1000|42:20|43:5|44:10|51 +sda1 9.46M 12K 0.0 4.9 1.78G 97.2M 6125 daygeek 0 S 1:36.57 0 0 /usr/lib/firefox/firefox -contentproc -childID 7 -isForBrowser -intPrefs 6:50|7:-1|19:0|34:1000|42:20|43:5|44:10|51 ``` ### 方法 10:使用 stat 命令 @@ -167,9 +159,7 @@ sda1 9.46M 12K 0.0 4.9 1.78G 97.2M 6125 daygeek 0 S 1:36.57 0 0 /usr/lib/firefox ``` # stat /var/log/dmesg | grep Modify - Modify: 2018-04-12 02:48:04.027999943 -0400 - ``` ### 方法 11:使用 procinfo 命令 @@ -178,9 +168,7 @@ Modify: 2018-04-12 02:48:04.027999943 -0400 ``` # procinfo | grep Bootup - Bootup: Fri Apr 20 19:40:14 2018 Load average: 0.16 0.05 0.06 1/138 16615 - ``` -------------------------------------------------------------------------------- @@ -190,7 +178,7 @@ via: https://www.2daygeek.com/11-methods-to-find-check-system-server-uptime-in-l 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[LuuMing](https://github.com/LuuMing) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From b63d6cf18dc8c94325c341efaf187d4c111ada24 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 15 Jan 2019 10:15:28 +0800 Subject: [PATCH 311/322] PUB:20180503 11 Methods To Find System-Server Uptime In Linux.md @LuuMing https://linux.cn/article-10443-1.html --- .../20180503 11 Methods To Find System-Server Uptime In Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180503 11 Methods To Find System-Server Uptime In Linux.md (100%) diff --git a/translated/tech/20180503 11 Methods To Find System-Server Uptime In Linux.md b/published/20180503 11 Methods To Find System-Server Uptime In Linux.md similarity index 100% rename from translated/tech/20180503 11 Methods To Find System-Server Uptime In Linux.md rename to published/20180503 11 Methods To Find System-Server Uptime In Linux.md From ad4111fd95c4bb3a85be8d8b89725a1de19bcc82 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 10:48:38 +0800 Subject: [PATCH 312/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20XML=20vs=20JSON?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/talk/20150513 XML vs JSON.md | 107 +++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 sources/talk/20150513 XML vs JSON.md diff --git a/sources/talk/20150513 XML vs JSON.md b/sources/talk/20150513 XML vs JSON.md new file mode 100644 index 0000000000..d3928daa83 --- /dev/null +++ b/sources/talk/20150513 XML vs JSON.md @@ -0,0 +1,107 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (XML vs JSON) +[#]: via: (https://www.cs.tufts.edu/comp/150IDS/final_papers/tstras01.1/FinalReport/FinalReport.html#xml-advantages) +[#]: author: (TOM STRASSNER tomstrassner@gmail.com) + +XML vs JSON +====== + +### Introduction + +XML and JSON are the two most common formats for data interchange in the Web today. XML was created by the W3C in 1996, and JSON was publicly specified by Douglas Crockford in 2002. Although their purposes are not identical, they are frequently used to accomplish the same task, which is data interchange. Both have well-documented open standards on the Web ([RFC 7159][1], [RFC 4825][2]), and both are human and machine-readable. Neither one is absolutely superior to the other, as each is better suited for different use cases. + +### XML Advantages + +There are several advantages that XML has over JSON. One of the biggest differences between the two is that in XML you can put metadata into the tags in the form of attributes. With JSON, the programmer could accomplish the same goal that metadata achieves by making the entity an object and adding the attributes as members of the object. However, the way XML does it may often be preferable, given the slightly misleading nature of turning something into an object that is not one in the client program. For example, if your C++ program sends an int via JSON and needs metadata to be sent along with it, you would have to make it an object, with one name/value pair for the actual value of the int, and more name/value pairs for each attribute. The program that receives the JSON would read it as an object, when in fact it is not one. While this is a viable solution, it defies one of JSON’s key advantages: “JSON's structures look like conventional programming language structures. No restructuring is necessary.”[2] + +Although I will argue later that this can also be a drawback of XML, its mechanism to resolve name conflicts, prefixes, gives it power that JSON does not have. With prefixes, the programmer has the ability to name two different kinds of entities the same thing.[1] This would be advantageous in situations where the different entities should have the same name in the client program, perhaps if they are used in entirely different scopes. + +Another advantage of XML is that most browsers render it in a highly readable and organized way. The tree structure of XML lends itself well to this formatting, and allows for browsers to let users to naturally collapse individual tree elements. This feature would be particularly useful in debugging. + +One of the most significant advantages that XML has over JSON is its ability to communicate mixed content, i.e. strings that contain structured markup. In order to handle this with XML, the programmer need only put the marked-up text within a child tag of the parent in which it belongs. Similar to the metadata situation, since JSON only contains data, there is no such simple way to indicate markup. It would again require storing metadata as data, which could be considered an abuse of the format. + +### JSON Advantages + +JSON has several advantages as well. One of the most obvious of these is that JSON is significantly less verbose than XML, because XML necessitates opening and closing tags (or in some cases less verbose self-closing tags), and JSON uses name/value pairs, concisely delineated by “{“ and “}” for objects, “[“ and “]” for arrays, “,” to separate pairs, and “:” to separate name from value. Even when zipped (using gzip), JSON is still smaller and it takes less time to zip it.[6] As determined by Sumaray and Makki as well as Nurseitov, Paulson, Reynolds, and Izurieta in their experimental findings, JSON outperforms XML in a number of ways. First, naturally following from its conciseness, JSON files that contain the same information as their XML counterparts are almost always significantly smaller, which leads to faster transmission and processing. Second, difference in size aside, both groups found that JSON was serialized and deserialized drastically faster than XML.[3][4] Third, the latter study determined that JSON processing outdoes XML in CPU resource utilization. They found that JSON used less total resources, more user CPU, and less system CPU. The experiment used RedHat machines, and RedHat claims that higher user CPU usage is preferable.[3] Unsurprisingly, the Sumaray and Makki study determined that JSON performance is superior to XML on mobile devices too.[4] This makes sense, given that JSON uses less resources, and mobile devices are less powerful than desktop machines. + +Yet another advantage that JSON has over XML is that its representation of objects and arrays allows for direct mapping onto the corresponding data structures in the host language, such as objects, records, structs, dictionaries, hash tables, keyed lists, and associative arrays for objects, and arrays, vectors, lists, and sequences for arrays.[2] Although it is perfectly possible to represent these structures in XML, it is only as a function of the parsing, and it takes more code to serialize and deserialize properly. It also would not always be obvious to the reader of arbitrary XML what tags represent an object and what tags represent an array, especially because nested tags can just as easily be structured markup instead. The curly braces and brackets of JSON definitively show the structure of the data. However, this advantage does come with the caveat explained above, that the JSON can inaccurately represent the data if the need arises to send metadata. + +Although XML supports namespaces and prefixes, JSON’s handling of name collisions is less verbose than prefixes, and arguably feels more natural with the program using it; in JSON, each object is its own namespace, so names may be repeated as long as they are in different scopes. This may be preferable, as in most programming languages members of different objects can have the same name, because they are distinguished by the names of the objects to which they belong. + +Perhaps the most significant advantage that JSON has over XML is that JSON is a subset of JavaScript, so code to parse and package it fits very naturally into JavaScript code. This seems highly beneficial for JavaScript programs, but does not directly benefit any programs that use languages other than JavaScript. However, this drawback has been largely overcome, as currently the JSON website lists over 175 tools for 64 different programming languages that exist to integrate JSON processing. While I cannot speak to the quality of most of these tools, it is clear that the developer community has embraced JSON and has made it simple to use in many different platforms. + +### Purposes + +Simply put, XML’s purpose is document markup. This is decidedly not a purpose of JSON, so XML should be used whenever this is what needs to be done. It accomplishes this purpose by giving semantic meaning to text through its tree-like structure and ability to represent mixed content. Data structures can be represented in XML, but that is not its purpose. + +JSON’s purpose is structured data interchange. It serves this purpose by directly representing objects, arrays, numbers, strings, and booleans. Its purpose is distinctly not document markup. As described above, JSON does not have a natural way to represent mixed content. + +### Software + +The following major public APIs uses XML only: Amazon Product Advertising API. + +The following major APIs use JSON only: Facebook Graph API, Google Maps API, Twitter API, AccuWeather API, Pinterest API, Reddit API, Foursquare API. + +The following major APIs use both XML and JSON: Google Cloud Storage, Linkedin API, Flickr API + +Of the top 10 most popular APIs according to Programmable Web[9], along with a couple more popular ones, only one supports XML and not JSON. Several support both, and several support only JSON. Among developer APIs for modern and popular websites, JSON clearly seems to be preferred. This also indicates that more app developers that use these APIs prefer JSON. This is likely a result of its reputation as the faster and leaner of the two. Furthermore, most of these APIs communicate data rather than documents, so JSON would be more appropriate. For example, Facebook is mainly concerned with communicating data about users and posts, Google Maps deals in coordinates and information about entities on their maps, and AccuWeather just sends weather data. Overall, it is impossible to say whether JSON or XML is currently used more in APIs, but the trend is certainly swinging towards JSON.[10][11] + +The following major desktop software uses XML only: Microsoft Word, Apache OpenOffice, LibreOffice. + +It makes sense for software that is mainly concerned with document creation, manipulation, and storage to use XML rather than JSON. Also, all three of these programs support mixed content, which JSON does not do well. For example, if a user is typing up an essay in Microsoft Word, they may put different font, size, color, positioning, and styling on different blocks of text. XML naturally represents these properties with nested tags and attributes. + +The following major databases support XML: IBM DB2, Microsoft SQL Server, Oracle Database, PostgresSQL, BaseX, eXistDB, MarkLogic, MySQL. + +The following major databases support JSON: MongoDB, CouchDB, eXistDB, Elastisearch, BaseX, MarkLogic, OrientDB, Oracle Database, PostgresSQL, Riak. + +For a long time, SQL and the relational database model dominated the market. Corporate giants like Oracle and Microsoft have always marketed such databases. However, in the last decade, there has been a major rise in popularity of NoSQL databases. As this has coincided with the rise of JSON, most NoSQL databases support JSON, and some, such as MongoDB, CouchDB, and Riak use JSON to store their data. These databases have two important qualities that make them better suited for modern websites: they are generally more scalable than relational SQL databases, and they are designed to the core to run in the Web.[10] Since JSON is more lightweight and a subset of JavaScript, it suits NoSQL databases well, and helps facilitate these two qualities. In addition, many older databases have added support for JSON, such as Oracle Database and PostgresSQL. Conversion between XML and JSON is a hassle, so naturally, as more developers use JSON for their apps, more database companies have incentive to support it.[7] + +### Future + +One of the most heavily anticipated changes in the Internet is the “Internet of Things”, i.e. the addition to the Internet of non-computer devices such as watches, thermostats, televisions, refrigerators, etc. This movement is well underway, and is expected to explode in the near future, as predictions for the number of devices in the Internet of Things in 2020 range from about 26 billion to 200 billion.[12][13][13] Almost all of these devices are smaller and less powerful than laptop and desktop computers. Many of them only run embedded systems. Thus, when they have the need to exchange data with other entities in the Web, the lighter and faster JSON would naturally be preferable to XML.[10] Also, with the recent rapid rise of JSON use in the Web relative to XML, new devices may benefit more from speaking JSON. This highlights an example of Metcalf’s Law; whether XML or JSON or something entirely new becomes the most popular format in the Web, newly added devices and all existing devices will benefit much more if the newly added devices speak the most popular language. + +With the creation and recent rapid increase in popularity of Node.js, a server-side JavaScript framework, along with NoSQL databases like MongoDB, full-stack JavaScript development has become a reality. This bodes well for the future of JSON, as with these new apps, JSON is spoken at every level of the stack, which generally makes the apps very fast and lightweight. This is a desirable trait for any app, so this trend towards full-stack JavaScript is not likely to die out anytime soon.[10] + +Another existing trend in the world of app development is toward REST and away from SOAP.[11][15][16] Both XML and JSON can be used with REST, but SOAP exclusively uses XML. + +The given trends indicate that JSON will continue to dominate the Web, and XML use will continue to decrease. This should not be overblown, however, because XML is still very heavily used in the Web, and it is the only option for apps that use SOAP. Given the widespread migration from SOAP to REST, the rise of NoSQL databases and full-stack JavaScript, and the far superior performance of JSON, I believe that JSON will soon be much more widely used than XML in the Web. There seem to be very few applications where XML is the better choice. + +### References + +1. [XML Tutorial](http://www.w3schools.com/xml/default.asp) +2. [Introducing JSON](http://www.json.org/) +3. [Comparison of JSON and XML Data Interchange Formats: A Case Study](http://www.cs.montana.edu/izurieta/pubs/caine2009.pdf) +4. [A comparison of data serialization formats for optimal efficiency on a mobile platform](http://dl.acm.org/citation.cfm?id=2184810) +5. [JSON vs. XML: The Debate](http://ajaxian.com/archives/json-vs-xml-the-debate) +6. [JSON vs. XML: Some hard numbers about verbosity](http://www.codeproject.com/Articles/604720/JSON-vs-XML-Some-hard-numbers-about-verbosity) +7. [How JSON sparked NoSQL -- and will return to the RDBMS fold](http://www.infoworld.com/article/2608293/nosql/how-json-sparked-nosql----and-will-return-to-the-rdbms-fold.html) +8. [Did You Say "JSON Support" in Oracle 12.1.0.2?](https://blogs.oracle.com/OTN-DBA-DEV-Watercooler/entry/did_you_say_json_support) +9. [Most Popular APIs: At Least One Will Surprise You](http://www.programmableweb.com/news/most-popular-apis-least-one-will-surprise-you/2014/01/23) +10. [Why JSON will continue to push XML out of the picture](https://www.centurylinkcloud.com/blog/post/why-json-will-continue-to-push-xml-out-of-the-picture/) +11. [Thousands of APIs Paint a Bright Future for the Web](http://www.webmonkey.com/2011/03/thousand-of-apis-paint-a-bright-future-for-the-web/) +12. [A Simple Explanation Of 'The Internet Of Things’](http://www.forbes.com/sites/jacobmorgan/2014/05/13/simple-explanation-internet-things-that-anyone-can-understand/) +13. [Proofpoint Uncovers Internet of Things (IoT) Cyberattack](http://www.proofpoint.com/about-us/press-releases/01162014.php) +14. [The Internet of Things: New Threats Emerge in a Connected World](http://www.symantec.com/connect/blogs/internet-things-new-threats-emerge-connected-world) +15. [3,000 Web APIs: Trends From A Quickly Growing Directory](http://www.programmableweb.com/news/3000-web-apis-trends-quickly-growing-directory/2011/03/08) +16. [How REST replaced SOAP on the Web: What it means to you](http://www.infoq.com/articles/rest-soap) + + +-------------------------------------------------------------------------------- + +via: https://www.cs.tufts.edu/comp/150IDS/final_papers/tstras01.1/FinalReport/FinalReport.html#xml-advantages + +作者:[TOM STRASSNER][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: tomstrassner@gmail.com +[b]: https://github.com/lujun9972 +[1]: https://tools.ietf.org/html/rfc7159 +[2]: https://tools.ietf.org/html/rfc4825 From 207f93cdf1760f8f86ce4d42e07a4ac04ce0889c Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 10:51:41 +0800 Subject: [PATCH 313/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Turn=20a=20Raspbe?= =?UTF-8?q?rry=20Pi=203B+=20into=20a=20PriTunl=20VPN?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...n a Raspberry Pi 3B- into a PriTunl VPN.md | 113 ++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 sources/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md diff --git a/sources/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md b/sources/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md new file mode 100644 index 0000000000..b7e55e0efb --- /dev/null +++ b/sources/tech/20190114 Turn a Raspberry Pi 3B- into a PriTunl VPN.md @@ -0,0 +1,113 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Turn a Raspberry Pi 3B+ into a PriTunl VPN) +[#]: via: (https://opensource.com/article/19/1/pritunl-vpn-raspberry-pi) +[#]: author: (Stephen Bancroft https://opensource.com/users/stevereaver) + +Turn a Raspberry Pi 3B+ into a PriTunl VPN +====== +PriTunl is a VPN solution for small businesses and individuals who want private access to their network. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/life-raspberrypi_0.png?itok=Kczz87J2) + +[PriTunl][1] is a fantastic VPN terminator solution that's perfect for small businesses and individuals who want a quick and simple way to access their network privately. It's open source, and the basic free version is more than enough to get you started and cover most simple use cases. There is also a paid enterprise version with advanced features like Active Directory integration. + +### Special considerations on Raspberry Pi 3B+ + +PriTunl is generally simple to install, but this project—turning a Raspberry Pi 3B+ into a PriTunl VPN appliance—adds some complexity. For one thing, PriTunl is supplied only as AMD64 and i386 binaries, but the 3B+ uses ARM architecture. This means you must compile your own binaries from source. That's nothing to be afraid of; it can be as simple as copying and pasting a few commands and watching the terminal for a short while. + +Another problem: PriTunl seems to require 64-bit architecture. I found this out when I got errors when I tried to compile PriTunl on my Raspberry Pi's 32-bit operating system. Fortunately, Ubuntu's beta version of 18.04 for ARM64 boots on the Raspberry Pi 3B+. + +Also, the Raspberry Pi 3B+ uses a different bootloader from other Raspberry Pi models. This required a complicated set of steps to install and update the necessary files to get a Raspberry Pi 3B+ to boot. + +### Installing PriTunl + +You can overcome these problems by installing a 64-bit operating system on the Raspberry Pi 3B+ before installing PriTunl. I'll assume you have basic knowledge of how to get around the Linux command line and a Raspberry Pi. + +Start by opening a terminal and downloading the Ubuntu 18.04 ARM64 beta release by entering: + +``` +$ wget http://cdimage.ubuntu.com/releases/18.04/beta/ubuntu-18.04-beta-preinstalled-server-arm64+raspi3.img.xz +``` + +Unpack the download: + +``` +$ xz -d ubuntu-18.04-beta-preinstalled-server-arm64+raspi3.xz +``` + +Insert the SD card you'll use with your Raspberry Pi into your desktop or laptop computer. Your computer will assign the SD card a drive letter—something like **/dev/sda** or **/dev/sdb**. Enter the **dmesg** command and examine the last lines of the output to find out the card's drive assignment. + +**Be VERY CAREFUL with the next step! I can't stress that enough; if you get the drive assignment wrong, you could destroy your system.** + +Write the image to your SD card with the following command, changing **< DRIVE>** to your SD card's drive assignment (obtained in the previous step): + +``` +$ dd if=ubuntu-18.04-beta-preinstalled-server-arm64+raspi3.img of= bs=8M +``` + +After it finishes, insert the SD card into your Pi and power it up. Make sure the Pi is connected to your network, then log in with username/password combination ubuntu/ubuntu. + +Enter the following commands on your Pi to install a few things to prepare to compile PriTunl: + +``` +$ sudo apt-get -y install build-essential git bzr python python-dev python-pip net-tools openvpn bridge-utils psmisc golang-go libffi-dev mongodb +``` + +There are a few changes from the standard PriTunl source [installation instructions on GitHub][2]. Make sure you are logged into your Pi and **sudo** to root: + +``` +$ sudo su - +``` + +This should leave you in root's home directory. To install PriTunl version 1.29.1914.98, enter (per GitHub): + +``` +export VERSION=1.29.1914.98 +tee -a ~/.bashrc << EOF +export GOPATH=\$HOME/go +export PATH=/usr/local/go/bin:\$PATH +EOF +source ~/.bashrc +mkdir pritunl && cd pritunl +go get -u github.com/pritunl/pritunl-dns +go get -u github.com/pritunl/pritunl-web +sudo ln -s ~/go/bin/pritunl-dns /usr/bin/pritunl-dns +sudo ln -s ~/go/bin/pritunl-web /usr/bin/pritunl-web +wget https://github.com/pritunl/pritunl/archive/$VERSION.tar.gz +tar -xf $VERSION.tar.gz +cd pritunl-$VERSION +python2 setup.py build +pip install -r requirements.txt +python2 setup.py install --prefix=/usr/local +``` + +Now the MongoDB and PriTunl systemd units should be ready to start up. Assuming you're still logged in as root, enter: + +``` +systemctl daemon-reload +systemctl start mongodb pritunl +systemctl enable mongodb pritunl +``` + +That's it! You're ready to hit PriTunl's browser user interface and configure it by following PriTunl's [installation and configuration instructions][3] on its website. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/pritunl-vpn-raspberry-pi + +作者:[Stephen Bancroft][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/stevereaver +[b]: https://github.com/lujun9972 +[1]: https://pritunl.com/ +[2]: https://github.com/pritunl/pritunl +[3]: https://docs.pritunl.com/docs/configuration-5 From 47e7bf44c03016b2f3c9f9ab48a536811d3a19e8 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 10:53:40 +0800 Subject: [PATCH 314/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20What=20metrics=20?= =?UTF-8?q?matter:=20A=20guide=20for=20open=20source=20projects?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...atter- A guide for open source projects.md | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 sources/talk/20190111 What metrics matter- A guide for open source projects.md diff --git a/sources/talk/20190111 What metrics matter- A guide for open source projects.md b/sources/talk/20190111 What metrics matter- A guide for open source projects.md new file mode 100644 index 0000000000..1438450a99 --- /dev/null +++ b/sources/talk/20190111 What metrics matter- A guide for open source projects.md @@ -0,0 +1,95 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What metrics matter: A guide for open source projects) +[#]: via: (https://opensource.com/article/19/1/metrics-guide-open-source-projects) +[#]: author: (Gordon Haff https://opensource.com/users/ghaff) + +What metrics matter: A guide for open source projects +====== +5 principles for deciding what to measure. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_data_dashboard_system_computer_analytics.png?itok=oxAeIEI-) + +"Without data, you're just a person with an opinion." + +Those are the words of W. Edwards Deming, the champion of statistical process control, who was credited as one of the inspirations for what became known as the Japanese post-war economic miracle of 1950 to 1960. Ironically, Japanese manufacturers like Toyota were far more receptive to Deming’s ideas than General Motors and Ford were. + +Community management is certainly an art. It’s about mentoring. It’s about having difficult conversations with people who are hurting the community. It’s about negotiation and compromise. It’s about interacting with other communities. It’s about making connections. In the words of Red Hat’s Diane Mueller, it’s about "nurturing conversations." + +However, it’s also about metrics and data. + +Some have much in common with software development projects more broadly. Others are more specific to the management of the community itself. I think of deciding what to measure and how as adhering to five principles. + +### 1. Recognize that behaviors aren't independent of the measurements you choose to highlight. + +In 2008, Daniel Ariely published Predictably Irrational, one of a number of books written around that time that introduced behavioral psychology and behavioral economics to the general public. One memorable quote from that book is the following: “Human beings adjust behavior based on the metrics they’re held against. Anything you measure will impel a person to optimize his score on that metric. What you measure is what you’ll get. Period.” + +This shouldn’t be surprising. It’s a finding that’s been repeatedly confirmed by research. It should also be familiar to just about anyone with business experience. It’s certainly not news to anyone in sales management, for example. Base sales reps’ (or their managers’) bonuses solely on revenue, and they’ll try to discount whatever it takes to maximize revenue, even if it puts margin in the toilet. Conversely, want the sales force to push a new product line—which will probably take extra effort—but skip the spiffs? Probably not happening. + +And lest you think I’m unfairly picking on sales, this behavior is pervasive, all the way up to the CEO, as Ariely describes in a 2010 Harvard Business Review article: “CEOs care about stock value because that’s how we measure them. If we want to change what they care about, we should change what we measure.” + +Developers and other community members are not immune. + +### 2. You need to choose relevant metrics. + +There’s a lot of folk wisdom floating around about what’s relevant and important that’s not necessarily true. My colleague [Dave Neary offers an example from baseball][1]: “In the late '90s, the key measurements that were used to measure batter skill were RBI (runs batted in) and batting average (how often a player got on base with a hit, divided by the number of at-bats). The Oakland A’s were the first major league team to recruit based on a different measurement of player performance: on-base percentage. This measures how often they get to first base, regardless of how it happens.” + +Indeed, the whole revolution of sabermetrics in baseball and elsewhere, which was popularized in Michael Lewis’ Moneyball, often gets talked about in terms of introducing data in a field that historically was more about gut feel and personal experience. But it was also about taking a game that had actually always been fairly numbers-obsessed and coming up with new metrics based on mostly existing data to better measure player value. (The data revolution going on in sports today is more about collecting much more data through video and other means than was previously available.) + +### 3. Quantity may not lead to quality. + +As a corollary, collecting lots of tangential but easy-to-capture data isn’t better than just selecting a few measurements you’ve determined are genuinely useful. In a world where online behavior can be tracked with great granularity and displayed in colorful dashboards, it’s tempting to be distracted by sheer data volume, even when it doesn’t deliver any great insight into community health and trajectory. + +This may seem like an obvious point: Why measure something that isn’t relevant? In practice, metrics often get chosen because they’re easy to measure, not because they’re particularly useful. They tend to be more about inputs than outputs: The number of developers. The number of forum posts. The number of commits. Collectively, measures like this often get called vanity metrics. They’re ubiquitous, but most people involved with community management don’t think much of them. + +Number of downloads may be the worst of the bunch. It’s true that, at some level, they’re an indication of interest in a project. That’s something. But it’s sufficiently distant from actively using the project, much less engaging with the project deeply, that it’s hard to view downloads as a very useful number. + +Is there any harm in these vanity metrics? Yes, to the degree that you start thinking that they’re something to base action on. Probably more seriously, stakeholders like company management or industry observers can come to see them as meaningful indicators of project health. + +### 4. Understand what measurements really mean and how they relate to each other. + +Neary makes this point to caution against myopia. “In one project I worked on,” he says, ”some people were concerned about a recent spike in the number of bug reports coming in because it seemed like the project must have serious quality issues to resolve. However, when we looked at the numbers, it turned out that many of the bugs were coming in because a large company had recently started using the project. The increase in bug reports was actually a proxy for a big influx of new users, which was a good thing.” + +In practice, you often have to measure through proxies. This isn’t an inherent problem, but the further you get between what you want to measure and what you’re actually measuring, the harder it is to connect the dots. It’s fine to track progress in closing bugs, writing code, and adding new features. However, those don’t necessarily correlate with how happy users are or whether the project is doing a good job of working towards its long-term objectives, whatever those may be. + +### 5. Different measurements serve different purposes. + +Some measurements may be non-obvious but useful for tracking the success of a project and community relative to internal goals. Others may be better suited for a press release or other external consumption. For example, as a community manager, you may really care about the number of meetups, mentoring sessions, and virtual briefings your community has held over the past three months. But it’s the number of contributions and contributors that are more likely to grab the headlines. You probably care about those too. But maybe not as much, depending upon your current priorities. + +Still, other measurements may relate to the goals of any sponsoring organizations. The measurements most relevant for projects tied to commercial products are likely to be different from pure community efforts. + +Because communities differ and goals differ, it’s not possible to simply compile a metrics checklist, but here are some ideas to think about: + +Consider qualitative metrics in addition to quantitative ones. Conducting surveys and other studies can be time-consuming, especially if they’re rigorous enough to yield better-than-anecdotal data. It also requires rigor to construct studies so that they can be used to track changes over time. In other words, it’s a lot easier to measure quantitative contributor activity than it is to suss out if the community members are happier about their participation today than they were a year ago. However, given the importance of culture to the health of a community, measuring it in a systematic way can be a worthwhile exercise. + +Breadth of community, including how many are unaffiliated with commercial entities, is important for many projects. The greater the breadth, the greater the potential leverage of the open source development process. It can also be instructive to see how companies and individuals are contributing. Projects can be explicitly designed to better accommodate casual contributors. + +Are new contributors able to have an impact, or are they ignored? How long does it take for code contributions to get committed? How long does it take for a reported bug to be fixed or otherwise responded to? If they asked a question in a forum, did anyone answer them? In other words, are you letting contributors contribute? + +Advancement within the project is also an important metric. [Mikeal Rogers of the Node.js community][2] explains: “The shift that we made was to create a support system and an education system to take a user and turn them into a contributor, first at a very low level, and educate them to bring them into the committer pool and eventually into the maintainer pool. The end result of this is that we have a wide range of skill sets. Rather than trying to attract phenomenal developers, we’re creating new phenomenal developers.” + +Whatever metrics you choose, don’t forget why you made them metrics in the first place. I find a helpful question to ask is: “What am I going to do with this number?” If the answer is to just put it in a report or in a press release, that’s not a great answer. Metrics should be measurements that tell you either that you’re on the right path or that you need to take specific actions to course-correct. + +For this reason, Stormy Peters, who handles community leads at Red Hat, [argues for keeping it simple][3]. She writes, “It’s much better to have one or two key metrics than to worry about all the possible metrics. You can capture all the possible metrics, but as a project, you should focus on moving one. It’s also better to have a simple metric that correlates directly to something in the real world than a metric that is a complicated formula or ration between multiple things. As project members make decisions, you want them to be able to intuitively feel whether or not it will affect the project’s key metric in the right direction.” + +The article is adapted from [How Open Source Ate Software][4] by Gordon Haff (Apress 2018). + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/metrics-guide-open-source-projects + +作者:[Gordon Haff][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ghaff +[b]: https://github.com/lujun9972 +[1]: https://community.redhat.com/blog/2014/07/when-metrics-go-wrong/ +[2]: https://opensource.com/article/17/3/nodejs-community-casual-contributors +[3]: https://medium.com/open-source-communities/3-important-things-to-consider-when-measuring-your-success-50e21ad82858 +[4]: https://www.apress.com/us/book/9781484238936 From 18a409110a31eec11b8a9b0fd143277b9032f883 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 11:18:24 +0800 Subject: [PATCH 315/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20to=20Build?= =?UTF-8?q?=20a=20Netboot=20Server,=20Part=204?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4 How to Build a Netboot Server, Part 4.md | 632 ++++++++++++++++++ 1 file changed, 632 insertions(+) create mode 100644 sources/tech/20190114 How to Build a Netboot Server, Part 4.md diff --git a/sources/tech/20190114 How to Build a Netboot Server, Part 4.md b/sources/tech/20190114 How to Build a Netboot Server, Part 4.md new file mode 100644 index 0000000000..aadd3c0b01 --- /dev/null +++ b/sources/tech/20190114 How to Build a Netboot Server, Part 4.md @@ -0,0 +1,632 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Build a Netboot Server, Part 4) +[#]: via: (https://fedoramagazine.org/how-to-build-a-netboot-server-part-4/) +[#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/) + +How to Build a Netboot Server, Part 4 +====== +![](https://fedoramagazine.org/wp-content/uploads/2018/11/netboot4-816x345.jpg) + +One significant limitation of the netboot server built in this series is the operating system image being served is read-only. Some use cases may require the end user to modify the image. For example, an instructor may want to have the students install and configure software packages like MariaDB and Node.js as part of their course walk-through. + +An added benefit of writable netboot images is the end user’s “personalized” operating system can follow them to different workstations they may use at later times. + +### Change the Bootmenu Application to use HTTPS + +Create a self-signed certificate for the bootmenu application: + +``` +$ sudo -i +# MY_NAME=$( .*#listen => ['https://$MY_NAME:443?cert=$MY_TLSD/$MY_NAME.pem\&key=$MY_TLSD/$MY_NAME.key\&ciphers=AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA'],#" /opt/bootmenu/bootmenu.conf +``` + +Note the ciphers have been restricted to [those currently supported by iPXE][1]. + +GnuTLS requires the “CAP_DAC_READ_SEARCH” capability, so add it to the bootmenu application’s systemd service: + +``` +# sed -i '/^AmbientCapabilities=/ s/$/ CAP_DAC_READ_SEARCH/' /etc/systemd/system/bootmenu.service +# sed -i 's/Serves iPXE Menus over HTTP/Serves iPXE Menus over HTTPS/' /etc/systemd/system/bootmenu.service +# systemctl daemon-reload +``` + +Now, add an exception for the bootmenu service to the firewall and restart the service: + +``` +# MY_SUBNET=192.0.2.0 +# MY_PREFIX=24 +# firewall-cmd --add-rich-rule="rule family='ipv4' source address='$MY_SUBNET/$MY_PREFIX' service name='https' accept" +# firewall-cmd --runtime-to-permanent +# systemctl restart bootmenu.service +``` + +Use wget to verify it’s working: + +``` +$ MY_NAME=server-01.example.edu +$ MY_TLSD=/opt/bootmenu/tls +$ wget -q --ca-certificate=$MY_TLSD/$MY_NAME.pem -O - https://$MY_NAME/menu +``` + +### Add HTTPS to iPXE + +Update init.ipxe to use HTTPS. Then recompile the ipxe bootloader with options to embed and trust the self-signed certificate you created for the bootmenu application: + +``` +$ echo '#define DOWNLOAD_PROTO_HTTPS' >> $HOME/ipxe/src/config/local/general.h +$ sed -i 's/^chain http:/chain https:/' $HOME/ipxe/init.ipxe +$ cp $MY_TLSD/$MY_NAME.pem $HOME/ipxe +$ cd $HOME/ipxe/src +$ make clean +$ make bin-x86_64-efi/ipxe.efi EMBED=../init.ipxe CERT="../$MY_NAME.pem" TRUST="../$MY_NAME.pem" +``` + +You can now copy the HTTPS-enabled iPXE bootloader out to your clients and test that everything is working correctly: + +``` +$ cp $HOME/ipxe/src/bin-x86_64-efi/ipxe.efi $HOME/esp/efi/boot/bootx64.efi +``` + +### Add User Authentication to Mojolicious + +Create a PAM service definition for the bootmenu application: + +``` +# dnf install -y pam_krb5 +# echo 'auth required pam_krb5.so' > /etc/pam.d/bootmenu +``` + +Add a library to the bootmenu application that uses the Authen-PAM perl module to perform user authentication: + +``` +# dnf install -y perl-Authen-PAM; +# MY_MOJO=/opt/bootmenu +# mkdir $MY_MOJO/lib +# cat << 'END' > $MY_MOJO/lib/PAM.pm +package PAM; + +use Authen::PAM; + +sub auth { + my $success = 0; + + my $username = shift; + my $password = shift; + + my $callback = sub { + my @res; + while (@_) { + my $code = shift; + my $msg = shift; + my $ans = ""; + + $ans = $username if ($code == PAM_PROMPT_ECHO_ON()); + $ans = $password if ($code == PAM_PROMPT_ECHO_OFF()); + + push @res, (PAM_SUCCESS(), $ans); + } + push @res, PAM_SUCCESS(); + + return @res; + }; + + my $pamh = new Authen::PAM('bootmenu', $username, $callback); + + { + last unless ref $pamh; + last unless $pamh->pam_authenticate() == PAM_SUCCESS; + $success = 1; + } + + return $success; +} + +return 1; +END +``` + +The above code is taken almost verbatim from the Authen::PAM::FAQ man page. + +Redefine the bootmenu application so it returns a netboot template only if a valid username and password are supplied: + +``` +# cat << 'END' > $MY_MOJO/bootmenu.pl +#!/usr/bin/env perl + +use lib 'lib'; + +use PAM; +use Mojolicious::Lite; +use Mojolicious::Plugins; +use Mojo::Util ('url_unescape'); + +plugin 'Config'; + +get '/menu'; +get '/boot' => sub { + my $c = shift; + + my $instance = $c->param('instance'); + my $username = $c->param('username'); + my $password = $c->param('password'); + + my $template = 'menu'; + + { + last unless $instance =~ /^fc[[:digit:]]{2}$/; + last unless $username =~ /^[[:alnum:]]+$/; + last unless PAM::auth($username, url_unescape($password)); + $template = $instance; + } + + return $c->render(template => $template); +}; + +app->start; +END +``` + +The bootmenu application now looks for the lib directory relative to its WorkingDirectory. However, by default the working directory is set to the root directory of the server for systemd units. Therefore, you must update the systemd unit to set WorkingDirectory to the root of the bootmenu application instead: + +``` +# sed -i "/^RuntimeDirectory=/ a WorkingDirectory=$MY_MOJO" /etc/systemd/system/bootmenu.service +# systemctl daemon-reload +``` + +Update the templates to work with the redefined bootmenu application: + +``` +# cd $MY_MOJO/templates +# MY_BOOTMENU_SERVER=$( fc$i.html.ep; grep "^kernel\|initrd" menu.html.ep | grep "fc$i" >> fc$i.html.ep; echo "boot || chain https://$MY_BOOTMENU_SERVER/menu" >> fc$i.html.ep; sed -i "/^:f$i$/,/^boot /c :f$i\nlogin\nchain https://$MY_BOOTMENU_SERVER/boot?instance=fc$i\&username=\${username}\&password=\${password:uristring} || goto failed" menu.html.ep; done +``` + +The result of the last command above should be three files similar to the following: + +**menu.html.ep** : + +``` +#!ipxe + +set timeout 5000 + +:menu +menu iPXE Boot Menu +item --key 1 lcl 1. Microsoft Windows 10 +item --key 2 f29 2. RedHat Fedora 29 +item --key 3 f28 3. RedHat Fedora 28 +choose --timeout ${timeout} --default lcl selected || goto shell +set timeout 0 +goto ${selected} + +:failed +echo boot failed, dropping to shell... +goto shell + +:shell +echo type 'exit' to get the back to the menu +set timeout 0 +shell +goto menu + +:lcl +exit + +:f29 +login +chain https://server-01.example.edu/boot?instance=fc29&username=${username}&password=${password:uristring} || goto failed + +:f28 +login +chain https://server-01.example.edu/boot?instance=fc28&username=${username}&password=${password:uristring} || goto failed +``` + +**fc29.html.ep** : + +``` +#!ipxe +kernel --name kernel.efi ${prefix}/vmlinuz-4.19.5-300.fc29.x86_64 initrd=initrd.img ro ip=dhcp rd.peerdns=0 nameserver=192.0.2.91 nameserver=192.0.2.92 root=/dev/disk/by-path/ip-192.0.2.158:3260-iscsi-iqn.edu.example.server-01:fc29-lun-1 netroot=iscsi:192.0.2.158::::iqn.edu.example.server-01:fc29 console=tty0 console=ttyS0,115200n8 audit=0 selinux=0 quiet +initrd --name initrd.img ${prefix}/initramfs-4.19.5-300.fc29.x86_64.img +boot || chain https://server-01.example.edu/menu +``` + +**fc28.html.ep** : + +``` +#!ipxe +kernel --name kernel.efi ${prefix}/vmlinuz-4.19.3-200.fc28.x86_64 initrd=initrd.img ro ip=dhcp rd.peerdns=0 nameserver=192.0.2.91 nameserver=192.0.2.92 root=/dev/disk/by-path/ip-192.0.2.158:3260-iscsi-iqn.edu.example.server-01:fc28-lun-1 netroot=iscsi:192.0.2.158::::iqn.edu.example.server-01:fc28 console=tty0 console=ttyS0,115200n8 audit=0 selinux=0 quiet +initrd --name initrd.img ${prefix}/initramfs-4.19.3-200.fc28.x86_64.img +boot || chain https://server-01.example.edu/menu +``` + +Now, restart the bootmenu application and verify authentication is working: + +``` +# systemctl restart bootmenu.service +``` + +### Make the iSCSI Target Writeable + +Now that user authentication works through iPXE, you can create per-user, writeable overlays on top of the read-only image on demand when users connect. Using a [copy-on-write][2] overlay has three advantages over simply copying the original image file for each user: + + 1. The copy can be created very quickly. This allows creation on-demand. + 2. The copy does not increase the disk usage on the server. Only what the user writes to their personal copy of the image is stored in addition to the original image. + 3. Since most sectors for each copy are the same sectors on the server’s storage, they’ll likely already be loaded in RAM when subsequent users access their copies of the operating system. This improves the server’s performance because RAM is faster than disk I/O. + + + +One potential pitfall of using copy-on-write is that once overlays are created, the images on which they are overlayed must not be changed. If they are changed, all the overlays will be corrupted. Then the overlays must be deleted and replaced with new, blank overlays. Even simply mounting the image file in read-write mode can cause sufficient filesystem updates to corrupt the overlays. + +Due to the potential for the overlays to be corrupted if the original image is modified, mark the original image as immutable by running: + +``` +# chattr +i +``` + +You can use lsattr to view the status of the immutable flag and use to chattr -i unset the immutable flag. While the immutable flag is set, even the root user or a system process running as root cannot modify or delete the file. + +Begin by stopping the tgtd.service so you can change the image files: + +``` +# systemctl stop tgtd.service +``` + +It’s normal for this command to take a minute or so to stop when there are connections still open. + +Now, remove the read-only iSCSI export. Then update the readonly-root configuration file in the template so the image is no longer read-only: + +``` +# MY_FC=fc29 +# rm -f /etc/tgt/conf.d/$MY_FC.conf +# TEMP_MNT=$(mktemp -d) +# mount /$MY_FC.img $TEMP_MNT +# sed -i 's/^READONLY=yes$/READONLY=no/' $TEMP_MNT/etc/sysconfig/readonly-root +# sed -i 's/^Storage=volatile$/#Storage=auto/' $TEMP_MNT/etc/systemd/journald.conf +# umount $TEMP_MNT +``` + +Journald was changed from logging to volatile memory back to its default (log to disk if /var/log/journal exists) because a user reported his clients would freeze with an out-of-memory error due to an application generating excessive system logs. The downside to setting logging to disk is that extra write traffic is generated by the clients, and might burden your netboot server with unnecessary I/O. You should decide which option — log to memory or log to disk — is preferable depending on your environment. + +Since you won’t make any further changes to the template image, set the immutable flag on it and restart the tgtd.service: + +``` +# chattr +i /$MY_FC.img +# systemctl start tgtd.service +``` + +Now, update the bootmenu application: + +``` +# cat << 'END' > $MY_MOJO/bootmenu.pl +#!/usr/bin/env perl + +use lib 'lib'; + +use PAM; +use Mojolicious::Lite; +use Mojolicious::Plugins; +use Mojo::Util ('url_unescape'); + +plugin 'Config'; + +get '/menu'; +get '/boot' => sub { + my $c = shift; + + my $instance = $c->param('instance'); + my $username = $c->param('username'); + my $password = $c->param('password'); + + my $chapscrt; + my $template = 'menu'; + + { + last unless $instance =~ /^fc[[:digit:]]{2}$/; + last unless $username =~ /^[[:alnum:]]+$/; + last unless PAM::auth($username, url_unescape($password)); + last unless $chapscrt = `sudo scripts/mktgt $instance $username`; + $template = $instance; + } + + return $c->render(template => $template, username => $username, chapscrt => $chapscrt); +}; + +app->start; +END +``` + +This new version of the bootmenu application calls a custom mktgt script which, on success, returns a random [CHAP][3] password for each new iSCSI target that it creates. The CHAP password prevents one user from mounting another user’s iSCSI target by indirect means. The app only returns the correct iSCSI target password to a user who has successfully authenticated. + +The mktgt script is prefixed with sudo because it needs root privileges to create the target. + +The $username and $chapscrt variables also pass to the render command so they can be incorporated into the templates returned to the user when necessary. + +Next, update our boot templates so they can read the username and chapscrt variables and pass them along to the end user. Also update the templates to mount the root filesystem in rw (read-write) mode: + +``` +# cd $MY_MOJO/templates +# sed -i "s/:$MY_FC/:$MY_FC-<%= \$username %>/g" $MY_FC.html.ep +# sed -i "s/ netroot=iscsi:/ netroot=iscsi:<%= \$username %>:<%= \$chapscrt %>@/" $MY_FC.html.ep +# sed -i "s/ ro / rw /" $MY_FC.html.ep +``` + +After running the above commands, you should have boot templates like the following: + +``` +#!ipxe +kernel --name kernel.efi ${prefix}/vmlinuz-4.19.5-300.fc29.x86_64 initrd=initrd.img rw ip=dhcp rd.peerdns=0 nameserver=192.0.2.91 nameserver=192.0.2.92 root=/dev/disk/by-path/ip-192.0.2.158:3260-iscsi-iqn.edu.example.server-01:fc29-<%= $username %>-lun-1 netroot=iscsi:<%= $username %>:<%= $chapscrt %>@192.0.2.158::::iqn.edu.example.server-01:fc29-<%= $username %> console=tty0 console=ttyS0,115200n8 audit=0 selinux=0 quiet +initrd --name initrd.img ${prefix}/initramfs-4.19.5-300.fc29.x86_64.img +boot || chain https://server-01.example.edu/menu +``` + +NOTE: If you need to view the boot template after the variables have been [interpolated][4], you can insert the “shell” command on its own line just before the “boot” command. Then, when you netboot your client, iPXE gives you an interactive shell where you can enter “imgstat” to view the parameters being passed to the kernel. If everything looks correct, you can type “exit” to leave the shell and continue the boot process. + +Now allow the bootmenu user to run the mktgt script (and only that script) as root via sudo: + +``` +# echo "bootmenu ALL = NOPASSWD: $MY_MOJO/scripts/mktgt *" > /etc/sudoers.d/bootmenu +``` + +The bootmenu user should not have write access to the mktgt script or any other files under its home directory. All the files under /opt/bootmenu should be owned by root, and should not be writable by any user other than root. + +Sudo does not work well with systemd’s DynamicUser option, so create a normal user account and set the systemd service to run as that user: + +``` +# useradd -r -c 'iPXE Boot Menu Service' -d /opt/bootmenu -s /sbin/nologin bootmenu +# sed -i 's/^DynamicUser=true$/User=bootmenu/' /etc/systemd/system/bootmenu.service +# systemctl daemon-reload +``` + +Finally, create a directory for the copy-on-write overlays and create the mktgt script that manages the iSCSI targets and their overlayed backing stores: + +``` +# mkdir /$MY_FC.cow +# mkdir $MY_MOJO/scripts +# cat << 'END' > $MY_MOJO/scripts/mktgt +#!/usr/bin/env perl + +# if another instance of this script is running, wait for it to finish +"$ENV{FLOCKER}" eq 'MKTGT' or exec "env FLOCKER=MKTGT flock /tmp $0 @ARGV"; + +# use "RETURN" to print to STDOUT; everything else goes to STDERR by default +open(RETURN, '>&', STDOUT); +open(STDOUT, '>&', STDERR); + +my $instance = shift or die "instance not provided"; +my $username = shift or die "username not provided"; + +my $img = "/$instance.img"; +my $dir = "/$instance.cow"; +my $top = "$dir/$username"; + +-f "$img" or die "'$img' is not a file"; +-d "$dir" or die "'$dir' is not a directory"; + +my $base; +die unless $base = `losetup --show --read-only --nooverlap --find $img`; +chomp $base; + +my $size; +die unless $size = `blockdev --getsz $base`; +chomp $size; + +# create the per-user sparse file if it does not exist +if (! -e "$top") { + die unless system("dd if=/dev/zero of=$top status=none bs=512 count=0 seek=$size") == 0; +} + +# create the copy-on-write overlay if it does not exist +my $cow="$instance-$username"; +my $dev="/dev/mapper/$cow"; +if (! -e "$dev") { + my $over; + die unless $over = `losetup --show --nooverlap --find $top`; + chomp $over; + die unless system("echo 0 $size snapshot $base $over p 8 | dmsetup create $cow") == 0; +} + +my $tgtadm = '/usr/sbin/tgtadm --lld iscsi'; + +# get textual representations of the iscsi targets +my $text = `$tgtadm --op show --mode target`; +my @targets = $text =~ /(?:^T.*\n)(?:^ .*\n)*/mg; + +# convert the textual representations into a hash table +my $targets = {}; +foreach (@targets) { + my $tgt; + my $sid; + + foreach (split /\n/) { + /^Target (\d+)(?{ $tgt = $targets->{$^N} = [] })/; + /I_T nexus: (\d+)(?{ $sid = $^N })/; + /Connection: (\d+)(?{ push @{$tgt}, [ $sid, $^N ] })/; + } +} + +my $hostname; +die unless $hostname = `hostname`; +chomp $hostname; + +my $target = 'iqn.' . join('.', reverse split('\.', $hostname)) . ":$cow"; + +# find the target id corresponding to the provided target name and +# close any existing connections to it +my $tid = 0; +foreach (@targets) { + next unless /^Target (\d+)(?{ $tid = $^N }): $target$/m; + foreach (@{$targets->{$tid}}) { + die unless system("$tgtadm --op delete --mode conn --tid $tid --sid $_->[0] --cid $_->[1]") == 0; + } +} + +# create a new target if an existing one was not found +if ($tid == 0) { + # find an available target id + my @ids = (0, sort keys %{$targets}); + $tid = 1; while ($ids[$tid]==$tid) { $tid++ } + + # create the target + die unless -e "$dev"; + die unless system("$tgtadm --op new --mode target --tid $tid --targetname $target") == 0; + die unless system("$tgtadm --op new --mode logicalunit --tid $tid --lun 1 --backing-store $dev") == 0; + die unless system("$tgtadm --op bind --mode target --tid $tid --initiator-address ALL") == 0; +} + +# (re)set the provided target's chap password +my $password = join('', map(chr(int(rand(26))+65), 1..8)); +my $accounts = `$tgtadm --op show --mode account`; +if ($accounts =~ / $username$/m) { + die unless system("$tgtadm --op delete --mode account --user $username") == 0; +} +die unless system("$tgtadm --op new --mode account --user $username --password $password") == 0; +die unless system("$tgtadm --op bind --mode account --tid $tid --user $username") == 0; + +# return the new password to the iscsi target on stdout +print RETURN $password; +END +# chmod +x $MY_MOJO/scripts/mktgt +``` + +The above script does five things: + + 1. It creates the /.cow/ sparse file if it does not already exist. + 2. It creates the /dev/mapper/- device node that serves as the copy-on-write backing store for the iSCSI target if it does not already exist. + 3. It creates the iqn.:- iSCSI target if it does not exist. Or, if the target does exist, it closes any existing connections to it because the image can only be opened in read-write mode from one place at a time. + 4. It (re)sets the chap password on the iqn.:- iSCSI target to a new random value. + 5. It prints the new chap password on [standard output][5] if all of the previous tasks compeleted successfully. + + + +You should be able to test the mktgt script from the command line by running it with valid test parameters. For example: + +``` +# echo `$MY_MOJO/scripts/mktgt fc29 jsmith` +``` + +When run from the command line, the mktgt script should print out either the eight-character random password for the iSCSI target if it succeeded or the line number on which something went wrong if it failed. + +On occasion, you may want to delete an iSCSI target without having to stop the entire service. For example, a user might inadvertently corrupt their personal image, in which case you would need to systematically undo everything that the above mktgt script does so that the next time they log in they will get a copy of the original image. + +Below is an rmtgt script that undoes, in reverse order, what the above mktgt script did: + +``` +# mkdir $HOME/bin +# cat << 'END' > $HOME/bin/rmtgt +#!/usr/bin/env perl + +@ARGV >= 2 or die "usage: $0 [+d|+f]\n"; + +my $instance = shift; +my $username = shift; + +my $rmd = ($ARGV[0] eq '+d'); #remove device node if +d flag is set +my $rmf = ($ARGV[0] eq '+f'); #remove sparse file if +f flag is set +my $cow = "$instance-$username"; + +my $hostname; +die unless $hostname = `hostname`; +chomp $hostname; + +my $tgtadm = '/usr/sbin/tgtadm'; +my $target = 'iqn.' . join('.', reverse split('\.', $hostname)) . ":$cow"; + +my $text = `$tgtadm --op show --mode target`; +my @targets = $text =~ /(?:^T.*\n)(?:^ .*\n)*/mg; + +my $targets = {}; +foreach (@targets) { + my $tgt; + my $sid; + + foreach (split /\n/) { + /^Target (\d+)(?{ $tgt = $targets->{$^N} = [] })/; + /I_T nexus: (\d+)(?{ $sid = $^N })/; + /Connection: (\d+)(?{ push @{$tgt}, [ $sid, $^N ] })/; + } +} + +my $tid = 0; +foreach (@targets) { + next unless /^Target (\d+)(?{ $tid = $^N }): $target$/m; + foreach (@{$targets->{$tid}}) { + die unless system("$tgtadm --op delete --mode conn --tid $tid --sid $_->[0] --cid $_->[1]") == 0; + } + die unless system("$tgtadm --op delete --mode target --tid $tid") == 0; + print "target $tid deleted\n"; + sleep 1; +} + +my $dev = "/dev/mapper/$cow"; +if ($rmd or ($rmf and -e $dev)) { + die unless system("dmsetup remove $cow") == 0; + print "device node $dev deleted\n"; +} + +if ($rmf) { + my $sf = "/$instance.cow/$username"; + die "sparse file $sf not found" unless -e "$sf"; + die unless system("rm -f $sf") == 0; + die unless not -e "$sf"; + print "sparse file $sf deleted\n"; +} +END +# chmod +x $HOME/bin/rmtgt +``` + +For example, to use the above script to completely remove the fc29-jsmith target including its backing store device node and its sparse file, run the following: + +``` +# rmtgt fc29 jsmith +f +``` + +Once you’ve verified that the mktgt script is working properly, you can restart the bootmenu service. The next time someone netboots, they should receive a personal copy of the the netboot image they can write to: + +``` +# systemctl restart bootmenu.service +``` + +Users should now be able to modify the root filesystem as demonstrated in the below screenshot: + +![][6] + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/how-to-build-a-netboot-server-part-4/ + +作者:[Gregory Bartholomew][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/glb/ +[b]: https://github.com/lujun9972 +[1]: http://ipxe.org/crypto +[2]: https://en.wikipedia.org/wiki/Copy-on-write +[3]: https://en.wikipedia.org/wiki/Challenge-Handshake_Authentication_Protocol +[4]: https://en.wikipedia.org/wiki/String_interpolation +[5]: https://en.wikipedia.org/wiki/Standard_streams +[6]: https://fedoramagazine.org/wp-content/uploads/2018/11/netboot-fix-pam_mount-1024x819.png From 3d53ff2022265753c02fc219fa8e74205f01aee9 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 11:19:50 +0800 Subject: [PATCH 316/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Build=20a=20retro?= =?UTF-8?q?=20gaming=20console=20with=20RetroPie?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ld a retro gaming console with RetroPie.md | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 sources/tech/20190111 Build a retro gaming console with RetroPie.md diff --git a/sources/tech/20190111 Build a retro gaming console with RetroPie.md b/sources/tech/20190111 Build a retro gaming console with RetroPie.md new file mode 100644 index 0000000000..eedac575c9 --- /dev/null +++ b/sources/tech/20190111 Build a retro gaming console with RetroPie.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Build a retro gaming console with RetroPie) +[#]: via: (https://opensource.com/article/19/1/retropie) +[#]: author: (Jay LaCroix https://opensource.com/users/jlacroix) + +Build a retro gaming console with RetroPie +====== +Play your favorite classic Nintendo, Sega, and Sony console games on Linux. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/open_gaming_games_roundup_news.png?itok=KM0ViL0f) + +The most common question I get on [my YouTube channel][1] and in person is what my favorite Linux distribution is. If I limit the answer to what I run on my desktops and laptops, my answer will typically be some form of an Ubuntu-based Linux distro. My honest answer to this question may surprise many. My favorite Linux distribution is actually [RetroPie][2]. + +As passionate as I am about Linux and open source software, I'm equally passionate about classic gaming, specifically video games produced in the '90s and earlier. I spend most of my surplus income on older games, and I now have a collection of close to a thousand games for over 20 gaming consoles. In my spare time, I raid flea markets, yard sales, estate sales, and eBay buying games for various consoles, including almost every iteration made by Nintendo, Sega, and Sony. There's something about classic games that I adore, a charm that seems lost in games released nowadays. + +Unfortunately, collecting retro games has its fair share of challenges. Cartridges with memory for save files will lose their charge over time, requiring the battery to be replaced. While it's not hard to replace save batteries (if you know how), it's still time-consuming. Games on CD-ROMs are subject to disc rot, which means that even if you take good care of them, they'll still lose data over time and become unplayable. Also, sometimes it's difficult to find replacement parts for some consoles. This wouldn't be so much of an issue if the majority of classic games were available digitally, but the vast majority are never re-released on a digital platform. + +### Gaming on RetroPie + +RetroPie is a great project and an asset to retro gaming enthusiasts like me. RetroPie is a Raspbian-based distribution designed for use on the Raspberry Pi (though it is possible to get it working on other platforms, such as a PC). RetroPie boots into a graphical interface that is completely controllable via a gamepad or joystick and allows you to easily manage digital copies (ROMs) of your favorite games. You can scrape information from the internet to organize your collection better and manage lists of favorite games, and the entire interface is very user-friendly and efficient. From the interface, you can launch directly into a game, then exit the game by pressing a combination of buttons on your gamepad. You rarely need a keyboard, unless you have to enter your WiFi password or manually edit configuration files. + +I use RetroPie to host a digital copy of every physical game I own in my collection. When I purchase a game from a local store or eBay, I also download the ROM. As a collector, this is very convenient. If I don't have a particular physical console within arms reach, I can boot up RetroPie and enjoy a game quickly without having to connect cables or clean cartridge contacts. There's still something to be said about playing a game on the original hardware, but if I'm pressed for time, RetroPie is very convenient. I also don't have to worry about dead save batteries, dirty cartridge contacts, disc rot, or any of the other issues collectors like me have to regularly deal with. I simply play the game. + +Also, RetroPie allows me to be very clever and utilize my technical know-how to achieve additional functionality that's not normally available. For example, I have three RetroPies set up, each of them synchronizing their files between each other by leveraging [Syncthing][3], a popular open source file synchronization tool. The synchronization happens automatically, and it means I can start a game on one television and continue in the same place on another unit since the save files are included in the synchronization. To take it a step further, I also back up my save and configuration files to [Backblaze B2][4], so I'm protected if an SD card becomes defective. + +### Setting up RetroPie + +Setting up RetroPie is very easy, and if you've ever set up a Raspberry Pi Linux distribution before (such as Raspbian) the process is essentially the same—you simply download the IMG file and flash it to your SD card by utilizing another tool, such as [Etcher][5], and insert it into your RetroPie. Then plug in an AC adapter and gamepad and hook it up to your television via HDMI. Optionally, you can buy a case to protect your RetroPie from outside elements and add visual appeal. Here is a listing of things you'll need to get started: + + * Raspberry Pi board (Model 3B+ or higher recommended) + * SD card (16GB or larger recommended) + * A USB gamepad + * UL-listed micro USB power adapter, at least 2.5 amp + + + +If you choose to add the optional Raspberry Pi case, I recommend the Super NES and Super Famicom themed cases from [RetroFlag][6]. Not only do these cases look cool, but they also have fully functioning power and reset buttons. This means you can configure the reset and power buttons to directly trigger the operating system's halt process, rather than abruptly terminating power. This definitely makes for a more professional experience, but it does require the installation of a special script. The instructions are on [RetroFlag's GitHub page][7]. Be wary: there are many cases available on Amazon and eBay of varying quality. Some of them are cheap knock-offs of RetroFlag cases, and others are just a lower quality overall. In fact, even cases by RetroFlag vary in quality—I had some power-distribution issues with the NES-themed case that made for an unstable experience. If in doubt, I've found that RetroFlag's Super NES and Super Famicom themed cases work very well. + +### Adding games + +When you boot RetroPie for the first time, it will resize the filesystem to ensure you have full access to the available space on your SD card and allow you to set up your gamepad. I can't give you links for game ROMs, so I'll leave that part up to you to figure out. When you've found them, simply add them to the RetroPie SD card in the designated folder, which would be located under **/home/pi/RetroPie/roms/ **. You can use your favorite tool for transferring the ROMs to the Pi, such as [SCP][8] in a terminal, [WinSCP][9], [Samba][10], etc. Once you've added the games, you can rescan them by pressing start and choosing the option to restart EmulationStation. When it restarts, it should automatically add menu entries for the ROMs you've added. That's basically all there is to it. + +(The rescan updates EmulationStation’s game inventory. If you don’t do that, it won’t list any newly added games you copy over.) + +Regarding the games' performance, your mileage will vary depending on which consoles you're emulating. For example, I've noticed that Sega Dreamcast games barely run at all, and most Nintendo 64 games will run sluggishly with a bad framerate. Many PlayStation Portable (PSP) games also perform inconsistently. However, all of the 8-bit and 16-bit consoles emulate seemingly perfectly—I haven't run into a single 8-bit or 16-bit game that doesn't run well. Surprisingly, games designed for the original PlayStation run great for me, which is a great feat considering the lower-performance potential of the Raspberry Pi. + +Overall, RetroPie's performance is great, but the Raspberry Pi is not as powerful as a gaming PC, so adjust your expectations accordingly. + +### Conclusion + +RetroPie is a fantastic open source project dedicated to preserving classic games and an asset to game collectors everywhere. Having a digital copy of my physical game collection is extremely convenient. If I were to tell my childhood self that one day I could have an entire game collection on one device, I probably wouldn't believe it. But RetroPie has become a staple in my household and provides hours of fun and enjoyment. + +If you want to see the parts I mentioned as well as a quick installation overview, I have [a video][11] on [my YouTube channel][12] that goes over the process and shows off some gameplay at the end. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/retropie + +作者:[Jay LaCroix][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jlacroix +[b]: https://github.com/lujun9972 +[1]: https://www.youtube.com/channel/UCxQKHvKbmSzGMvUrVtJYnUA +[2]: https://retropie.org.uk/ +[3]: https://syncthing.net/ +[4]: https://www.backblaze.com/b2/cloud-storage.html +[5]: https://www.balena.io/etcher/ +[6]: https://www.amazon.com/shop/learnlinux.tv?listId=1N9V89LEH5S8K +[7]: https://github.com/RetroFlag/retroflag-picase +[8]: https://en.wikipedia.org/wiki/Secure_copy +[9]: https://winscp.net/eng/index.php +[10]: https://www.samba.org/ +[11]: https://www.youtube.com/watch?v=D8V-KaQzsWM +[12]: http://www.youtube.com/c/LearnLinuxtv From 99131600b62f723c6783fccc6f078c09a8b0a716 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 11:20:59 +0800 Subject: [PATCH 317/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20To=20Move?= =?UTF-8?q?=20Multiple=20File=20Types=20Simultaneously=20From=20Commandlin?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...e Types Simultaneously From Commandline.md | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 sources/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md diff --git a/sources/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md b/sources/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md new file mode 100644 index 0000000000..1b342b12ef --- /dev/null +++ b/sources/tech/20190114 How To Move Multiple File Types Simultaneously From Commandline.md @@ -0,0 +1,96 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Move Multiple File Types Simultaneously From Commandline) +[#]: via: (https://www.ostechnix.com/how-to-move-multiple-file-types-simultaneously-from-commandline/) +[#]: author: (SK https://www.ostechnix.com/author/sk/) + +How To Move Multiple File Types Simultaneously From Commandline +====== + +![](https://www.ostechnix.com/wp-content/uploads/2019/01/Move-Multiple-File-Types-720x340.png) + +The other day I was wondering how can I move (not copy) multiple file types from directory to another. I already knew how to [**find and copy certain type of files from one directory to another**][1]. But, I don’t know how to move multiple file types simultaneously. If you’re ever in a situation like this, I know a easy way to do it from commandline in Unix-like systems. + +### Move Multiple File Types Simultaneously + +Picture this scenario.You have multiple type of files, for example .pdf, .doc, .mp3, .mp4, .txt etc., on a directory named **‘dir1’**. Let us take a look at the dir1 contents: + +``` +$ ls dir1 +file.txt image.jpg mydoc.doc personal.pdf song.mp3 video.mp4 +``` + +You want to move some of the file types (not all of them) to different location. For example, let us say you want to move doc, pdf and txt files only to another directory named **‘dir2’** in one go. + +To copy .doc, .pdf and .txt files from dir1 to dir2 simultaneously, the command would be: + +``` +$ mv dir1/*.{doc,pdf,txt} dir2/ +``` + +It’s easy, isn’t it? + +Now, let us check the contents of dir2: + +``` +$ ls dir2/ +file.txt mydoc.doc personal.pdf +``` + +See? Only the file types .doc, .pdf and .txt from dir1 have been moved to dir2. + +![][3] + +You can add as many file types as you want to inside curly braces in the above command to move them across different directories. The above command just works fine for me on Bash. + +Another way to move multiple file types is go to the source directory i.e dir1 in our case: + +``` +$ cd ~/dir1 +``` + +And, move file types of your choice to the destination (E.g dir2) as shown below. + +``` +$ mv *.doc *.txt *.pdf /home/sk/dir2/ +``` + +To move all files having a particular extension, for example **.doc** only, run: + +``` +$ mv dir1/*.doc dir2/ +``` + +For more details, refer man pages. + +``` +$ man mv +``` + +Moving a few number of same or different file types is easy! You could do this with couple mouse clicks in GUI mode or use a one-liner command in CLI mode. However, If you have thousands of different file types in a directory and wanted to move multiple file types to different directory in one go, it would be a cumbersome task. To me, the above method did the job easily! If you know any other one-liner commands to move multiple file types at a time, please share it in the comment section below. I will check and update the guide accordingly. + +And, that’s all for now. Hope this was useful. More good stuffs to come. Stay tuned! + +Cheers! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/how-to-move-multiple-file-types-simultaneously-from-commandline/ + +作者:[SK][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: https://www.ostechnix.com/find-copy-certain-type-files-one-directory-another-linux/ +[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[3]: http://www.ostechnix.com/wp-content/uploads/2019/01/mv-command.gif From 4a8e74b50ce03261a4f5d0ee9443a96fa8ede517 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 11:30:44 +0800 Subject: [PATCH 318/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=205=20useful=20Vim?= =?UTF-8?q?=20plugins=20for=20developers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...110 5 useful Vim plugins for developers.md | 369 ++++++++++++++++++ 1 file changed, 369 insertions(+) create mode 100644 sources/tech/20190110 5 useful Vim plugins for developers.md diff --git a/sources/tech/20190110 5 useful Vim plugins for developers.md b/sources/tech/20190110 5 useful Vim plugins for developers.md new file mode 100644 index 0000000000..985f6104cc --- /dev/null +++ b/sources/tech/20190110 5 useful Vim plugins for developers.md @@ -0,0 +1,369 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 useful Vim plugins for developers) +[#]: via: (https://opensource.com/article/19/1/vim-plugins-developers) +[#]: author: (Ricardo Gerardi https://opensource.com/users/rgerardi) + +5 useful Vim plugins for developers +====== +Expand Vim's capabilities and improve your workflow with these five plugins for writing code. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh) + +I have used [Vim][1] as a text editor for over 20 years, but about two years ago I decided to make it my primary text editor. I use Vim to write code, configuration files, blog articles, and pretty much everything I can do in plaintext. Vim has many great features and, once you get used to it, you become very productive. + +I tend to use Vim's robust native capabilities for most of what I do, but there are a number of plugins developed by the open source community that extend Vim's capabilities, improve your workflow, and make you even more productive. + +Following are five plugins that are useful when using Vim to write code in any programming language. + +### 1. Auto Pairs + +The [Auto Pairs][2] plugin helps insert and delete pairs of characters, such as brackets, parentheses, or quotation marks. This is very useful for writing code, since most programming languages use pairs of characters in their syntax—such as parentheses for function calls or quotation marks for string definitions. + +In its most basic functionality, Auto Pairs inserts the corresponding closing character when you type an opening character. For example, if you enter a bracket **[** , Auto-Pairs automatically inserts the closing bracket **]**. Conversely, if you use the Backspace key to delete the opening bracket, Auto Pairs deletes the corresponding closing bracket. + +If you have automatic indentation on, Auto Pairs inserts the paired character in the proper indented position when you press Return/Enter, saving you from finding the correct position and typing the required spaces or tabs. + +Consider this Go code block for instance: + +``` +package main + +import "fmt" + +func main() { +    x := true +    items := []string{"tv", "pc", "tablet"} + +    if x { +        for _, i := range items +    } +} +``` + +Inserting an opening curly brace **{** after **items** and pressing Return/Enter produces this result: + +``` +package main + +import "fmt" + +func main() { +    x := true +    items := []string{"tv", "pc", "tablet"} + +    if x { +        for _, i := range items  { +            | (cursor here) +        } +    } +} +``` + +Auto Pairs offers many other options (which you can read about on [GitHub][3]), but even these basic features will save time. + +### 2. NERD Commenter + +The [NERD Commenter][4] plugin adds code-commenting functions to Vim, similar to the ones found in an integrated development environment (IDE). With this plugin installed, you can select one or several lines of code and change them to comments with the press of a button. + +NERD Commenter integrates with the standard Vim [filetype][5] plugin, so it understands several programming languages and uses the appropriate commenting characters for single or multi-line comments. + +The easiest way to get started is by pressing **Leader+Space** to toggle the current line between commented and uncommented. The standard Vim Leader key is the **\** character. + +In Visual mode, you can select multiple lines and toggle their status at the same time. NERD Commenter also understands counts, so you can provide a count n followed by the command to change n lines together. + +Other useful features are the "Sexy Comment," triggered by **Leader+cs** , which creates a fancy comment block using the multi-line comment character. For example, consider this block of code: + +``` +package main + +import "fmt" + +func main() { +    x := true +    items := []string{"tv", "pc", "tablet"} + +    if x { +        for _, i := range items { +            fmt.Println(i) +        } +    } +} +``` + +Selecting all the lines in **function main** and pressing **Leader+cs** results in the following comment block: + +``` +package main + +import "fmt" + +func main() { +/* + *    x := true + *    items := []string{"tv", "pc", "tablet"} + * + *    if x { + *        for _, i := range items { + *            fmt.Println(i) + *        } + *    } + */ +} +``` + +Since all the lines are commented in one block, you can uncomment the entire block by toggling any of the lines of the block with **Leader+Space**. + +NERD Commenter is a must-have for any developer using Vim to write code. + +### 3. VIM Surround + +The [Vim Surround][6] plugin helps you "surround" existing text with pairs of characters (such as parentheses or quotation marks) or tags (such as HTML or XML tags). It's similar to Auto Pairs but, instead of working while you're inserting text, it's more useful when you're editing text. + +For example, if you have the following sentence: + +``` +"Vim plugins are awesome !" +``` + +You can remove the quotation marks around the sentence by pressing the combination **ds"** while your cursor is anywhere between the quotation marks: + +``` +Vim plugins are awesome ! +``` + +You can also change the double quotation marks to single quotation marks with the command **cs"'** : + +``` +'Vim plugins are awesome !' +``` + +Or replace them with brackets by pressing **cs'[** + +``` +[ Vim plugins are awesome ! ] +``` + +While it's a great help for text objects, this plugin really shines when working with HTML or XML tags. Consider the following HTML line: + +``` +

Vim plugins are awesome !

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

Vim plugins are awesome !

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

Vim plugins are awesome !

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

Vim plugins are awesome !

+
+``` + +Vim Surround has many other options. Give it a try—and consult [GitHub][7] for additional information. + +### 4\. Vim Gitgutter + +The [Vim Gitgutter][8] plugin is useful for anyone using Git for version control. It shows the output of **Git diff** as symbols in the "gutter"—the sign column where Vim presents additional information, such as line numbers. For example, consider the following as the committed version in Git: + +``` +  1 package main +  2 +  3 import "fmt" +  4 +  5 func main() { +  6     x := true +  7     items := []string{"tv", "pc", "tablet"} +  8 +  9     if x { + 10         for _, i := range items { + 11             fmt.Println(i) + 12         } + 13     } + 14 } +``` + +After making some changes, Vim Gitgutter displays the following symbols in the gutter: + +``` +    1 package main +    2 +    3 import "fmt" +    4 +_   5 func main() { +    6     items := []string{"tv", "pc", "tablet"} +    7 +~   8     if len(items) > 0 { +    9         for _, i := range items { +   10             fmt.Println(i) ++  11             fmt.Println("------") +   12         } +   13     } +   14 } +``` + +The **-** symbol shows that a line was deleted between lines 5 and 6. The **~** symbol shows that line 8 was modified, and the symbol **+** shows that line 11 was added. + +In addition, Vim Gitgutter allows you to navigate between "hunks"—individual changes made in the file—with **[c** and **]c** , or even stage individual hunks for commit by pressing **Leader+hs**. + +This plugin gives you immediate visual feedback of changes, and it's a great addition to your toolbox if you use Git. + +### 5\. VIM Fugitive + +[Vim Fugitive][9] is another great plugin for anyone incorporating Git into the Vim workflow. It's a Git wrapper that allows you to execute Git commands directly from Vim and integrates with Vim's interface. This plugin has many features—check its [GitHub][10] page for more information. + +Here's a basic Git workflow example using Vim Fugitive. Considering the changes we've made to the Go code block on section 4, you can use **git blame** by typing the command **:Gblame** : + +``` +e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│    1 package main +e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│    2 +e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│    3 import "fmt" +e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│    4 +e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│_   5 func main() { +e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│    6     items := []string{"tv", "pc", "tablet"} +e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│    7 +00000000 (Not Committed Yet 2018-12-05 18:55:00 -0500)│~   8     if len(items) > 0 { +e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│    9         for _, i := range items { +e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│   10             fmt.Println(i) +00000000 (Not Committed Yet 2018-12-05 18:55:00 -0500)│+  11             fmt.Println("------") +e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│   12         } +e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│   13     } +e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│   14 } +``` + +You can see that lines 8 and 11 have not been committed. Check the repository status by typing **:Gstatus** : + +``` + 1 # On branch master +  2 # Your branch is up to date with 'origin/master'. +  3 # +  4 # Changes not staged for commit: +  5 #   (use "git add ..." to update what will be committed) +  6 #   (use "git checkout -- ..." to discard changes in working directory) +  7 # +  8 #       modified:   vim-5plugins/examples/test1.go +  9 # + 10 no changes added to commit (use "git add" and/or "git commit -a") +-------------------------------------------------------------------------------------------------------- +    1 package main +    2 +    3 import "fmt" +    4 +_   5 func main() { +    6     items := []string{"tv", "pc", "tablet"} +    7 +~   8     if len(items) > 0 { +    9         for _, i := range items { +   10             fmt.Println(i) ++  11             fmt.Println("------") +   12         } +   13     } +   14 } +``` + +Vim Fugitive opens a split window with the result of **git status**. You can stage a file for commit by pressing the **-** key on the line with the name of the file. You can reset the status by pressing **-** again. The message updates to reflect the new status: + +``` +  1 # On branch master +  2 # Your branch is up to date with 'origin/master'. +  3 # +  4 # Changes to be committed: +  5 #   (use "git reset HEAD ..." to unstage) +  6 # +  7 #       modified:   vim-5plugins/examples/test1.go +  8 # +-------------------------------------------------------------------------------------------------------- +    1 package main +    2 +    3 import "fmt" +    4 +_   5 func main() { +    6     items := []string{"tv", "pc", "tablet"} +    7 +~   8     if len(items) > 0 { +    9         for _, i := range items { +   10             fmt.Println(i) ++  11             fmt.Println("------") +   12         } +   13     } +   14 } +``` + +Now you can use the command **:Gcommit** to commit the changes. Vim Fugitive opens another split that allows you to enter a commit message: + +``` +  1 vim-5plugins: Updated test1.go example file +  2 # Please enter the commit message for your changes. Lines starting +  3 # with '#' will be ignored, and an empty message aborts the commit. +  4 # +  5 # On branch master +  6 # Your branch is up to date with 'origin/master'. +  7 # +  8 # Changes to be committed: +  9 #       modified:   vim-5plugins/examples/test1.go + 10 # +``` + +Save the file with **:wq** to complete the commit: + +``` +[master c3bf80f] vim-5plugins: Updated test1.go example file + 1 file changed, 2 insertions(+), 2 deletions(-) +Press ENTER or type command to continue +``` + +You can use **:Gstatus** again to see the result and **:Gpush** to update the remote repository with the new commit. + +``` +  1 # On branch master +  2 # Your branch is ahead of 'origin/master' by 1 commit. +  3 #   (use "git push" to publish your local commits) +  4 # +  5 nothing to commit, working tree clean +``` + +If you like Vim Fugitive and want to learn more, the GitHub repository has links to screencasts showing additional functionality and workflows. Check it out! + +### What's next? + +These Vim plugins help developers write code in any programming language. There are two other categories of plugins to help developers: code-completion plugins and syntax-checker plugins. They are usually related to specific programming languages, so I will cover them in a follow-up article. + +Do you have another Vim plugin you use when writing code? Please share it in the comments below. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/vim-plugins-developers + +作者:[Ricardo Gerardi][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/rgerardi +[b]: https://github.com/lujun9972 +[1]: https://www.vim.org/ +[2]: https://www.vim.org/scripts/script.php?script_id=3599 +[3]: https://github.com/jiangmiao/auto-pairs +[4]: https://github.com/scrooloose/nerdcommenter +[5]: http://vim.wikia.com/wiki/Filetype.vim +[6]: https://www.vim.org/scripts/script.php?script_id=1697 +[7]: https://github.com/tpope/vim-surround +[8]: https://github.com/airblade/vim-gitgutter +[9]: https://www.vim.org/scripts/script.php?script_id=2975 +[10]: https://github.com/tpope/vim-fugitive From e78b49a5f1f75bfa621ef4169d357f604d0993e4 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 11:32:44 +0800 Subject: [PATCH 319/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20You=20(probably)?= =?UTF-8?q?=20don't=20need=20Kubernetes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...14 You (probably) don-t need Kubernetes.md | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 sources/talk/20190114 You (probably) don-t need Kubernetes.md diff --git a/sources/talk/20190114 You (probably) don-t need Kubernetes.md b/sources/talk/20190114 You (probably) don-t need Kubernetes.md new file mode 100644 index 0000000000..5526f48f48 --- /dev/null +++ b/sources/talk/20190114 You (probably) don-t need Kubernetes.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (You (probably) don't need Kubernetes) +[#]: via: (https://arp242.net/weblog/dont-need-k8s.html) +[#]: author: (Martin Tournoij https://arp242.net/) + +You (probably) don't need Kubernetes +====== + +This may perhaps be an unpopular opinion, but the overwhelming majority of companies are probably better off not using k8s. + +You know those old “Hello world according to programmer skill” jokes that start with `printf("hello, world\n")` for a junior programmer and end with some convoluted Java OOP design pattern solution for senior software architect engineer? This is kind of like that. + +* Junior sysops + `./binary` +* Experienced sysops + `./binary` on EC2. +* devops + Self-deployed CI pipeline to run `./binary` on EC2. +* Senior cloud orchestration engineer + k8s orchestrated self-deployed CI pipeline to run `./binary` on E2C platform. + + + +¯\\_(ツ)_/¯ + +That doesn’t mean that Kubernetes or any of these things are bad per se, just as Java or OOP aren’t bad per se, but rather that they’re horribly misapplied in many cases, just as using several Java OOP design patterns are horribly misapplied to a hello world program. For most companies the sysops requirements are fundamentally not very complex, and applying k8s to them makes litle sense. + +Complexity creates work by its very nature, and I’m skeptical that using k8s is a time-saver for most users. It’s like spending a day on a script to automate some 10-minute task that you do once a month. That’s not a good time investment (especially since the chances are you’ll have to invest further time in the future by expanding or debugging that script at some point). + +Your deployments probably should be automated – lest you [end up like Knightmare][1] – but k8s can often be replaced by a simple shell script. + +In our own company the sysops team spent a lot of time setting up k8s. They also had to spend a lot of time on updating to a newer version a while ago (1.6 ➙ 1.8). And the result is something no one really understands without really diving in to k8s, and even then it’s hard (those YAML files, yikes!) + +Before I could debug and fix deploy issues myself. Now that’s a lot harder. I understand the basic concepts, but that’s not all that useful when actually debugging practical issues. I don’t deal with k8s often enough to justify learning this. + +That k8s is really hard is not a novel insight, which is why there are a host of “k8s made easy” solutions out there. The idea of adding another layer on top of k8s to “make it easier” strikes me as, ehh, unwise. It’s not like that complexity disappears; you’ve just hidden it. + +I have said this many times before: when determining if something is “easy” then my prime concern is not how easy something is to write, but how easy something is to debug when things fail. Wrapping k8s will not make things easier to debug, quite the opposite: it will make it even harder. + +There is a famous Blaise Pascal quote: + +> All human evil comes from a single cause, man’s inability to sit still in a room. + +k8s – and to lesser extent, Docker – seem to be an example of that. A lot of people seem lost in the excitement of the moment and are “k8s al the things!”, just as some people were lost in the excitement when Java OOP was new, so everything has to be converted from the “old” way to the “new” ones, even though the “old” ways still worked fine. + +Sometimes the IT industry is pretty silly. + +Or to summarize this post [with a Tweet][2]: + +> 2014 - We must adopt #microservices to solve all problems with monoliths +> 2016 - We must adopt #docker to solve all problems with microservices +> 2018 - We must adopt #kubernetes to solve all problems with docker + +You can mail me at [martin@arp242.net][3] or [create a GitHub issue][4] for feedback, questions, etc. + +-------------------------------------------------------------------------------- + +via: https://arp242.net/weblog/dont-need-k8s.html + +作者:[Martin Tournoij][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://arp242.net/ +[b]: https://github.com/lujun9972 +[1]: https://dougseven.com/2014/04/17/knightmare-a-devops-cautionary-tale/ +[2]: https://twitter.com/sahrizv/status/1018184792611827712 +[3]: mailto:martin@arp242.net +[4]: https://github.com/Carpetsmoker/arp242.net/issues/new From e35207fc1a47958479e2224f1b70aad62954ff1e Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 15 Jan 2019 11:35:34 +0800 Subject: [PATCH 320/322] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Get=20started=20w?= =?UTF-8?q?ith=20Joplin,=20a=20note-taking=20app?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... started with Joplin, a note-taking app.md | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 sources/tech/20190113 Get started with Joplin, a note-taking app.md diff --git a/sources/tech/20190113 Get started with Joplin, a note-taking app.md b/sources/tech/20190113 Get started with Joplin, a note-taking app.md new file mode 100644 index 0000000000..2498435040 --- /dev/null +++ b/sources/tech/20190113 Get started with Joplin, a note-taking app.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with Joplin, a note-taking app) +[#]: via: (https://opensource.com/article/19/1/productivity-tool-joplin) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney (Kevin Sonney)) + +Get started with Joplin, a note-taking app +====== +Learn how open source tools can help you be more productive in 2019. First up, Joplin. +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop.png?itok=pGfEfu2S) + +There seems to be a mad rush at the beginning of every year to find ways to be more productive. New Year's resolutions, the itch to start the year off right, and of course, an "out with the old, in with the new" attitude all contribute to this. And the usual round of recommendations is heavily biased towards closed source and proprietary software. It doesn't have to be that way. + +Here's the first of my picks for 19 new (or new-to-you) open source tools to help you be more productive in 2019. + +### Joplin + +In the realm of productivity tools, note-taking apps are VERY handy. Yes, you can use the open source [NixNote][1] to access [Evernote][2] notes, but it's still linked to the Evernote servers and still relies on a third party for security. And while you CAN export your Evernote notes from NixNote, the only format options are NixNote XML or PDF files. + +![](https://opensource.com/sites/default/files/uploads/joplin-1.png) + +Enter [Joplin][3]. Joplin is a NodeJS application that runs and stores notes locally, allows you to encrypt your notes and supports multiple sync methods. Joplin can run as a console or graphical application on Windows, Mac, and Linux. Joplin also has mobile apps for Android and iOS, meaning you can take your notes with you without a major hassle. Joplin even allows you to format notes with Markdown, HTML, or plain text. + +![](https://opensource.com/sites/default/files/uploads/joplin-3.png) + +One really nice thing about Joplin is it supports two kinds of notes: plain notes and to-do notes. Plain notes are what you expect—documents containing text. To-do notes, on the other hand, have a checkbox in the notes list that allows you to mark them "done." And since the to-do note is still a note, you can include lists, documentation, and additional to-do items in a to-do note. + +When using the GUI, you can toggle editor views between plain text, WYSIWYG, and a split screen showing both the source text and the rendered view. You can also specify an external editor in the GUI, making it easy to update notes with Vim, Emacs, or any other editor capable of handling text documents. + +![Joplin console version][5] + +Joplin in the console. + +The console interface is absolutely fantastic. While it lacks a WYSIWYG editor, it defaults to the text editor for your login. It also has a powerful command mode that allows you to do almost everything you can do in the GUI version. And it renders Markdown correctly in the viewer. + +You can group notes in notebooks and tag notes for easy grouping across your notebooks. And it even has built-in search, so you can find things if you forget where you put them. + +Overall, Joplin is a first-class note-taking app ([and a great alternative to Evernote][6]) that will help you be organized and more productive over the next year. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/1/productivity-tool-joplin + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney (Kevin Sonney) +[b]: https://github.com/lujun9972 +[1]: http://nixnote.org/NixNote-Home/ +[2]: https://evernote.com/ +[3]: https://joplin.cozic.net/ +[4]: https://opensource.com/article/19/1/file/419776 +[5]: https://opensource.com/sites/default/files/uploads/joplin-2_0.png (Joplin console version) +[6]: https://opensource.com/article/17/12/joplin-open-source-evernote-alternative From 925dae2cb1aeaeac8ba00b0078aba09a3fb42ca0 Mon Sep 17 00:00:00 2001 From: hopefully2333 <787016457@qq.com> Date: Tue, 15 Jan 2019 13:59:17 +0800 Subject: [PATCH 321/322] translating by hopefully2333 translating by hopefully2333 --- sources/talk/20180919 5 ways DevSecOps changes security.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/talk/20180919 5 ways DevSecOps changes security.md b/sources/talk/20180919 5 ways DevSecOps changes security.md index 28e4b90eec..aef3780fdb 100644 --- a/sources/talk/20180919 5 ways DevSecOps changes security.md +++ b/sources/talk/20180919 5 ways DevSecOps changes security.md @@ -1,3 +1,5 @@ + translating by hopefully2333 + 5 ways DevSecOps changes security ====== From e0797ad45f4ebfec38794b30628413bdb1e772a8 Mon Sep 17 00:00:00 2001 From: Bestony Date: Tue, 15 Jan 2019 17:09:14 +0800 Subject: [PATCH 322/322] feat translated --- ...ons for open source project maintainers.md | 64 ----------------- ...ons for open source project maintainers.md | 70 +++++++++++++++++++ 2 files changed, 70 insertions(+), 64 deletions(-) delete mode 100644 sources/talk/20181212 5 resolutions for open source project maintainers.md create mode 100644 translated/talk/20181212 5 resolutions for open source project maintainers.md diff --git a/sources/talk/20181212 5 resolutions for open source project maintainers.md b/sources/talk/20181212 5 resolutions for open source project maintainers.md deleted file mode 100644 index 8004b05745..0000000000 --- a/sources/talk/20181212 5 resolutions for open source project maintainers.md +++ /dev/null @@ -1,64 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (bestony) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (5 resolutions for open source project maintainers) -[#]: via: (https://opensource.com/article/18/12/resolutions-open-source-project-maintainers) -[#]: author: (Ben Cotton https://opensource.com/users/bcotton) - -5 resolutions for open source project maintainers -====== -No matter how you say it, good communication is essential to strong open source communities. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/spark_sparkler_fire_new_year_idea.png?itok=rnyMpVP8) - -I'm generally not big on New Year's resolutions. I have no problem with self-improvement, of course, but I tend to anchor around other parts of the calendar. Even so, there's something about taking down this year's free calendar and replacing it with next year's that inspires some introspection. - -In 2017, I resolved to not share articles on social media until I'd read them. I've kept to that pretty well, and I'd like to think it has made me a better citizen of the internet. For 2019, I'm thinking about resolutions to make me a better open source software maintainer. - -Here are some resolutions I'll try to stick to on the projects where I'm a maintainer or co-maintainer. - -### 1\. Include a code of conduct - -Jono Bacon included "not enforcing the code of conduct" in his article "[7 mistakes you're probably making][1]." Of course, to enforce a code of conduct, you must first have a code of conduct. I plan on defaulting to the [Contributor Covenant][2], but you can use whatever you like. As with licenses, it's probably best to use one that's already written instead of writing your own. But the important thing is to find something that defines how you want your community to behave, whatever that looks like. Once it's written down and enforced, people can decide for themselves if it looks like the kind of community they want to be a part of. - -### 2\. Make the license clear and specific - -You know what really stinks? Unclear licenses. "This software is licensed under the GPL" with no further text doesn't tell me much. Which version of the [GPL][3]? Do I get to pick? For non-code portions of a project, "licensed under a Creative Commons license" is even worse. I love the [Creative Commons licenses][4], but there are several different licenses with significantly different rights and obligations. So, I will make it very clear which variant and version of a license applies to my projects. I will include the full text of the license in the repo and a concise note in the other files. - -Sort of related to this is using an [OSI][5]-approved license. It's tempting to come up with a new license that says exactly what you want it to say, but good luck if you ever need to enforce it. Will it hold up? Will the people using your project understand it? - -### 3\. Triage bug reports and questions quickly - -Few things in technology scale as poorly as open source maintainers. Even on small projects, it can be hard to find the time to answer every question and fix every bug. But that doesn't mean I can't at least acknowledge the person. It doesn't have to be a multi-paragraph reply. Even just labeling the GitHub issue shows that I saw it. Maybe I'll get to it right away. Maybe I'll get to it a year later. But it's important for the community to see that, yes, there is still someone here. - -### 4\. Don't push features or bug fixes without accompanying documentation - -For as much as my open source contributions over the years have revolved around documentation, my projects don't reflect the importance I put on it. There aren't many commits I can push that don't require some form of documentation. New features should obviously be documented at (or before!) the time they're committed. But even bug fixes should get an entry in the release notes. If nothing else, a push is a good opportunity to also make a commit to improving the docs. - -### 5\. Make it clear when I'm abandoning a project - -I'm really bad at saying "no" to things. I told the editors I'd write one or two articles for [Opensource.com][6] and here I am almost 60 articles later. Oops. But at some point, the things that once held my interests no longer do. Maybe the project is unnecessary because its functionality got absorbed into a larger project. Maybe I'm just tired of it. But it's unfair to the community (and potentially dangerous, as the recent [event-stream malware injection][7] showed) to leave a project in limbo. Maintainers have the right to walk away whenever and for whatever reason, but it should be clear that they have. - -Whether you're an open source maintainer or contributor, if you know other resolutions project maintainers should make, please share them in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/12/resolutions-open-source-project-maintainers - -作者:[Ben Cotton][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/bcotton -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/article/17/8/mistakes-open-source-avoid -[2]: https://www.contributor-covenant.org/ -[3]: https://opensource.org/licenses/gpl-license -[4]: https://creativecommons.org/share-your-work/licensing-types-examples/ -[5]: https://opensource.org/ -[6]: http://Opensource.com -[7]: https://arstechnica.com/information-technology/2018/11/hacker-backdoors-widely-used-open-source-software-to-steal-bitcoin/ diff --git a/translated/talk/20181212 5 resolutions for open source project maintainers.md b/translated/talk/20181212 5 resolutions for open source project maintainers.md new file mode 100644 index 0000000000..2384da4c3c --- /dev/null +++ b/translated/talk/20181212 5 resolutions for open source project maintainers.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: (bestony) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 resolutions for open source project maintainers) +[#]: via: (https://opensource.com/article/18/12/resolutions-open-source-project-maintainers) +[#]: author: (Ben Cotton https://opensource.com/users/bcotton) + +5个为开源项目维护者而生的解决方案 +====== + +不管你怎么说,好的交流是一个活跃的开源社区的必备品。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/spark_sparkler_fire_new_year_idea.png?itok=rnyMpVP8) + +我不会给你一个大而全的新年的解决方案。关于自我提升,我没有任何问题,这篇文章我希望锚定这个日历中的另外一部分。不过即使是这样,这里也有一些关于取消今年的免费日历并将其替换为新的日历的内容,以激发自省。 + +在 2017 年,我从不在社交媒体上分享我从未阅读过的文章。我一直保持这样的状态,我也认为它让我成为了一个更好的互联网公民。对于 2019 年,我正在考虑让我成为更好的开源软件维护者的解决方案。 + + +下面是一些我在一些项目中担任维护者或共同维护者时坚持的决议: + +### 1\. 包含行为准则 + +Jono Bacon 在他的文章“[7个你可能犯的错误][1]”中包含了“不强制执行行为准则”。当然,去强制执行行为准则,你首先需要有一个行为准则。我设计了一个默认的[贡献者契约][2],但是你可以使用其他你喜欢的。关于这个 License ,最好的方法是使用别人已经写好的,而不是你自己写的。但是重要的是,要找到一些能够定义你希望你的社区执行的,无论他们是什么样子。一旦这些被记录下来并强制执行,人们就能自行决定是否成为他们想象中社区的一份子。 + + +### 2\. 使许可证清晰且明确 + +你知道什么真的很烦么?不清晰的许可证。"这个软件基于 GPL 授权",如果没有进一步提供更多信息的文字,我无法知道更多信息。基于哪个版本的[GPL][3]?对于项目的非代码部分,“根据知识共享许可证授权”更糟糕。我喜欢[知识共享许可证][4],但其中有几个不同的许可证包含着不同的权利和义务。因此,我将清楚的说明许可证的版本适用于我的项目。我将会在 repo 中包含许可的全文,并在其他文件中包含简明的注释。 + +与此相关的一类是使用 [OSI][5]批准的许可证。想出一个新的准确的说明了你想要表达什么的许可证是有可能的,但是如果你需要强制执行它,祝你好运。会坚持使用它么?使用您项目的人会理解么? + + + +### 3\. 快速分类错误报告和问题 + +技术的规模很难会和开源维护者一样差。即使在小型项目中,也很难找到时间去回答每个问题并修复每个错误。但这并不意味着我至少不能去回应这个人,它没必要是多段的回复。即使只是标记了 Github Issue 也表明了我看见它了。也许我马上就会处理它,也许一年后我会处理它。但是让社区看到它很重要。是的,这里还有其他人。 + +### 4\. 如果没有伴随的文档,请不要推送新特性或 Bugfix + +尽管多年来我的开源贡献都围绕着文档,但我的项目并没有反映出我对他们的重视。我很少有不需要某种形式文档的推送。新的特性显然应该在他们被提交甚至是之前编写文档。但即使是错误修复,也应该在发行说明中有一个条目。如果没有什么其他的,一个 push 也是很好的改善文档的机会。 + +### 5\. 放弃一个项目时,要说清楚 + +我很擅长对事情说“不”,我告诉编辑我会为 [Opensource.com][6] 写一到两篇文章,现在我有了将近 60 篇文章。Oops。但在某些时候,曾经符合我利益的事情不再有用。也许该项目是不必要的,因为它的功能被吸收到更大的项目中,也许只是我厌倦了它。但这对社区是不公平的(并且存在潜在的危险,正如最近的[event-stream 恶意软件注入][7]所示),会让项目陷入困境。维护者有权随时离开,但他们离开时应该清清楚楚。 + +无论你是开源维护者还是贡献者,如果你知道项目维护者应该作出的其他决议,请在评论中分享! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/12/resolutions-open-source-project-maintainers + +作者:[Ben Cotton][a] +选题:[lujun9972][b] +译者:[bestony](https://github.com/bestony) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/bcotton +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/article/17/8/mistakes-open-source-avoid +[2]: https://www.contributor-covenant.org/ +[3]: https://opensource.org/licenses/gpl-license +[4]: https://creativecommons.org/share-your-work/licensing-types-examples/ +[5]: https://opensource.org/ +[6]: http://Opensource.com +[7]: https://arstechnica.com/information-technology/2018/11/hacker-backdoors-widely-used-open-source-software-to-steal-bitcoin/